album art setting: use settings callback

Since even Shuffle and Repeat are now immediately applied
from the Quickscreen, I suppose it makes sense to do the
same for the album art setting as the remaining holdout.

Change-Id: Ib1b56c31f28d8197e001901296d9897a23134564
This commit is contained in:
Christian Soffke 2025-06-08 16:57:41 +02:00
parent fbbf08575f
commit 5f593fb000
4 changed files with 14 additions and 41 deletions

View file

@ -39,9 +39,6 @@
#include "option_select.h"
#include "debug.h"
#include "shortcuts.h"
#ifdef HAVE_ALBUMART
#include "playback.h"
#endif
#include "appevents.h"
/* 1 top, 1 bottom, 2 on either side, 1 for the icons
@ -438,9 +435,6 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter
int quick_screen_quick(int button_enter)
{
struct gui_quickscreen qs;
#ifdef HAVE_ALBUMART
int old_album_art = global_settings.album_art;
#endif
bool usb = false;
for (int i = 0; i < 4; ++i)
@ -453,13 +447,7 @@ int quick_screen_quick(int button_enter)
int ret = gui_syncquickscreen_run(&qs, button_enter, &usb);
if (ret & QUICKSCREEN_CHANGED)
{
settings_save();
#ifdef HAVE_ALBUMART
if (old_album_art != global_settings.album_art)
set_albumart_mode(global_settings.album_art);
#endif
}
if (usb)
return QUICKSCREEN_IN_USB;
return ret & QUICKSCREEN_GOTO_SHORTCUTS_MENU ? QUICKSCREEN_GOTO_SHORTCUTS_MENU :

View file

@ -177,26 +177,7 @@ MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL);
MENUITEM_SETTING(play_frequency, &global_settings.play_frequency, NULL);
#endif
#ifdef HAVE_ALBUMART
static int albumart_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{
(void)this_item;
(void)this_list;
static int initial_aa_setting;
switch (action)
{
case ACTION_ENTER_MENUITEM:
initial_aa_setting = global_settings.album_art;
break;
case ACTION_EXIT_MENUITEM: /* on exit */
if (initial_aa_setting != global_settings.album_art)
set_albumart_mode(global_settings.album_art);
}
return action;
}
MENUITEM_SETTING(album_art, &global_settings.album_art,
albumart_callback);
MENUITEM_SETTING(album_art, &global_settings.album_art, NULL);
#endif
MENUITEM_SETTING(playback_log, &global_settings.playback_log, NULL);

View file

@ -656,6 +656,13 @@ static void playback_frequency_callback(int sample_rate_hz)
}
#endif /* HAVE_PLAY_FREQ */
#ifdef HAVE_ALBUMART
static void albumart_callback(int mode)
{
set_albumart_mode(mode);
}
#endif
/* perform shuffle/unshuffle of the current playlist based on the boolean provided */
static void shuffle_playlist_callback(bool shuffle)
{
@ -1032,12 +1039,12 @@ const struct settings_list settings[] = {
#endif /* HAVE_PLAY_FREQ */
#ifdef HAVE_ALBUMART
CHOICE_SETTING(0, album_art, LANG_ALBUM_ART, 1,
"album art", "off,prefer embedded,prefer image file",
NULL, 3,
ID2P(LANG_OFF),
ID2P(LANG_PREFER_EMBEDDED),
ID2P(LANG_PREFER_IMAGE_FILE)),
CHOICE_SETTING(F_CB_ON_SELECT_ONLY|F_CB_ONLY_IF_CHANGED, album_art,
LANG_ALBUM_ART, 1, "album art",
"off,prefer embedded,prefer image file",
albumart_callback, 3,
ID2P(LANG_OFF), ID2P(LANG_PREFER_EMBEDDED),
ID2P(LANG_PREFER_IMAGE_FILE)),
#endif
/* LCD */

View file

@ -47,9 +47,6 @@
#include "screens.h"
#include "talk.h"
#include "yesno.h"
#ifdef HAVE_ALBUMART
#include "playback.h"
#endif
#define MAX_SHORTCUT_NAME 64
#define SHORTCUTS_HDR "[shortcut]"