diff --git a/apps/main.c b/apps/main.c index bb29eb73dc..15dd1bcef9 100644 --- a/apps/main.c +++ b/apps/main.c @@ -293,7 +293,7 @@ static void init(void) settings_reset(); settings_load(SETTINGS_ALL); gui_sync_wps_init(); - settings_apply(); + settings_apply(true); init_dircache(true); init_dircache(false); #ifdef HAVE_TAGCACHE @@ -519,7 +519,7 @@ static void init(void) } gui_sync_wps_init(); - settings_apply(); + settings_apply(true); init_dircache(false); #ifdef HAVE_TAGCACHE init_tagcache(); diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index c8d39c7395..2a42a83b07 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -304,7 +304,7 @@ int statusbar_callback(int action,const struct menu_item_ex *this_item) { case ACTION_EXIT_MENUITEM: /* this should be changed so only the viewports are reloaded */ - settings_apply(); + settings_apply(false); break; } return action; diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index b70295649e..7c2e87c410 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -69,7 +69,7 @@ static int reset_settings(void) { case YESNO_YES: settings_reset(); - settings_apply(); + settings_apply(true); settings_save(); break; case YESNO_NO: diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 0c17c0c373..80da1aaab9 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -86,7 +86,7 @@ static int set_color_func(void* color) res = (int)set_color(&screens[SCREEN_MAIN],str(colors[c].lang_id), colors[c].setting,*colors[c].setting); settings_save(); - settings_apply(); + settings_apply(false); return res; } @@ -99,7 +99,7 @@ static int reset_color(void) global_settings.lst_color = LCD_DEFAULT_FG; settings_save(); - settings_apply(); + settings_apply(false); return 0; } MENUITEM_FUNCTION(set_bg_col, MENU_FUNC_USEPARAM, ID2P(LANG_BACKGROUND_COLOR), diff --git a/apps/settings.c b/apps/settings.c index 3cf5de58ac..1463176dc5 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -355,7 +355,7 @@ bool settings_load_config(const char* file, bool apply) close(fd); settings_save(); if (apply) - settings_apply(); + settings_apply(true); return true; } @@ -732,7 +732,7 @@ void sound_settings_apply(void) #endif } -void settings_apply(void) +void settings_apply(bool read_disk) { char buf[64]; #if CONFIG_CODEC == SWCODEC @@ -812,41 +812,88 @@ void settings_apply(void) global_settings.peak_meter_clip_hold); #endif + if (read_disk) + { #if LCD_DEPTH > 1 - unload_wps_backdrop(); + unload_wps_backdrop(); #endif #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - unload_remote_wps_backdrop(); + unload_remote_wps_backdrop(); #endif - if ( global_settings.wps_file[0] && - global_settings.wps_file[0] != 0xff ) { - snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", - global_settings.wps_file); - wps_data_load(gui_wps[0].data, buf, true); - } - else - { - wps_data_init(gui_wps[0].data); + if ( global_settings.wps_file[0] && + global_settings.wps_file[0] != 0xff ) { + snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", + global_settings.wps_file); + wps_data_load(gui_wps[0].data, buf, true); + } + else + { + wps_data_init(gui_wps[0].data); #ifdef HAVE_REMOTE_LCD - gui_wps[0].data->remote_wps = false; + gui_wps[0].data->remote_wps = false; #endif - } + } #if LCD_DEPTH > 1 - if ( global_settings.backdrop_file[0] && - global_settings.backdrop_file[0] != 0xff ) { - snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", - global_settings.backdrop_file); - load_main_backdrop(buf); - } else { - unload_main_backdrop(); - } - show_main_backdrop(); + if ( global_settings.backdrop_file[0] && + global_settings.backdrop_file[0] != 0xff ) { + snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", + global_settings.backdrop_file); + load_main_backdrop(buf); + } else { + unload_main_backdrop(); + } + show_main_backdrop(); #endif #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - show_remote_main_backdrop(); + show_remote_main_backdrop(); #endif +#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) + if ( global_settings.rwps_file[0]) { + snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", + global_settings.rwps_file); + wps_data_load(gui_wps[1].data, buf, true); + } + else + { + wps_data_init(gui_wps[1].data); + gui_wps[1].data->remote_wps = true; + } +#endif + +#ifdef HAVE_LCD_BITMAP + if ( global_settings.font_file[0]) { + snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", + global_settings.font_file); + font_load(buf); + } + else + font_reset(); + + if ( global_settings.kbd_file[0]) { + snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", + global_settings.kbd_file); + load_kbd(buf); + } + else + load_kbd(NULL); + + if ( global_settings.lang_file[0]) { + snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", + global_settings.lang_file); + lang_load(buf); + talk_init(); /* use voice of same language */ + } + /* load the icon set */ + icons_init(); + +#ifdef HAVE_LCD_COLOR + if (global_settings.colors_file[0]) + read_color_theme_file(); +#endif + } + #ifdef HAVE_LCD_COLOR screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); screens[SCREEN_MAIN].set_background(global_settings.bg_color); @@ -855,36 +902,6 @@ void settings_apply(void) screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); #endif -#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) - if ( global_settings.rwps_file[0]) { - snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", - global_settings.rwps_file); - wps_data_load(gui_wps[1].data, buf, true); - } - else - { - wps_data_init(gui_wps[1].data); - gui_wps[1].data->remote_wps = true; - } -#endif - -#ifdef HAVE_LCD_BITMAP - if ( global_settings.font_file[0]) { - snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", - global_settings.font_file); - font_load(buf); - } - else - font_reset(); - - if ( global_settings.kbd_file[0]) { - snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", - global_settings.kbd_file); - load_kbd(buf); - } - else - load_kbd(NULL); - lcd_scroll_step(global_settings.scroll_step); gui_list_screen_scroll_step(global_settings.screen_scroll_step); gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); @@ -895,12 +912,6 @@ void settings_apply(void) lcd_bidir_scroll(global_settings.bidir_limit); lcd_scroll_delay(global_settings.scroll_delay); - if ( global_settings.lang_file[0]) { - snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", - global_settings.lang_file); - lang_load(buf); - talk_init(); /* use voice of same language */ - } set_codepage(global_settings.default_codepage); @@ -943,13 +954,6 @@ void settings_apply(void) /* This should stay last */ #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC enc_global_settings_apply(); -#endif - /* load the icon set */ - icons_init(); - -#ifdef HAVE_LCD_COLOR - if (global_settings.colors_file[0]) - read_color_theme_file(); #endif list_init_viewports(); } diff --git a/apps/settings.h b/apps/settings.h index 06c9c8ba73..1a2c2ee444 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -217,7 +217,7 @@ bool settings_save_config(int options); void settings_reset(void); void sound_settings_apply(void); -void settings_apply(void); +void settings_apply(bool read_disk); void settings_apply_pm_range(void); void settings_display(void);