Enable access to Shortcuts Menu from QuickScreen

Offers a quick way of switching to the Shortcuts Menu
by pressing the 'context menu' button while QuickScreen
is active (e.g. long press Select on iPods and some other
players)

Change-Id: I38292c7070cf093a81e1db688809b1f0d6a8764a
This commit is contained in:
Christian Soffke 2021-10-26 03:05:50 +02:00
parent 498988d34a
commit 193ebb5a36
15 changed files with 86 additions and 43 deletions

View file

@ -320,13 +320,13 @@ static int quickscreen_touchscreen_button(void)
} }
#endif #endif
static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter, bool *usb) static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter, bool *usb)
{ {
int button; int button;
struct viewport parent[NB_SCREENS]; struct viewport parent[NB_SCREENS];
struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT];
struct viewport vp_icons[NB_SCREENS]; struct viewport vp_icons[NB_SCREENS];
bool changed = false; int ret = QUICKSCREEN_OK;
/* To quit we need either : /* To quit we need either :
* - a second press on the button that made us enter * - a second press on the button that made us enter
* - an action taken while pressing the enter button, * - an action taken while pressing the enter button,
@ -367,7 +367,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
} }
if (gui_quickscreen_do_button(qs, button)) if (gui_quickscreen_do_button(qs, button))
{ {
changed = true; ret |= QUICKSCREEN_CHANGED;
can_quit = true; can_quit = true;
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
gui_quickscreen_draw(qs, &screens[i], &parent[i], gui_quickscreen_draw(qs, &screens[i], &parent[i],
@ -389,6 +389,11 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_NON_STATIC); skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_NON_STATIC);
} }
else if (button == ACTION_STD_CONTEXT)
{
ret |= QUICKSCREEN_GOTO_SHORTCUTS_MENU;
break;
}
if ((button == button_enter) && can_quit) if ((button == button_enter) && can_quit)
break; break;
@ -405,7 +410,8 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
} }
pop_current_activity(); pop_current_activity();
return changed;
return ret;
} }
static const struct settings_list *get_setting(int gs_value, static const struct settings_list *get_setting(int gs_value,
@ -427,9 +433,6 @@ int quick_screen_quick(int button_enter)
#endif #endif
bool usb = false; bool usb = false;
if (global_settings.shortcuts_replaces_qs)
return do_shortcut_menu(NULL);
qs.items[QUICKSCREEN_TOP] = qs.items[QUICKSCREEN_TOP] =
get_setting(global_settings.qs_items[QUICKSCREEN_TOP], NULL); get_setting(global_settings.qs_items[QUICKSCREEN_TOP], NULL);
qs.items[QUICKSCREEN_LEFT] = qs.items[QUICKSCREEN_LEFT] =
@ -442,7 +445,8 @@ int quick_screen_quick(int button_enter)
get_setting(global_settings.qs_items[QUICKSCREEN_BOTTOM], NULL); get_setting(global_settings.qs_items[QUICKSCREEN_BOTTOM], NULL);
qs.callback = NULL; qs.callback = NULL;
if (gui_syncquickscreen_run(&qs, button_enter, &usb)) int ret = gui_syncquickscreen_run(&qs, button_enter, &usb);
if (ret & QUICKSCREEN_CHANGED)
{ {
settings_save(); settings_save();
/* make sure repeat/shuffle/any other nasty ones get updated */ /* make sure repeat/shuffle/any other nasty ones get updated */
@ -465,7 +469,10 @@ int quick_screen_quick(int button_enter)
set_albumart_mode(global_settings.album_art); set_albumart_mode(global_settings.album_art);
#endif #endif
} }
return (usb ? 1:0); if (usb)
return QUICKSCREEN_IN_USB;
return ret & QUICKSCREEN_GOTO_SHORTCUTS_MENU ? QUICKSCREEN_GOTO_SHORTCUTS_MENU :
QUICKSCREEN_OK;
} }
/* stuff to make the quickscreen configurable */ /* stuff to make the quickscreen configurable */

