diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-11-15 13:22:02 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-11-15 13:22:02 +0000 |
commit | 101693fd3047fb64e766580e80635a424fa25c4d (patch) | |
tree | 80f5664710a6e84b73f33e22c1b8632c13c5a727 /apps/menu.c | |
parent | e7e4b131d06f748400b5299d4d1ebfb38f9f08bf (diff) | |
download | rockbox-101693fd3047fb64e766580e80635a424fa25c4d.tar.gz rockbox-101693fd3047fb64e766580e80635a424fa25c4d.zip |
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
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 38 |
1 files changed, 25 insertions, 13 deletions
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 @@ | |||
52 | #include "audio.h" | 52 | #include "audio.h" |
53 | #include "viewport.h" | 53 | #include "viewport.h" |
54 | #include "quickscreen.h" | 54 | #include "quickscreen.h" |
55 | #include "shortcuts.h" | ||
55 | 56 | ||
56 | #ifdef HAVE_LCD_BITMAP | 57 | #ifdef HAVE_LCD_BITMAP |
57 | #include "icons.h" | 58 | #include "icons.h" |
@@ -280,19 +281,10 @@ static int talk_menu_item(int selected_item, void *data) | |||
280 | return 0; | 281 | return 0; |
281 | } | 282 | } |
282 | 283 | ||
283 | void do_setting_from_menu(const struct menu_item_ex *temp, | 284 | void do_setting_screen(const struct settings_list *setting, const char * title, |
284 | struct viewport parent[NB_SCREENS]) | 285 | struct viewport parent[NB_SCREENS]) |
285 | { | 286 | { |
286 | int setting_id; | ||
287 | const struct settings_list *setting = | ||
288 | find_setting(temp->variable, &setting_id); | ||
289 | char *title; | ||
290 | char padded_title[MAX_PATH]; | 287 | char padded_title[MAX_PATH]; |
291 | if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT) | ||
292 | title = temp->callback_and_desc->desc; | ||
293 | else | ||
294 | title = ID2P(setting->lang_id); | ||
295 | |||
296 | /* Pad the title string by repeating it. This is needed | 288 | /* Pad the title string by repeating it. This is needed |
297 | so the scroll settings title can actually be used to | 289 | so the scroll settings title can actually be used to |
298 | test the setting */ | 290 | test the setting */ |
@@ -317,7 +309,22 @@ void do_setting_from_menu(const struct menu_item_ex *temp, | |||
317 | } | 309 | } |
318 | 310 | ||
319 | option_screen((struct settings_list *)setting, parent, | 311 | option_screen((struct settings_list *)setting, parent, |
320 | setting->flags&F_TEMPVAR, title); | 312 | setting->flags&F_TEMPVAR, (char*)title); |
313 | } | ||
314 | |||
315 | |||
316 | void do_setting_from_menu(const struct menu_item_ex *temp, | ||
317 | struct viewport parent[NB_SCREENS]) | ||
318 | { | ||
319 | char *title; | ||
320 | int setting_id; | ||
321 | const struct settings_list *setting = | ||
322 | find_setting(temp->variable, &setting_id); | ||
323 | if (temp && ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)) | ||
324 | title = temp->callback_and_desc->desc; | ||
325 | else | ||
326 | title = ID2P(setting->lang_id); | ||
327 | do_setting_screen(setting, title, parent); | ||
321 | } | 328 | } |
322 | 329 | ||
323 | /* display a menu */ | 330 | /* display a menu */ |
@@ -451,7 +458,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
451 | ID2P(LANG_TOP_QS_ITEM), | 458 | ID2P(LANG_TOP_QS_ITEM), |
452 | ID2P(LANG_LEFT_QS_ITEM), | 459 | ID2P(LANG_LEFT_QS_ITEM), |
453 | ID2P(LANG_BOTTOM_QS_ITEM), | 460 | ID2P(LANG_BOTTOM_QS_ITEM), |
454 | ID2P(LANG_RIGHT_QS_ITEM)); | 461 | ID2P(LANG_RIGHT_QS_ITEM), |
462 | ID2P(LANG_ADD_TO_FAVES)); | ||
455 | #endif | 463 | #endif |
456 | MENUITEM_STRINGLIST(notquickscreen_able_option, | 464 | MENUITEM_STRINGLIST(notquickscreen_able_option, |
457 | ID2P(LANG_ONPLAY_MENU_TITLE), NULL, | 465 | ID2P(LANG_ONPLAY_MENU_TITLE), NULL, |
@@ -486,6 +494,10 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
486 | case 4: /* set as right QS item */ | 494 | case 4: /* set as right QS item */ |
487 | set_as_qs_item(setting, QUICKSCREEN_RIGHT); | 495 | set_as_qs_item(setting, QUICKSCREEN_RIGHT); |
488 | break; | 496 | break; |
497 | case 5: /* Add to faves. Same limitation on which can be | ||
498 | added to the shortcuts menu as the quickscreen */ | ||
499 | shortcuts_add(SHORTCUT_SETTING, (void*)setting); | ||
500 | break; | ||
489 | #endif | 501 | #endif |
490 | } /* swicth(do_menu()) */ | 502 | } /* swicth(do_menu()) */ |
491 | redraw_lists = true; | 503 | redraw_lists = true; |