diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/option_select.c | 11 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 17 | ||||
-rw-r--r-- | apps/menus/playback_menu.c | 39 | ||||
-rw-r--r-- | apps/settings_list.c | 35 | ||||
-rw-r--r-- | apps/settings_list.h | 1 |
5 files changed, 37 insertions, 66 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 8839f42e42..d7f27f64eb 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -470,7 +470,10 @@ bool option_screen(const struct settings_list *setting, | |||
470 | int *variable; | 470 | int *variable; |
471 | bool allow_wrap = setting->flags & F_NO_WRAP ? false : true; | 471 | bool allow_wrap = setting->flags & F_NO_WRAP ? false : true; |
472 | bool cb_on_select_only = | 472 | bool cb_on_select_only = |
473 | ((setting->flags & F_CB_ON_SELECT_ONLY) == F_CB_ON_SELECT_ONLY); | 473 | ((setting->flags & F_CB_ON_SELECT_ONLY) == F_CB_ON_SELECT_ONLY); |
474 | bool cb_on_changed = | ||
475 | ((setting->flags & F_CB_ON_SELECT_ONLY_IF_CHANGED) == F_CB_ON_SELECT_ONLY_IF_CHANGED); | ||
476 | |||
474 | int var_type = setting->flags&F_T_MASK; | 477 | int var_type = setting->flags&F_T_MASK; |
475 | void (*function)(int) = NULL; | 478 | void (*function)(int) = NULL; |
476 | char *title; | 479 | char *title; |
@@ -561,8 +564,12 @@ bool option_screen(const struct settings_list *setting, | |||
561 | } | 564 | } |
562 | settings_save(); | 565 | settings_save(); |
563 | done = true; | 566 | done = true; |
567 | |||
564 | if (cb_on_select_only && function) | 568 | if (cb_on_select_only && function) |
565 | function(*variable); | 569 | { |
570 | if (!cb_on_changed || (*variable != oldvalue)) | ||
571 | function(*variable); | ||
572 | } | ||
566 | } | 573 | } |
567 | else if(default_event_handler(action) == SYS_USB_CONNECTED) | 574 | else if(default_event_handler(action) == SYS_USB_CONNECTED) |
568 | { | 575 | { |
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 221dfe3111..109414336f 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -418,8 +418,6 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter | |||
418 | int quick_screen_quick(int button_enter) | 418 | int quick_screen_quick(int button_enter) |
419 | { | 419 | { |
420 | struct gui_quickscreen qs; | 420 | struct gui_quickscreen qs; |
421 | bool oldshuffle = global_settings.playlist_shuffle; | ||
422 | int oldrepeat = global_settings.repeat_mode; | ||
423 | #ifdef HAVE_ALBUMART | 421 | #ifdef HAVE_ALBUMART |
424 | int old_album_art = global_settings.album_art; | 422 | int old_album_art = global_settings.album_art; |
425 | #endif | 423 | #endif |
@@ -438,21 +436,6 @@ int quick_screen_quick(int button_enter) | |||
438 | if (ret & QUICKSCREEN_CHANGED) | 436 | if (ret & QUICKSCREEN_CHANGED) |
439 | { | 437 | { |
440 | settings_save(); | 438 | settings_save(); |
441 | /* make sure repeat/shuffle/any other nasty ones get updated */ | ||
442 | if ( oldrepeat != global_settings.repeat_mode && | ||
443 | (audio_status() & AUDIO_STATUS_PLAY) ) | ||
444 | { | ||
445 | audio_flush_and_reload_tracks(); | ||
446 | } | ||
447 | if (oldshuffle != global_settings.playlist_shuffle | ||
448 | && audio_status() & AUDIO_STATUS_PLAY) | ||
449 | { | ||
450 | replaygain_update(); | ||
451 | if (global_settings.playlist_shuffle) | ||
452 | playlist_randomise(NULL, current_tick, true); | ||
453 | else | ||
454 | playlist_sort(NULL, true); | ||
455 | } | ||
456 | #ifdef HAVE_ALBUMART | 439 | #ifdef HAVE_ALBUMART |
457 | if (old_album_art != global_settings.album_art) | 440 | if (old_album_art != global_settings.album_art) |
458 | set_albumart_mode(global_settings.album_art); | 441 | set_albumart_mode(global_settings.album_art); |
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index e4945be0b5..a0732d3feb 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c | |||
@@ -244,19 +244,9 @@ static int playback_callback(int action, | |||
244 | struct gui_synclist *this_list) | 244 | struct gui_synclist *this_list) |
245 | { | 245 | { |
246 | (void)this_list; | 246 | (void)this_list; |
247 | static bool old_shuffle = false; | ||
248 | static int old_repeat = 0; | ||
249 | switch (action) | 247 | switch (action) |
250 | { | 248 | { |
251 | case ACTION_ENTER_MENUITEM: | 249 | case ACTION_ENTER_MENUITEM: |
252 | if (this_item == &shuffle_item) | ||
253 | { | ||
254 | old_shuffle = global_settings.playlist_shuffle; | ||
255 | } | ||
256 | else if (this_item == &repeat_mode) | ||
257 | { | ||
258 | old_repeat = global_settings.repeat_mode; | ||
259 | } | ||
260 | break; | 250 | break; |
261 | 251 | ||
262 | case ACTION_EXIT_MENUITEM: /* on exit */ | 252 | case ACTION_EXIT_MENUITEM: /* on exit */ |
@@ -268,35 +258,6 @@ static int playback_callback(int action, | |||
268 | break; | 258 | break; |
269 | } | 259 | } |
270 | #endif /* HAVE_PLAY_FREQ */ | 260 | #endif /* HAVE_PLAY_FREQ */ |
271 | |||
272 | if (!(audio_status() & AUDIO_STATUS_PLAY)) | ||
273 | break; | ||
274 | |||
275 | /* Playing only */ | ||
276 | if (this_item == &shuffle_item) | ||
277 | { | ||
278 | if (old_shuffle == global_settings.playlist_shuffle) | ||
279 | break; | ||
280 | |||
281 | replaygain_update(); | ||
282 | |||
283 | if (global_settings.playlist_shuffle) | ||
284 | { | ||
285 | playlist_randomise(NULL, current_tick, true); | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | playlist_sort(NULL, true); | ||
290 | } | ||
291 | } | ||
292 | else if (this_item == &repeat_mode) | ||
293 | { | ||
294 | if (old_repeat == global_settings.repeat_mode) | ||
295 | break; | ||
296 | |||
297 | audio_flush_and_reload_tracks(); | ||
298 | } | ||
299 | |||
300 | break; | 261 | break; |
301 | } | 262 | } |
302 | return action; | 263 | return action; |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 134b93cf48..a830ea7428 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -622,14 +622,31 @@ static void eq_set_default(void* setting, void* defaultval) | |||
622 | /* perform shuffle/unshuffle of the current playlist based on the boolean provided */ | 622 | /* perform shuffle/unshuffle of the current playlist based on the boolean provided */ |
623 | static void shuffle_playlist_callback(bool shuffle) | 623 | static void shuffle_playlist_callback(bool shuffle) |
624 | { | 624 | { |
625 | if (shuffle) | 625 | struct playlist_info *playlist = playlist_get_current(); |
626 | if (playlist->started) | ||
626 | { | 627 | { |
627 | playlist_randomise(NULL, current_tick, true); | 628 | if ((audio_status() & AUDIO_STATUS_PLAY) == AUDIO_STATUS_PLAY) |
629 | { | ||
630 | replaygain_update(); | ||
631 | if (shuffle) | ||
632 | { | ||
633 | playlist_randomise(playlist, current_tick, true); | ||
634 | } | ||
635 | else | ||
636 | { | ||
637 | playlist_sort(playlist, true); | ||
638 | } | ||
639 | } | ||
628 | } | 640 | } |
629 | else | 641 | } |
642 | |||
643 | static void repeat_mode_callback(int repeat) | ||
644 | { | ||
645 | if ((audio_status() & AUDIO_STATUS_PLAY) == AUDIO_STATUS_PLAY) | ||
630 | { | 646 | { |
631 | playlist_sort(NULL, true); | 647 | audio_flush_and_reload_tracks(); |
632 | } | 648 | } |
649 | (void)repeat; | ||
633 | } | 650 | } |
634 | 651 | ||
635 | #ifdef HAVE_QUICKSCREEN | 652 | #ifdef HAVE_QUICKSCREEN |
@@ -912,17 +929,19 @@ const struct settings_list settings[] = { | |||
912 | #endif | 929 | #endif |
913 | 930 | ||
914 | /* playback */ | 931 | /* playback */ |
915 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", shuffle_playlist_callback), | 932 | OFFON_SETTING(F_CB_ON_SELECT_ONLY_IF_CHANGED, playlist_shuffle, LANG_SHUFFLE, |
933 | false, "shuffle", shuffle_playlist_callback), | ||
934 | |||
916 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), | 935 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), |
917 | SYSTEM_SETTING(NVRAM(4), resume_crc32, -1), | 936 | SYSTEM_SETTING(NVRAM(4), resume_crc32, -1), |
918 | SYSTEM_SETTING(NVRAM(4), resume_elapsed, -1), | 937 | SYSTEM_SETTING(NVRAM(4), resume_elapsed, -1), |
919 | SYSTEM_SETTING(NVRAM(4), resume_offset, -1), | 938 | SYSTEM_SETTING(NVRAM(4), resume_offset, -1), |
920 | CHOICE_SETTING(0, repeat_mode, LANG_REPEAT, REPEAT_OFF, "repeat", | 939 | CHOICE_SETTING(F_CB_ON_SELECT_ONLY_IF_CHANGED, repeat_mode, LANG_REPEAT, |
921 | "off,all,one,shuffle" | 940 | REPEAT_OFF, "repeat", "off,all,one,shuffle" |
922 | #ifdef AB_REPEAT_ENABLE | 941 | #ifdef AB_REPEAT_ENABLE |
923 | ",ab" | 942 | ",ab" |
924 | #endif | 943 | #endif |
925 | , NULL, | 944 | , repeat_mode_callback, |
926 | #ifdef AB_REPEAT_ENABLE | 945 | #ifdef AB_REPEAT_ENABLE |
927 | 5, | 946 | 5, |
928 | #else | 947 | #else |
diff --git a/apps/settings_list.h b/apps/settings_list.h index d725bbef59..3e8739e525 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h | |||
@@ -102,6 +102,7 @@ struct table_setting { | |||
102 | #define F_TABLE_SETTING 0x2000 | 102 | #define F_TABLE_SETTING 0x2000 |
103 | #define F_ALLOW_ARBITRARY_VALS 0x4000 | 103 | #define F_ALLOW_ARBITRARY_VALS 0x4000 |
104 | #define F_CB_ON_SELECT_ONLY 0x20000 | 104 | #define F_CB_ON_SELECT_ONLY 0x20000 |
105 | #define F_CB_ON_SELECT_ONLY_IF_CHANGED (F_CB_ON_SELECT_ONLY|F_TEMPVAR) | ||
105 | /* these use the _isfunc_type type for the function */ | 106 | /* these use the _isfunc_type type for the function */ |
106 | /* typedef int (*_isfunc_type)(void); */ | 107 | /* typedef int (*_isfunc_type)(void); */ |
107 | #define F_MIN_ISFUNC 0x100000 /* min(above) is function pointer to above type */ | 108 | #define F_MIN_ISFUNC 0x100000 /* min(above) is function pointer to above type */ |