diff options
author | William Wilgus <wilgus.william@gmail.com> | 2023-08-27 10:54:44 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2023-08-29 01:29:38 -0400 |
commit | 1c80f5358110edd5777aeed15080249050ec2378 (patch) | |
tree | d5cd4dd9cddf488b3388472a3eb3d3f1c7eb72f9 /apps/gui | |
parent | 3883c978abdcb443ac6ca2b4a57d941c418e8b74 (diff) | |
download | rockbox-1c80f5358110edd5777aeed15080249050ec2378.tar.gz rockbox-1c80f5358110edd5777aeed15080249050ec2378.zip |
[Bugfix] shuffle shenanigans from g5288 Fix #13369 shuffle & repeat callbacks
shuffle and sort were called on startup before playlist_init
and also on setting switch even without select
repeat is also now handled in settings_list as well
after moving the callbacks to settings_list.c
there was then a problem of unintended callbacks on exit of the menus
fixed that with F_CB_ON_SELECT_ONLY
since the callback was called regardless of the setting being changed
on F_CB_ON_SELECT_ONLY which is preferable in some circumstances
I co-opted F_TEMPVAR to allow the callback only when the setting was changed
with the flag F_CB_ON_SELECT_ONLY_IF_CHANGED
Change-Id: I5265233bbb556dc06c45273e742be5d78510a806
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/option_select.c | 11 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 17 |
2 files changed, 9 insertions, 19 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); |