diff options
Diffstat (limited to 'apps/gui')
| -rw-r--r-- | apps/gui/option_select.c | 14 | ||||
| -rw-r--r-- | apps/gui/option_select.h | 7 | ||||
| -rw-r--r-- | apps/gui/quickscreen.c | 17 |
3 files changed, 20 insertions, 18 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 023f9b4..0e4ed8d 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -44,7 +44,16 @@ #endif static int selection_to_val(const struct settings_list *setting, int selection); - +int option_value_as_int(const struct settings_list *setting) +{ + int type = (setting->flags & F_T_MASK); + int temp = 0; + if (type == F_T_BOOL) + temp = *(bool*)setting->setting?1:0; + else if (type == F_T_UINT || type == F_T_INT) + temp = *(int*)setting->setting; + return temp; +} static const char *unit_strings[] = { [UNIT_INT] = "", [UNIT_MS] = "ms", @@ -214,7 +223,8 @@ static int option_talk(int selected_item, void * data) return 0; } -#ifdef HAVE_QUICKSCREEN /* only the quickscreen uses this so far */ +#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) + /* only the quickscreen and recording trigger needs this */ void option_select_next_val(const struct settings_list *setting, bool previous, bool apply) { diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index 16465cf..ed7b6ae 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h @@ -27,11 +27,16 @@ bool option_screen(const struct settings_list *setting, struct viewport parent[NB_SCREENS], bool use_temp_var, unsigned char* option_title); - +#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) void option_select_next_val(const struct settings_list *setting, bool previous, bool apply); +#endif char *option_get_valuestring(const struct settings_list *setting, char *buffer, int buf_len, intptr_t temp_var); void option_talk_value(const struct settings_list *setting, int value, bool enqueue); + +/* only use this for int and bool settings */ +int option_value_as_int(const struct settings_list *setting); + #endif /* _GUI_OPTION_SELECT_H_ */ diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 261b1ca..ddc02c1 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -200,10 +200,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen *qs, title = P2STR(ID2P(qs->items[i]->lang_id)); setting = qs->items[i]->setting; - if ((qs->items[i]->flags & F_BOOL_SETTING) == F_BOOL_SETTING) - temp = *(bool*)setting?1:0; - else - temp = *(int*)setting; + temp = option_value_as_int(qs->items[i]); value = option_get_valuestring((struct settings_list*)qs->items[i], buf, MAX_PATH, temp); @@ -235,23 +232,13 @@ static void gui_quickscreen_draw(struct gui_quickscreen *qs, display->set_viewport(NULL); } -static int option_value(const struct settings_list *setting) -{ - if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) - { - return *(bool*)setting->setting==true?1:0; - } - else - return *(int*)setting->setting; -} - static void talk_qs_option(struct settings_list *opt, bool enqueue) { if (global_settings.talk_menu) { if(!enqueue) talk_shutup(); talk_id(opt->lang_id, true); - option_talk_value(opt, option_value(opt), true); + option_talk_value(opt, option_value_as_int(opt), true); } } |