summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-11-05 09:30:20 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-11-05 09:30:20 +0000
commita22749b5c6dcfa61c589e0735871b5f372fb8c6b (patch)
tree30b294d13242b9deac4217cab8aca44fe2576259 /apps
parent0eb6ae938ea11e3db28b98be0dd524aee31a8dd3 (diff)
downloadrockbox-a22749b5c6dcfa61c589e0735871b5f372fb8c6b.tar.gz
rockbox-a22749b5c6dcfa61c589e0735871b5f372fb8c6b.tar.bz2
rockbox-a22749b5c6dcfa61c589e0735871b5f372fb8c6b.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/option_select.c4
-rw-r--r--apps/gui/quickscreen.c116
-rw-r--r--apps/gui/quickscreen.h4
-rw-r--r--apps/lang/english.lang95
-rw-r--r--apps/menu.c64
-rw-r--r--apps/menus/settings_menu.c22
-rw-r--r--apps/settings_list.c10
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;i<nb_settings;i++)
{
- setting = &settings[i];
- if (is_setting_quickscreenable(setting))
- count++;
- if (count == index)
- return setting;
- }
- return NULL;
-}
-static char* quickscreen_setter_getname(int selected_item, void *data,
- char *buffer, size_t buffer_len)
-{
- (void)data;
- const struct settings_list *setting = find_setting_from_index(selected_item);
- snprintf(buffer, buffer_len, "%s (%s)",
- str(setting->lang_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;i<nb_settings;i++)
- {
- if (is_setting_quickscreenable(&settings[i]))
- count++;
- if (*(int*)temp->setting == 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<nb_settings;i++)
- {
- if (is_setting_quickscreenable(&settings[i]))
- valid_settings_count++;
- if (oldval == i)
- newval = valid_settings_count - 1;
- }
-
- simplelist_info_init(&info, str(LANG_QS_ITEMS),
- valid_settings_count,
- (void*)find_setting(setting, NULL)); /* find the qs item being changed */
- info.get_name = quickscreen_setter_getname;
- if(global_settings.talk_menu)
- info.get_talk = quickscreen_setter_speak_item;
- info.action_callback = quickscreen_setter_action_callback;
- info.selection = newval;
- simplelist_show_list(&info);
- if (info.selection != oldval)
- {
- if (info.selection != -1)
- {
- const struct settings_list *temp = find_setting_from_index(info.selection);
- int i = 0;
- for(i=0;i<nb_settings;i++)
- {
- if (&settings[i] == temp)
- break;
- }
- *setting = i;
- settings_save();
- }
- /* probably should splash LANG_CANCEL here but right now
- we cant find out the selection when the cancel button was
- pressed, (without hacks)so we cant know if the
- selection was changed, or just viewed */
- }
- return 0;
}
-
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h
index f084d83b61..cf7f577429 100644
--- a/apps/gui/quickscreen.h
+++ b/apps/gui/quickscreen.h
@@ -51,6 +51,8 @@ extern bool quick_screen_f3(int button_enter);
#endif
extern bool quick_screen_quick(int button_enter);
int quickscreen_set_option(void *data);
-
+bool is_setting_quickscreenable(const struct settings_list *setting);
+void set_as_qs_item(const struct settings_list *setting,
+ enum QUICKSCREEN_ITEM item);
#endif /*_GUI_QUICK_SCREEN_H_*/
#endif /* HAVE_QUICKSCREEN */
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 7e638f3a5c..66e15cc784 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12111,69 +12111,134 @@
</phrase>
<phrase>
id: LANG_QS_ITEMS
- desc: used for the submenu name for the quickscreen items
+ desc: DEPRECATED
user:
<source>
*: none
- quickscreen: "Quickscreen Items"
+ quickscreen: ""
</source>
<dest>
*: none
- quickscreen: "Quickscreen Items"
+ quickscreen: ""
</dest>
<voice>
*: none
- quickscreen: "Quickscreen Items"
+ quickscreen: ""
</voice>
</phrase>
<phrase>
id: LANG_LEFT
- desc: used for the submenu name for the quickscreen items
+ desc: DEPRECATED
user:
<source>
*: none
- quickscreen: "Left"
+ quickscreen: ""
</source>
<dest>
*: none
- quickscreen: "Left"
+ quickscreen: ""
</dest>
<voice>
*: none
- quickscreen: "Left"
+ quickscreen: ""
</voice>
</phrase>
<phrase>
id: LANG_RIGHT
- desc: used for the submenu name for the quickscreen items
+ desc: DEPRECATED
user:
<source>
*: none
- quickscreen: "Right"
+ quickscreen: ""
</source>
<dest>
*: none
- quickscreen: "Right"
+ quickscreen: ""
</dest>
<voice>
*: none
- quickscreen: "Right"
+ quickscreen: ""
</voice>
</phrase>
<phrase>
id: LANG_BOTTOM
+ desc: DEPRECATED
+ user:
+ <source>
+ *: none
+ quickscreen: ""
+ </source>
+ <dest>
+ *: none
+ quickscreen: ""
+ </dest>
+ <voice>
+ *: none
+ quickscreen: ""
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_RESET_SETTING
+ desc: used in the settings context menu
+ user:
+ <source>
+ *: "Reset Setting"
+ </source>
+ <dest>
+ *: "Reset Setting"
+ </dest>
+ <voice>
+ *: "Reset Setting"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_LEFT_QS_ITEM
+ desc: used for the submenu name for the quickscreen items
+ user:
+ <source>
+ *: none
+ quickscreen: "Set as Left Quickscreen Item"
+ </source>
+ <dest>
+ *: none
+ quickscreen: "Set as Left Quickscreen Item"
+ </dest>
+ <voice>
+ *: none
+ quickscreen: "Set as Left Quickscreen Item"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_RIGHT_QS_ITEM
+ desc: used for the submenu name for the quickscreen items
+ user:
+ <source>
+ *: none
+ quickscreen: "Set as Right Quickscreen Item"
+ </source>
+ <dest>
+ *: none
+ quickscreen: "Set as Right Quickscreen Item"
+ </dest>
+ <voice>
+ *: none
+ quickscreen: "Set as Right Quickscreen Item"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_BOTTOM_QS_ITEM
desc: used for the submenu name for the quickscreen items
user:
<source>
*: none
- quickscreen: "Bottom"
+ quickscreen: "Set as Bottom Quickscreen Item"
</source>
<dest>
*: none
- quickscreen: "Bottom"
+ quickscreen: "Set as Bottom Quickscreen Item"
</dest>
<voice>
*: none
- quickscreen: "Bottom"
+ quickscreen: "Set as Bottom Quickscreen Item"
</voice>
</phrase>
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 = &notquickscreen_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),