View file

@ -36,6 +36,13 @@ enum quickscreen_item {
QUICKSCREEN_ITEM_COUNT, QUICKSCREEN_ITEM_COUNT,
}; };
enum quickscreen_return {
QUICKSCREEN_OK = 0,
QUICKSCREEN_IN_USB = 0x1,
QUICKSCREEN_GOTO_SHORTCUTS_MENU = 0x2,
QUICKSCREEN_CHANGED = 0x4,
};
struct gui_quickscreen struct gui_quickscreen
{ {
const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; const struct settings_list *items[QUICKSCREEN_ITEM_COUNT];

View file

@ -53,6 +53,7 @@
#include "root_menu.h" #include "root_menu.h"
#include "backdrop.h" #include "backdrop.h"
#include "quickscreen.h" #include "quickscreen.h"
#include "shortcuts.h"
#include "pitchscreen.h" #include "pitchscreen.h"
#include "appevents.h" #include "appevents.h"
#include "viewport.h" #include "viewport.h"
@ -839,15 +840,24 @@ long gui_wps_show(void)
case ACTION_WPS_QUICKSCREEN: case ACTION_WPS_QUICKSCREEN:
{ {
gwps_leave_wps(); gwps_leave_wps();
if (global_settings.shortcuts_replaces_qs) bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs;
if (!enter_shortcuts_menu)
{
int ret = quick_screen_quick(button);
if (ret == QUICKSCREEN_IN_USB)
return GO_TO_ROOT;
else if (ret == QUICKSCREEN_GOTO_SHORTCUTS_MENU)
enter_shortcuts_menu = true;
else
restore = true;
}
if (enter_shortcuts_menu)
{ {
global_status.last_screen = GO_TO_SHORTCUTMENU; global_status.last_screen = GO_TO_SHORTCUTMENU;
int ret = quick_screen_quick(button); int ret = do_shortcut_menu(NULL);
return (ret == GO_TO_PREVIOUS ? GO_TO_WPS : ret); return (ret == GO_TO_PREVIOUS ? GO_TO_WPS : ret);
} }
else if (quick_screen_quick(button) > 0)
return GO_TO_ROOT;
restore = true;
} }
break; break;
#endif /* HAVE_QUICKSCREEN */ #endif /* HAVE_QUICKSCREEN */

View file

@ -147,7 +147,8 @@ static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
{ ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE }, { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
LAST_ITEM_IN_LIST LAST_ITEM_IN_LIST
}; /* button_context_quickscreen */ }; /* button_context_quickscreen */

View file

@ -179,7 +179,7 @@ static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_HOME, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_HOME, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },

View file

@ -130,6 +130,7 @@ static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_DOWN, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE }, { ACTION_QS_DOWN, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE },
{ ACTION_QS_DOWN, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_DOWN, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
{ ACTION_STD_CONTEXT,BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
LAST_ITEM_IN_LIST LAST_ITEM_IN_LIST
}; /* button_context_quickscreen */ }; /* button_context_quickscreen */

View file

@ -175,7 +175,8 @@ static const struct button_mapping button_context_quickscreen[] = {
{ACTION_QS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE}, {ACTION_QS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{ACTION_QS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE}, {ACTION_QS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE},
{ACTION_QS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE}, {ACTION_QS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE}, {ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
{ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE}, {ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE},
{ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE}, {ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE},
{ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE}, {ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE},

View file

@ -128,7 +128,8 @@ static const struct button_mapping button_context_keyboard[] = {
}; /* button_context_keyboard */ }; /* button_context_keyboard */
static const struct button_mapping button_context_quickscreen[] = { static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE }, { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_BOTTOMRIGHT, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_BOTTOMRIGHT, BUTTON_NONE },

View file

@ -132,7 +132,7 @@ static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_QS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE }, { ACTION_QS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
{ ACTION_QS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE }, { ACTION_QS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },

View file

@ -112,7 +112,8 @@ static const struct button_mapping button_context_keyboard[] = {
}; /* button_context_keyboard */ }; /* button_context_keyboard */
static const struct button_mapping button_context_quickscreen[] = { static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE }, { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
{ ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE }, { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },

View file

@ -74,7 +74,8 @@ static const struct button_mapping button_context_keyboard[] = {
}; /* button_context_keyboard */ }; /* button_context_keyboard */
static const struct button_mapping button_context_quickscreen[] = { static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE }, { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
LAST_ITEM_IN_LIST LAST_ITEM_IN_LIST

View file

@ -145,7 +145,8 @@ static const struct button_mapping button_context_keyboard[] = {
}; /* button_context_keyboard */ }; /* button_context_keyboard */
static const struct button_mapping button_context_quickscreen[] = { static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE }, { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE },
{ ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE }, { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },

View file

@ -455,14 +455,13 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
#ifdef HAVE_QUICKSCREEN #ifdef HAVE_QUICKSCREEN
else if (action == ACTION_STD_QUICKSCREEN) else if (action == ACTION_STD_QUICKSCREEN)
{ {
if (global_settings.shortcuts_replaces_qs) if (global_settings.shortcuts_replaces_qs ||
quick_screen_quick(action) == QUICKSCREEN_GOTO_SHORTCUTS_MENU)
{ {
global_status.last_screen = GO_TO_SHORTCUTMENU; global_status.last_screen = GO_TO_SHORTCUTMENU;
ret = quick_screen_quick(action); ret = do_shortcut_menu(NULL);
done = true; done = true;
} }
else
quick_screen_quick(action);
redraw_lists = true; redraw_lists = true;
} }
#endif #endif

View file

@ -72,6 +72,7 @@
#include "list.h" #include "list.h"
#include "splash.h" #include "splash.h"
#include "quickscreen.h" #include "quickscreen.h"
#include "shortcuts.h"
#include "appevents.h" #include "appevents.h"
#include "root_menu.h" #include "root_menu.h"
@ -751,19 +752,28 @@ static int dirbrowse(void)
break; break;
#ifdef HAVE_QUICKSCREEN #ifdef HAVE_QUICKSCREEN
case ACTION_STD_QUICKSCREEN: case ACTION_STD_QUICKSCREEN:
if (global_settings.shortcuts_replaces_qs)
{ {
if (*tc.dirfilter < NUM_FILTER_MODES) bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs;
if (enter_shortcuts_menu && *tc.dirfilter >= NUM_FILTER_MODES)
break;
else if (!enter_shortcuts_menu)
{
int ret = quick_screen_quick(button);
if (ret == QUICKSCREEN_IN_USB)
reload_dir = true;
else if (ret == QUICKSCREEN_GOTO_SHORTCUTS_MENU)
enter_shortcuts_menu = true;
}
if (enter_shortcuts_menu && *tc.dirfilter < NUM_FILTER_MODES)
{ {
global_status.last_screen = GO_TO_SHORTCUTMENU; global_status.last_screen = GO_TO_SHORTCUTMENU;
return quick_screen_quick(button); return do_shortcut_menu(NULL);
} }
break;
}
else if (quick_screen_quick(button))
reload_dir = true;
restore = true; restore = true;
break; break;
}
#endif #endif
#ifdef HAVE_HOTKEY #ifdef HAVE_HOTKEY

View file

@ -270,6 +270,9 @@ utilities. A detailed description of the different plugins is to be found in
To do so, slide your finger around the click wheel as you would on the To do so, slide your finger around the click wheel as you would on the
While Playing Screen.} While Playing Screen.}
} }
Press \ActionStdContext{} to access the \setting{Shortcuts Menu} directly from the
\setting{Quick Screen}.
} }
\section{\label{ref:MainMenuShortcuts}Shortcuts} \section{\label{ref:MainMenuShortcuts}Shortcuts}