From 1c80f5358110edd5777aeed15080249050ec2378 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 27 Aug 2023 10:54:44 -0400 Subject: [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 --- apps/gui/option_select.c | 11 +++++++++-- apps/gui/quickscreen.c | 17 ----------------- 2 files changed, 9 insertions(+), 19 deletions(-) (limited to 'apps/gui') 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, int *variable; bool allow_wrap = setting->flags & F_NO_WRAP ? false : true; bool cb_on_select_only = - ((setting->flags & F_CB_ON_SELECT_ONLY) == F_CB_ON_SELECT_ONLY); + ((setting->flags & F_CB_ON_SELECT_ONLY) == F_CB_ON_SELECT_ONLY); + bool cb_on_changed = + ((setting->flags & F_CB_ON_SELECT_ONLY_IF_CHANGED) == F_CB_ON_SELECT_ONLY_IF_CHANGED); + int var_type = setting->flags&F_T_MASK; void (*function)(int) = NULL; char *title; @@ -561,8 +564,12 @@ bool option_screen(const struct settings_list *setting, } settings_save(); done = true; + if (cb_on_select_only && function) - function(*variable); + { + if (!cb_on_changed || (*variable != oldvalue)) + function(*variable); + } } else if(default_event_handler(action) == SYS_USB_CONNECTED) { 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 int quick_screen_quick(int button_enter) { struct gui_quickscreen qs; - bool oldshuffle = global_settings.playlist_shuffle; - int oldrepeat = global_settings.repeat_mode; #ifdef HAVE_ALBUMART int old_album_art = global_settings.album_art; #endif @@ -438,21 +436,6 @@ int quick_screen_quick(int button_enter) if (ret & QUICKSCREEN_CHANGED) { settings_save(); - /* make sure repeat/shuffle/any other nasty ones get updated */ - if ( oldrepeat != global_settings.repeat_mode && - (audio_status() & AUDIO_STATUS_PLAY) ) - { - audio_flush_and_reload_tracks(); - } - if (oldshuffle != global_settings.playlist_shuffle - && audio_status() & AUDIO_STATUS_PLAY) - { - replaygain_update(); - if (global_settings.playlist_shuffle) - playlist_randomise(NULL, current_tick, true); - else - playlist_sort(NULL, true); - } #ifdef HAVE_ALBUMART if (old_album_art != global_settings.album_art) set_albumart_mode(global_settings.album_art); -- cgit v1.2.3