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
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;
struct viewport parent[NB_SCREENS];
struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT];
struct viewport vp_icons[NB_SCREENS];
bool changed = false;
int ret = QUICKSCREEN_OK;
/* To quit we need either :
* - a second press on the button that made us enter
* - 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))
{
changed = true;
ret |= QUICKSCREEN_CHANGED;
can_quit = true;
FOR_NB_SCREENS(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)
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)
break;
@ -405,7 +410,8 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
}
pop_current_activity();
return changed;
return ret;
}
static const struct settings_list *get_setting(int gs_value,
@ -427,9 +433,6 @@ int quick_screen_quick(int button_enter)
#endif
bool usb = false;
if (global_settings.shortcuts_replaces_qs)
return do_shortcut_menu(NULL);
qs.items[QUICKSCREEN_TOP] =
get_setting(global_settings.qs_items[QUICKSCREEN_TOP], NULL);
qs.items[QUICKSCREEN_LEFT] =
@ -442,7 +445,8 @@ int quick_screen_quick(int button_enter)
get_setting(global_settings.qs_items[QUICKSCREEN_BOTTOM], 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();
/* 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);
#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 */

View file

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

View file

@ -53,6 +53,7 @@
#include "root_menu.h"
#include "backdrop.h"
#include "quickscreen.h"
#include "shortcuts.h"
#include "pitchscreen.h"
#include "appevents.h"
#include "viewport.h"
@ -839,15 +840,24 @@ long gui_wps_show(void)
case ACTION_WPS_QUICKSCREEN:
{
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;
int ret = quick_screen_quick(button);
int ret = do_shortcut_menu(NULL);
return (ret == GO_TO_PREVIOUS ? GO_TO_WPS : ret);
}
else if (quick_screen_quick(button) > 0)
return GO_TO_ROOT;
restore = true;
}
break;
#endif /* HAVE_QUICKSCREEN */

View file

@ -139,15 +139,16 @@ static const struct button_mapping button_context_yesno[] = {
}; /* button_context_settings_yesno */
static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, 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_REPEAT, BUTTON_NONE },
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, 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_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, 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_REPEAT, BUTTON_NONE },
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, 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_REPEAT, BUTTON_NONE },
{ ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
LAST_ITEM_IN_LIST
}; /* button_context_quickscreen */

View file

@ -179,7 +179,7 @@ static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, 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_REPEAT, 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_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
{ ACTION_STD_CONTEXT,BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
LAST_ITEM_IN_LIST
}; /* 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_VOLDOWN, BUTTON_VOL_DOWN, 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_BACK, 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 */
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_PLAYPAUSE, 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_RIGHT, BUTTON_RIGHT, 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_REPEAT, 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 */
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_POWER, 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 */
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 },
LAST_ITEM_IN_LIST

View file

@ -145,7 +145,8 @@ static const struct button_mapping button_context_keyboard[] = {
}; /* button_context_keyboard */
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_PLAYPAUSE, 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
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;
ret = quick_screen_quick(action);
ret = do_shortcut_menu(NULL);
done = true;
}
else
quick_screen_quick(action);
redraw_lists = true;
}
#endif

View file

@ -72,6 +72,7 @@
#include "list.h"
#include "splash.h"
#include "quickscreen.h"
#include "shortcuts.h"
#include "appevents.h"
#include "root_menu.h"
@ -751,19 +752,28 @@ static int dirbrowse(void)
break;
#ifdef HAVE_QUICKSCREEN
case ACTION_STD_QUICKSCREEN:
if (global_settings.shortcuts_replaces_qs)
{
if (*tc.dirfilter < NUM_FILTER_MODES)
{
global_status.last_screen = GO_TO_SHORTCUTMENU;
return quick_screen_quick(button);
}
{
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;
}
else if (quick_screen_quick(button))
reload_dir = true;
if (enter_shortcuts_menu && *tc.dirfilter < NUM_FILTER_MODES)
{
global_status.last_screen = GO_TO_SHORTCUTMENU;
return do_shortcut_menu(NULL);
}
restore = true;
break;
}
#endif
#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
While Playing Screen.}
}
Press \ActionStdContext{} to access the \setting{Shortcuts Menu} directly from the
\setting{Quick Screen}.
}
\section{\label{ref:MainMenuShortcuts}Shortcuts}