Use array for quickscreen item settings to simplify some logic
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23380 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e5086076a0
commit
ff197a4706
3 changed files with 12 additions and 30 deletions
|
@ -367,16 +367,16 @@ bool quick_screen_quick(int button_enter)
|
||||||
int oldrepeat = global_settings.repeat_mode;
|
int oldrepeat = global_settings.repeat_mode;
|
||||||
|
|
||||||
qs.items[QUICKSCREEN_TOP] =
|
qs.items[QUICKSCREEN_TOP] =
|
||||||
get_setting(global_settings.qs_item_top,
|
get_setting(global_settings.qs_items[QUICKSCREEN_TOP],
|
||||||
find_setting(&global_settings.party_mode, NULL));
|
find_setting(&global_settings.party_mode, NULL));
|
||||||
qs.items[QUICKSCREEN_LEFT] =
|
qs.items[QUICKSCREEN_LEFT] =
|
||||||
get_setting(global_settings.qs_item_left,
|
get_setting(global_settings.qs_items[QUICKSCREEN_LEFT],
|
||||||
find_setting(&global_settings.playlist_shuffle, NULL));
|
find_setting(&global_settings.playlist_shuffle, NULL));
|
||||||
qs.items[QUICKSCREEN_RIGHT] =
|
qs.items[QUICKSCREEN_RIGHT] =
|
||||||
get_setting(global_settings.qs_item_right,
|
get_setting(global_settings.qs_items[QUICKSCREEN_RIGHT],
|
||||||
find_setting(&global_settings.repeat_mode, NULL));
|
find_setting(&global_settings.repeat_mode, NULL));
|
||||||
qs.items[QUICKSCREEN_BOTTOM] =
|
qs.items[QUICKSCREEN_BOTTOM] =
|
||||||
get_setting(global_settings.qs_item_bottom,
|
get_setting(global_settings.qs_items[QUICKSCREEN_BOTTOM],
|
||||||
find_setting(&global_settings.dirfilter, NULL));
|
find_setting(&global_settings.dirfilter, NULL));
|
||||||
|
|
||||||
qs.callback = NULL;
|
qs.callback = NULL;
|
||||||
|
@ -452,22 +452,7 @@ void set_as_qs_item(const struct settings_list *setting,
|
||||||
if (&settings[i] == setting)
|
if (&settings[i] == setting)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (item)
|
|
||||||
{
|
global_settings.qs_items[item] = i;
|
||||||
case QUICKSCREEN_TOP:
|
|
||||||
global_settings.qs_item_top = i;
|
|
||||||
break;
|
|
||||||
case QUICKSCREEN_LEFT:
|
|
||||||
global_settings.qs_item_left = i;
|
|
||||||
break;
|
|
||||||
case QUICKSCREEN_RIGHT:
|
|
||||||
global_settings.qs_item_right = i;
|
|
||||||
break;
|
|
||||||
case QUICKSCREEN_BOTTOM:
|
|
||||||
global_settings.qs_item_bottom = i;
|
|
||||||
break;
|
|
||||||
default: /* shut the compiler up */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "inttypes.h"
|
#include "inttypes.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "statusbar.h" /* for the statusbar values */
|
#include "statusbar.h" /* for the statusbar values */
|
||||||
|
#include "quickscreen.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
@ -507,11 +508,7 @@ struct user_settings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_QUICKSCREEN
|
#ifdef HAVE_QUICKSCREEN
|
||||||
/* these are split because settings_list cant handle arrays */
|
int qs_items[QUICKSCREEN_ITEM_COUNT];
|
||||||
int qs_item_top;
|
|
||||||
int qs_item_left;
|
|
||||||
int qs_item_right;
|
|
||||||
int qs_item_bottom;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
|
|
|
@ -1582,19 +1582,19 @@ const struct settings_list settings[] = {
|
||||||
ID2P(LANG_NORMAL), ID2P(LANG_HIGH)),
|
ID2P(LANG_NORMAL), ID2P(LANG_HIGH)),
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_QUICKSCREEN
|
#ifdef HAVE_QUICKSCREEN
|
||||||
CUSTOM_SETTING(0, qs_item_top, LANG_TOP_QS_ITEM,
|
CUSTOM_SETTING(0, qs_items[QUICKSCREEN_TOP], LANG_TOP_QS_ITEM,
|
||||||
&global_settings.dirfilter, "qs top",
|
&global_settings.dirfilter, "qs top",
|
||||||
qs_load_from_cfg, qs_write_to_cfg,
|
qs_load_from_cfg, qs_write_to_cfg,
|
||||||
qs_is_changed, qs_set_default),
|
qs_is_changed, qs_set_default),
|
||||||
CUSTOM_SETTING(0, qs_item_left, LANG_LEFT_QS_ITEM,
|
CUSTOM_SETTING(0, qs_items[QUICKSCREEN_LEFT], LANG_LEFT_QS_ITEM,
|
||||||
&global_settings.playlist_shuffle, "qs left",
|
&global_settings.playlist_shuffle, "qs left",
|
||||||
qs_load_from_cfg, qs_write_to_cfg,
|
qs_load_from_cfg, qs_write_to_cfg,
|
||||||
qs_is_changed, qs_set_default),
|
qs_is_changed, qs_set_default),
|
||||||
CUSTOM_SETTING(0, qs_item_right, LANG_RIGHT_QS_ITEM,
|
CUSTOM_SETTING(0, qs_items[QUICKSCREEN_RIGHT], LANG_RIGHT_QS_ITEM,
|
||||||
&global_settings.repeat_mode, "qs right",
|
&global_settings.repeat_mode, "qs right",
|
||||||
qs_load_from_cfg, qs_write_to_cfg,
|
qs_load_from_cfg, qs_write_to_cfg,
|
||||||
qs_is_changed, qs_set_default),
|
qs_is_changed, qs_set_default),
|
||||||
CUSTOM_SETTING(0, qs_item_bottom, LANG_BOTTOM_QS_ITEM,
|
CUSTOM_SETTING(0, qs_items[QUICKSCREEN_BOTTOM], LANG_BOTTOM_QS_ITEM,
|
||||||
&global_settings.dirfilter, "qs bottom",
|
&global_settings.dirfilter, "qs bottom",
|
||||||
qs_load_from_cfg, qs_write_to_cfg,
|
qs_load_from_cfg, qs_write_to_cfg,
|
||||||
qs_is_changed, qs_set_default),
|
qs_is_changed, qs_set_default),
|
||||||
|
|
Loading…
Reference in a new issue