From a22749b5c6dcfa61c589e0735871b5f372fb8c6b Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 5 Nov 2008 09:30:20 +0000 Subject: FS#9525 - The list for the quickscreen items chooser turned out to not really be usable so try this instead. Settings in the menus will now have a context menu where you can reset the setting and if its OK to put it on the quickscreen there will be options there to put it on it. Also, ban last.fm and cuesheet support settings from the QS git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19013 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/option_select.c | 4 +- apps/gui/quickscreen.c | 116 +++++---------------------------------------- apps/gui/quickscreen.h | 4 +- apps/lang/english.lang | 95 +++++++++++++++++++++++++++++++------ apps/menu.c | 64 +++++++++++++++++++++++-- apps/menus/settings_menu.c | 22 --------- apps/settings_list.c | 10 ++-- 7 files changed, 163 insertions(+), 152 deletions(-) diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index be29a9ad5e..570a41a78d 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -34,6 +34,8 @@ #include "statusbar.h" #include "misc.h" #include "splash.h" +#include "menu.h" +#include "quickscreen.h" #if defined (HAVE_SCROLLWHEEL) || \ (CONFIG_KEYPAD == IPOD_3G_PAD) || \ @@ -540,7 +542,7 @@ bool option_screen(const struct settings_list *setting, if (var_type == F_T_BOOL && !use_temp_var) *(bool*)setting->setting = (*variable==1); val_to_selection(setting, *variable, &nb_items, - &selected, &function); + &selected, &function); gui_synclist_select_item(&lists, selected); gui_synclist_draw(&lists); gui_synclist_speak_item(&lists); diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 4c0cddf7ac..3880940ae3 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -322,7 +322,7 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) cond_talk_ids_fq(VOICE_OK); return changed; } -static bool is_setting_quickscreenable(const struct settings_list *setting); + static inline const struct settings_list *get_setting(int gs_value, const struct settings_list *defaultval) { @@ -394,7 +394,7 @@ bool quick_screen_f3(int button_enter) #endif /* BUTTON_F3 */ /* stuff to make the quickscreen configurable */ -static bool is_setting_quickscreenable(const struct settings_list *setting) +bool is_setting_quickscreenable(const struct settings_list *setting) { /* to keep things simple, only settings which have a lang_id set are ok */ if (setting->lang_id < 0 || (setting->flags&F_BANFROMQS)) @@ -411,118 +411,28 @@ static bool is_setting_quickscreenable(const struct settings_list *setting) } } -static const struct settings_list *find_setting_from_index(int index) +void set_as_qs_item(const struct settings_list *setting, + enum QUICKSCREEN_ITEM item) { - int count = -1, i; - const struct settings_list *setting = &settings[0]; + int i; for(i=0;ilang_id), setting->cfg_name); - return buffer; -} -static int quickscreen_setter_speak_item(int selected_item, void * data) -{ - (void)data; - talk_id(find_setting_from_index(selected_item)->lang_id, true); - return 0; -} -static int quickscreen_setter_action_callback(int action, - struct gui_synclist *lists) -{ - const struct settings_list *temp = lists->data; - switch (action) - { - case ACTION_STD_OK: - /* ok, quit */ - return ACTION_STD_CANCEL; - case ACTION_STD_CONTEXT: /* real settings use this to reset to default */ - { - int i=0, count=0; - reset_setting(temp, temp->setting); - for(i=0;isetting == i) - { - gui_synclist_select_item(lists, count-1); - break; - } - } - return ACTION_REDRAW; - } + if (&settings[i] == setting) + break; } - return action; -} -int quickscreen_set_option(void *data) -{ - int valid_settings_count = 0; - int i, newval = 0, oldval, *setting = NULL; - struct simplelist_info info; - switch ((intptr_t)data) + switch (item) { case QUICKSCREEN_LEFT: - setting = &global_settings.qs_item_left; + global_settings.qs_item_left = i; break; case QUICKSCREEN_RIGHT: - setting = &global_settings.qs_item_right; + global_settings.qs_item_right = i; break; case QUICKSCREEN_BOTTOM: - setting = &global_settings.qs_item_bottom; + global_settings.qs_item_bottom = i; + break; + default: /* shut the copiler up */ break; } - oldval = *setting; - for(i=0;i id: LANG_QS_ITEMS - desc: used for the submenu name for the quickscreen items + desc: DEPRECATED user: *: none - quickscreen: "Quickscreen Items" + quickscreen: "" *: none - quickscreen: "Quickscreen Items" + quickscreen: "" *: none - quickscreen: "Quickscreen Items" + quickscreen: "" id: LANG_LEFT - desc: used for the submenu name for the quickscreen items + desc: DEPRECATED user: *: none - quickscreen: "Left" + quickscreen: "" *: none - quickscreen: "Left" + quickscreen: "" *: none - quickscreen: "Left" + quickscreen: "" id: LANG_RIGHT - desc: used for the submenu name for the quickscreen items + desc: DEPRECATED user: *: none - quickscreen: "Right" + quickscreen: "" *: none - quickscreen: "Right" + quickscreen: "" *: none - quickscreen: "Right" + quickscreen: "" id: LANG_BOTTOM + desc: DEPRECATED + user: + + *: none + quickscreen: "" + + + *: none + quickscreen: "" + + + *: none + quickscreen: "" + + + + id: LANG_RESET_SETTING + desc: used in the settings context menu + user: + + *: "Reset Setting" + + + *: "Reset Setting" + + + *: "Reset Setting" + + + + id: LANG_LEFT_QS_ITEM + desc: used for the submenu name for the quickscreen items + user: + + *: none + quickscreen: "Set as Left Quickscreen Item" + + + *: none + quickscreen: "Set as Left Quickscreen Item" + + + *: none + quickscreen: "Set as Left Quickscreen Item" + + + + id: LANG_RIGHT_QS_ITEM + desc: used for the submenu name for the quickscreen items + user: + + *: none + quickscreen: "Set as Right Quickscreen Item" + + + *: none + quickscreen: "Set as Right Quickscreen Item" + + + *: none + quickscreen: "Set as Right Quickscreen Item" + + + + id: LANG_BOTTOM_QS_ITEM desc: used for the submenu name for the quickscreen items user: *: none - quickscreen: "Bottom" + quickscreen: "Set as Bottom Quickscreen Item" *: none - quickscreen: "Bottom" + quickscreen: "Set as Bottom Quickscreen Item" *: none - quickscreen: "Bottom" + quickscreen: "Set as Bottom Quickscreen Item" diff --git a/apps/menu.c b/apps/menu.c index d01cbc64be..8edec58587 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -483,12 +483,66 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, { redraw_lists = list_stop_handler(); } - else if (action == ACTION_STD_CONTEXT && - menu == &root_menu_) + else if (action == ACTION_STD_CONTEXT) { - ret = GO_TO_ROOTITEM_CONTEXT; - done = true; - } + if (menu == &root_menu_) + { + ret = GO_TO_ROOTITEM_CONTEXT; + done = true; + } + else if (!in_stringlist) + { + int type; + selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu); + temp = menu->submenus[selected]; + type = (temp->flags&MENU_TYPE_MASK); + if ((type == MT_SETTING_W_TEXT || type == MT_SETTING)) + { +#ifdef HAVE_QUICKSCREEN + MENUITEM_STRINGLIST(quickscreen_able_option, + ID2P(LANG_ONPLAY_MENU_TITLE), NULL, + ID2P(LANG_RESET_SETTING), + ID2P(LANG_LEFT_QS_ITEM), + ID2P(LANG_BOTTOM_QS_ITEM), + ID2P(LANG_RIGHT_QS_ITEM)); +#endif + MENUITEM_STRINGLIST(notquickscreen_able_option, + ID2P(LANG_ONPLAY_MENU_TITLE), NULL, + ID2P(LANG_RESET_SETTING)); + const struct menu_item_ex *menu; + int menu_selection = 0; + const struct settings_list *setting = + find_setting(temp->variable, NULL); +#ifdef HAVE_QUICKSCREEN + if (is_setting_quickscreenable(setting)) + menu = &quickscreen_able_option; + else +#endif + menu = ¬quickscreen_able_option; + switch (do_menu(menu, &menu_selection, NULL, false)) + { + case GO_TO_PREVIOUS: + break; + case 0: /* reset setting */ + reset_setting(setting, setting->setting); + break; +#ifdef HAVE_QUICKSCREEN + break; + case 1: /* set as left QS item */ + set_as_qs_item(setting, QUICKSCREEN_LEFT); + break; + case 2: /* set as bottom QS item */ + set_as_qs_item(setting, QUICKSCREEN_BOTTOM); + break; + case 3: /* set as right QS item */ + set_as_qs_item(setting, QUICKSCREEN_RIGHT); + break; +#endif + } /* swicth(do_menu()) */ + redraw_lists = true; + } + } /* else if (!in_stringlist) */ + } else if (action == ACTION_STD_MENU) { if (menu != &root_menu_) diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 1610cfbef1..ebba295570 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -487,25 +487,6 @@ MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice, /* VOICE MENU */ /***********************************/ -#ifdef HAVE_QUICKSCREEN -/***********************************/ -/* CUSTOMISABLE QUICKSCREEN CODE */ - -MENUITEM_FUNCTION(qs_left_item, MENU_FUNC_USEPARAM, ID2P(LANG_LEFT), - (menu_function)quickscreen_set_option, (intptr_t*)QUICKSCREEN_LEFT, NULL, - Icon_Menu_setting); -MENUITEM_FUNCTION(qs_right_item, MENU_FUNC_USEPARAM, ID2P(LANG_RIGHT), - (menu_function)quickscreen_set_option, (intptr_t*)QUICKSCREEN_RIGHT, NULL, - Icon_Menu_setting); -MENUITEM_FUNCTION(qs_bottom_item, MENU_FUNC_USEPARAM, ID2P(LANG_BOTTOM), - (menu_function)quickscreen_set_option, (intptr_t*)QUICKSCREEN_BOTTOM, NULL, - Icon_Menu_setting); - -MAKE_MENU(quickscreen_settings, ID2P(LANG_QS_ITEMS), NULL, Icon_Config, - &qs_left_item, &qs_right_item, &qs_bottom_item); -/* CUSTOMISABLE QUICKSCREEN CODE */ -/***********************************/ -#endif /***********************************/ /* SETTINGS MENU */ @@ -519,9 +500,6 @@ MENUITEM_FUNCTION(browse_langs, 0, ID2P(LANG_LANGUAGE), language_browse, MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0, Icon_General_settings_menu, &playlist_settings, &file_menu, -#ifdef HAVE_QUICKSCREEN - &quickscreen_settings, -#endif #ifdef HAVE_TAGCACHE &tagcache_menu, #endif diff --git a/apps/settings_list.c b/apps/settings_list.c index eafad01096..6a7fcc3aec 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1280,7 +1280,7 @@ const struct settings_list settings[] = { ID2P(LANG_FM_JAPAN), ID2P(LANG_FM_KOREA)), #endif - OFFON_SETTING(0, audioscrobbler, LANG_AUDIOSCROBBLER, false, + OFFON_SETTING(F_BANFROMQS, audioscrobbler, LANG_AUDIOSCROBBLER, false, "Last.fm Logging", NULL), #if CONFIG_TUNER TEXT_SETTING(0, fmr_file, "fmr", "", @@ -1309,7 +1309,7 @@ const struct settings_list settings[] = { OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL), #endif #endif - OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", + OFFON_SETTING(F_BANFROMQS,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", NULL), TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, skip_length, LANG_SKIP_LENGTH, 0, "skip length", @@ -1412,15 +1412,15 @@ const struct settings_list settings[] = { ID2P(LANG_NORMAL), ID2P(LANG_HIGH)), #endif #ifdef HAVE_QUICKSCREEN - CUSTOM_SETTING(0, qs_item_left, LANG_LEFT, + CUSTOM_SETTING(0, qs_item_left, LANG_LEFT_QS_ITEM, &global_settings.playlist_shuffle, "qs left", qs_load_from_cfg, qs_write_to_cfg, qs_is_changed, qs_set_default), - CUSTOM_SETTING(0, qs_item_right, LANG_RIGHT, + CUSTOM_SETTING(0, qs_item_right, LANG_RIGHT_QS_ITEM, &global_settings.repeat_mode, "qs right", qs_load_from_cfg, qs_write_to_cfg, qs_is_changed, qs_set_default), - CUSTOM_SETTING(0, qs_item_bottom, LANG_BOTTOM, + CUSTOM_SETTING(0, qs_item_bottom, LANG_BOTTOM_QS_ITEM, &global_settings.dirfilter, "qs bottom", qs_load_from_cfg, qs_write_to_cfg, qs_is_changed, qs_set_default), -- cgit v1.2.3