From 101693fd3047fb64e766580e80635a424fa25c4d Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 15 Nov 2011 13:22:02 +0000 Subject: FS#12251 - User shortcuts in the main menu. Custom shortcuts which give the user fast access to regularly used files/folders/settings/whatever. Thanks to Alexander Levin for the manual part of the patch git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30990 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'apps/menu.c') diff --git a/apps/menu.c b/apps/menu.c index b4be83fc26..a1e32f4625 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -52,6 +52,7 @@ #include "audio.h" #include "viewport.h" #include "quickscreen.h" +#include "shortcuts.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" @@ -280,19 +281,10 @@ static int talk_menu_item(int selected_item, void *data) return 0; } -void do_setting_from_menu(const struct menu_item_ex *temp, - struct viewport parent[NB_SCREENS]) +void do_setting_screen(const struct settings_list *setting, const char * title, + struct viewport parent[NB_SCREENS]) { - int setting_id; - const struct settings_list *setting = - find_setting(temp->variable, &setting_id); - char *title; char padded_title[MAX_PATH]; - if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT) - title = temp->callback_and_desc->desc; - else - title = ID2P(setting->lang_id); - /* Pad the title string by repeating it. This is needed so the scroll settings title can actually be used to test the setting */ @@ -317,7 +309,22 @@ void do_setting_from_menu(const struct menu_item_ex *temp, } option_screen((struct settings_list *)setting, parent, - setting->flags&F_TEMPVAR, title); + setting->flags&F_TEMPVAR, (char*)title); +} + + +void do_setting_from_menu(const struct menu_item_ex *temp, + struct viewport parent[NB_SCREENS]) +{ + char *title; + int setting_id; + const struct settings_list *setting = + find_setting(temp->variable, &setting_id); + if (temp && ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)) + title = temp->callback_and_desc->desc; + else + title = ID2P(setting->lang_id); + do_setting_screen(setting, title, parent); } /* display a menu */ @@ -451,7 +458,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, ID2P(LANG_TOP_QS_ITEM), ID2P(LANG_LEFT_QS_ITEM), ID2P(LANG_BOTTOM_QS_ITEM), - ID2P(LANG_RIGHT_QS_ITEM)); + ID2P(LANG_RIGHT_QS_ITEM), + ID2P(LANG_ADD_TO_FAVES)); #endif MENUITEM_STRINGLIST(notquickscreen_able_option, ID2P(LANG_ONPLAY_MENU_TITLE), NULL, @@ -486,6 +494,10 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, case 4: /* set as right QS item */ set_as_qs_item(setting, QUICKSCREEN_RIGHT); break; + case 5: /* Add to faves. Same limitation on which can be + added to the shortcuts menu as the quickscreen */ + shortcuts_add(SHORTCUT_SETTING, (void*)setting); + break; #endif } /* swicth(do_menu()) */ redraw_lists = true; -- cgit v1.2.3