forked from len0rd/rockbox
Minor code policing and cleanup
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12334 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
12a1e108a8
commit
750fa4a1a0
1 changed files with 46 additions and 47 deletions
|
@ -409,36 +409,36 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
|
||||||
}
|
}
|
||||||
static bool is_changed(int setting_id)
|
static bool is_changed(int setting_id)
|
||||||
{
|
{
|
||||||
const struct settings_list *setting = &settings[setting_id];
|
const struct settings_list *setting = &settings[setting_id];
|
||||||
switch (setting->flags&F_T_MASK)
|
switch (setting->flags&F_T_MASK)
|
||||||
{
|
{
|
||||||
case F_T_INT:
|
case F_T_INT:
|
||||||
case F_T_UINT:
|
case F_T_UINT:
|
||||||
if (setting->flags&F_DEF_ISFUNC)
|
if (setting->flags&F_DEF_ISFUNC)
|
||||||
{
|
{
|
||||||
if (*(int*)setting->setting == setting->default_val.func())
|
if (*(int*)setting->setting == setting->default_val.func())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (setting->flags&F_T_SOUND)
|
else if (setting->flags&F_T_SOUND)
|
||||||
{
|
{
|
||||||
if (*(int*)setting->setting ==
|
if (*(int*)setting->setting ==
|
||||||
sound_default(setting->sound_setting->setting))
|
sound_default(setting->sound_setting->setting))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (*(int*)setting->setting == setting->default_val.int_)
|
else if (*(int*)setting->setting == setting->default_val.int_)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case F_T_BOOL:
|
case F_T_BOOL:
|
||||||
if (*(bool*)setting->setting == setting->default_val.bool_)
|
if (*(bool*)setting->setting == setting->default_val.bool_)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case F_T_CHARPTR:
|
case F_T_CHARPTR:
|
||||||
case F_T_UCHARPTR:
|
case F_T_UCHARPTR:
|
||||||
if (!strcmp((char*)setting->setting, setting->default_val.charptr))
|
if (!strcmp((char*)setting->setting, setting->default_val.charptr))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool settings_write_config(char* filename, int options)
|
static bool settings_write_config(char* filename, int options)
|
||||||
|
@ -456,14 +456,14 @@ static bool settings_write_config(char* filename, int options)
|
||||||
if (settings[i].cfg_name == NULL)
|
if (settings[i].cfg_name == NULL)
|
||||||
continue;
|
continue;
|
||||||
value[0] = '\0';
|
value[0] = '\0';
|
||||||
|
|
||||||
if ((options == SETTINGS_SAVE_CHANGED) &&
|
if ((options == SETTINGS_SAVE_CHANGED) &&
|
||||||
!is_changed(i))
|
!is_changed(i))
|
||||||
continue;
|
continue;
|
||||||
else if ((options == SETTINGS_SAVE_THEME) &&
|
else if ((options == SETTINGS_SAVE_THEME) &&
|
||||||
((settings[i].flags&F_THEMESETTING) == 0))
|
((settings[i].flags&F_THEMESETTING) == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (settings[i].flags&F_T_MASK)
|
switch (settings[i].flags&F_T_MASK)
|
||||||
{
|
{
|
||||||
case F_T_INT:
|
case F_T_INT:
|
||||||
|
@ -603,7 +603,8 @@ bool settings_save_config(int options)
|
||||||
|
|
||||||
if (settings_write_config(filename, options))
|
if (settings_write_config(filename, options))
|
||||||
gui_syncsplash(HZ, true, str(LANG_SETTINGS_SAVED));
|
gui_syncsplash(HZ, true, str(LANG_SETTINGS_SAVED));
|
||||||
else gui_syncsplash(HZ, true, str(LANG_FAILED));
|
else
|
||||||
|
gui_syncsplash(HZ, true, str(LANG_FAILED));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,8 +775,7 @@ void settings_apply(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
||||||
if ( global_settings.rwps_file[0] &&
|
if ( global_settings.rwps_file[0]) {
|
||||||
global_settings.rwps_file[0] != 0xff ) {
|
|
||||||
snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
|
snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
|
||||||
global_settings.rwps_file);
|
global_settings.rwps_file);
|
||||||
wps_data_load(gui_wps[1].data, buf, true);
|
wps_data_load(gui_wps[1].data, buf, true);
|
||||||
|
@ -785,8 +785,7 @@ void settings_apply(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if ( global_settings.font_file[0] &&
|
if ( global_settings.font_file[0]) {
|
||||||
global_settings.font_file[0] != 0xff ) {
|
|
||||||
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
|
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
|
||||||
global_settings.font_file);
|
global_settings.font_file);
|
||||||
font_load(buf);
|
font_load(buf);
|
||||||
|
@ -794,8 +793,7 @@ void settings_apply(void)
|
||||||
else
|
else
|
||||||
font_reset();
|
font_reset();
|
||||||
|
|
||||||
if ( global_settings.kbd_file[0] &&
|
if ( global_settings.kbd_file[0]) {
|
||||||
global_settings.kbd_file[0] != 0xff ) {
|
|
||||||
snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
|
snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
|
||||||
global_settings.kbd_file);
|
global_settings.kbd_file);
|
||||||
load_kbd(buf);
|
load_kbd(buf);
|
||||||
|
@ -813,8 +811,7 @@ void settings_apply(void)
|
||||||
lcd_bidir_scroll(global_settings.bidir_limit);
|
lcd_bidir_scroll(global_settings.bidir_limit);
|
||||||
lcd_scroll_delay(global_settings.scroll_delay * (HZ/10));
|
lcd_scroll_delay(global_settings.scroll_delay * (HZ/10));
|
||||||
|
|
||||||
if ( global_settings.lang_file[0] &&
|
if ( global_settings.lang_file[0]) {
|
||||||
global_settings.lang_file[0] != 0xff ) {
|
|
||||||
snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
|
snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
|
||||||
global_settings.lang_file);
|
global_settings.lang_file);
|
||||||
lang_load(buf);
|
lang_load(buf);
|
||||||
|
@ -936,7 +933,9 @@ void talk_setting(void *global_settings_variable)
|
||||||
if (setting->lang_id)
|
if (setting->lang_id)
|
||||||
talk_id(setting->lang_id,false);
|
talk_id(setting->lang_id,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int selected_setting; /* Used by the callback */
|
static int selected_setting; /* Used by the callback */
|
||||||
|
|
||||||
static void dec_sound_formatter(char *buffer, int buffer_size,
|
static void dec_sound_formatter(char *buffer, int buffer_size,
|
||||||
int val, const char *unit)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue