split the theme settings apply() sutff out of settings_apply(). this should fix splashes not being loc'ed, statusbar over the splash (fixed in sim, not on my mini2g though), and the supposed boot time slowdown.
What this also does is remove a bunch of unnecessary settings_Apply()'s from the ipod accessory code, and causes all non-skin settings to get applied each time (this includes font and langs which we wernt doing to stop disk access) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24922 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c396e4161a
commit
4c6b3551b5
10 changed files with 146 additions and 118 deletions
|
@ -84,6 +84,7 @@ gui/statusbar.c
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
gui/statusbar-skinned.c
|
||||
#endif
|
||||
gui/theme_settings.c
|
||||
gui/yesno.c
|
||||
gui/viewport.c
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ bool quick_screen_quick(int button_enter)
|
|||
if (gui_syncquickscreen_run(&qs, button_enter))
|
||||
{
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
settings_apply();
|
||||
/* make sure repeat/shuffle/any other nasty ones get updated */
|
||||
if ( oldrepeat != global_settings.repeat_mode &&
|
||||
(audio_status() & AUDIO_STATUS_PLAY) )
|
||||
|
@ -437,7 +437,7 @@ bool quick_screen_f3(int button_enter)
|
|||
if (gui_syncquickscreen_run(&qs, button_enter))
|
||||
{
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
settings_apply();
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
|
94
apps/gui/theme_settings.c
Normal file
94
apps/gui/theme_settings.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: settings.c 24848 2010-02-22 07:25:13Z jdgordon $
|
||||
*
|
||||
* Copyright (C) 2002 by Stuart Martin
|
||||
* RTC config saving code (C) 2002 by hessu@hes.iki.fi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "inttypes.h"
|
||||
#include "config.h"
|
||||
#include "action.h"
|
||||
#include "crc32.h"
|
||||
#include "settings.h"
|
||||
#include "wps.h"
|
||||
#include "file.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
#include "skin_engine/skin_fonts.h"
|
||||
#include "statusbar-skinned.h"
|
||||
|
||||
|
||||
|
||||
/* call this after loading a .wps/.rwps or other skin files, so that the
|
||||
* skin buffer is reset properly
|
||||
*/
|
||||
struct skin_load_setting {
|
||||
char* setting;
|
||||
char* suffix;
|
||||
void (*loadfunc)(enum screen_type screen, const char *buf, bool isfile);
|
||||
};
|
||||
static struct skin_load_setting skins[] = {
|
||||
/* This determins the load order. *sbs must be loaded before any other
|
||||
* skin on that screen */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
{ global_settings.sbs_file, "sbs", sb_skin_data_load},
|
||||
#endif
|
||||
{ global_settings.wps_file, "wps", wps_data_load},
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
{ global_settings.rsbs_file, "rsbs", sb_skin_data_load},
|
||||
{ global_settings.rwps_file, "rwps", wps_data_load},
|
||||
#endif
|
||||
};
|
||||
|
||||
void settings_apply_skins(void)
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
/* re-initialize the skin buffer before we start reloading skins */
|
||||
skin_buffer_init();
|
||||
enum screen_type screen = SCREEN_MAIN;
|
||||
unsigned int i;
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
skin_backdrop_init();
|
||||
skin_font_init();
|
||||
sb_skin_init();
|
||||
#endif
|
||||
gui_sync_wps_init();
|
||||
for (i=0; i<sizeof(skins)/sizeof(*skins); i++)
|
||||
{
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN;
|
||||
#endif
|
||||
if (skins[i].setting[0] && skins[i].setting[0] != '-')
|
||||
{
|
||||
snprintf(buf, sizeof buf, WPS_DIR "/%s.%s",
|
||||
skins[i].setting, skins[i].suffix);
|
||||
skins[i].loadfunc(screen, buf, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
skins[i].loadfunc(screen, NULL, true);
|
||||
}
|
||||
}
|
||||
viewportmanager_theme_changed(THEME_STATUSBAR);
|
||||
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
FOR_NB_SCREENS(i)
|
||||
screens[i].backdrop_show(sb_get_backdrop(i));
|
||||
#endif
|
||||
}
|
|
@ -110,12 +110,13 @@ static void toggle_theme(enum screen_type screen, bool force)
|
|||
|
||||
if (is_theme_enabled(screen))
|
||||
{
|
||||
bool first_boot = theme_stack_top[screen] == 0;
|
||||
/* remove the left overs from the previous screen.
|
||||
* could cause a tiny flicker. Redo your screen code if that happens */
|
||||
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
screens[screen].backdrop_show(sb_get_backdrop(screen));
|
||||
#endif
|
||||
if (!was_enabled[screen] || force)
|
||||
if (!first_boot && (!was_enabled[screen] || force))
|
||||
{
|
||||
struct viewport deadspace, user;
|
||||
viewport_set_defaults(&user, screen);
|
||||
|
@ -161,7 +162,7 @@ static void toggle_theme(enum screen_type screen, bool force)
|
|||
screens[screen].update_viewport();
|
||||
}
|
||||
}
|
||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
|
||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)!first_boot);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -420,7 +420,6 @@ void iap_handlepkt(void)
|
|||
{
|
||||
global_settings.playlist_shuffle = 1;
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||
playlist_randomise(NULL, current_tick, true);
|
||||
}
|
||||
|
@ -428,7 +427,6 @@ void iap_handlepkt(void)
|
|||
{
|
||||
global_settings.playlist_shuffle = 0;
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||
playlist_sort(NULL, true);
|
||||
}
|
||||
|
@ -451,7 +449,6 @@ void iap_handlepkt(void)
|
|||
global_settings.repeat_mode = REPEAT_ALL;
|
||||
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||
audio_flush_and_reload_tracks();
|
||||
}
|
||||
|
@ -716,7 +713,6 @@ void iap_handlepkt(void)
|
|||
{
|
||||
global_settings.playlist_shuffle = 1;
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||
playlist_randomise(NULL, current_tick, true);
|
||||
}
|
||||
|
@ -724,7 +720,6 @@ void iap_handlepkt(void)
|
|||
{
|
||||
global_settings.playlist_shuffle = 0;
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||
playlist_sort(NULL, true);
|
||||
}
|
||||
|
@ -762,7 +757,6 @@ void iap_handlepkt(void)
|
|||
if (oldmode != global_settings.repeat_mode)
|
||||
{
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||
audio_flush_and_reload_tracks();
|
||||
}
|
||||
|
|
12
apps/main.c
12
apps/main.c
|
@ -325,11 +325,10 @@ static void init(void)
|
|||
sb_skin_init();
|
||||
viewportmanager_init();
|
||||
|
||||
gui_sync_wps_init();
|
||||
storage_init();
|
||||
settings_reset();
|
||||
settings_load(SETTINGS_ALL);
|
||||
settings_apply(false);
|
||||
settings_apply();
|
||||
init_dircache(true);
|
||||
init_dircache(false);
|
||||
#ifdef HAVE_TAGCACHE
|
||||
|
@ -368,7 +367,7 @@ static void init(void)
|
|||
audio_init();
|
||||
button_clear_queue(); /* Empty the keyboard buffer */
|
||||
|
||||
settings_apply(true);
|
||||
settings_apply_skins();
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -455,8 +454,6 @@ static void init(void)
|
|||
sb_skin_init();
|
||||
viewportmanager_init();
|
||||
|
||||
gui_sync_wps_init();
|
||||
|
||||
#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
|
||||
/* charger_inserted() can't be used here because power_thread()
|
||||
hasn't checked power_input_status() yet */
|
||||
|
@ -562,7 +559,7 @@ static void init(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
settings_apply(false);
|
||||
settings_apply();
|
||||
init_dircache(false);
|
||||
#ifdef HAVE_TAGCACHE
|
||||
init_tagcache();
|
||||
|
@ -627,8 +624,7 @@ static void init(void)
|
|||
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
|
||||
check_bootfile(false); /* remember write time and filesize */
|
||||
#endif
|
||||
|
||||
settings_apply(true);
|
||||
settings_apply_skins();
|
||||
}
|
||||
|
||||
#ifdef CPU_PP
|
||||
|
|
|
@ -76,8 +76,9 @@ static int reset_settings(void)
|
|||
{
|
||||
case YESNO_YES:
|
||||
settings_reset();
|
||||
settings_apply(true);
|
||||
settings_save();
|
||||
settings_apply();
|
||||
settings_apply_skins();
|
||||
break;
|
||||
case YESNO_NO:
|
||||
break;
|
||||
|
|
|
@ -96,7 +96,7 @@ static int set_color_func(void* color)
|
|||
res = (int)set_color(&screens[SCREEN_MAIN],str(colors[c].lang_id),
|
||||
colors[c].setting, banned_color);
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
settings_apply();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ static int reset_color(void)
|
|||
global_settings.lst_color = LCD_DEFAULT_FG;
|
||||
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
settings_apply();
|
||||
return 0;
|
||||
}
|
||||
MENUITEM_FUNCTION(set_bg_col, MENU_FUNC_USEPARAM, ID2P(LANG_BACKGROUND_COLOR),
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
#endif
|
||||
#include "wps.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
#include "skin_engine/skin_fonts.h"
|
||||
#include "viewport.h"
|
||||
#include "statusbar-skinned.h"
|
||||
|
||||
|
@ -360,7 +359,10 @@ bool settings_load_config(const char* file, bool apply)
|
|||
close(fd);
|
||||
settings_save();
|
||||
if (apply)
|
||||
settings_apply(true);
|
||||
{
|
||||
settings_apply();
|
||||
settings_apply_skins();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -739,62 +741,7 @@ void sound_settings_apply(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* call this after loading a .wps/.rwps or other skin files, so that the
|
||||
* skin buffer is reset properly
|
||||
*/
|
||||
struct skin_load_setting {
|
||||
char* setting;
|
||||
char* suffix;
|
||||
void (*loadfunc)(enum screen_type screen, const char *buf, bool isfile);
|
||||
};
|
||||
static struct skin_load_setting skins[] = {
|
||||
/* This determins the load order. *sbs must be loaded before any other
|
||||
* skin on that screen */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
{ global_settings.sbs_file, "sbs", sb_skin_data_load},
|
||||
#endif
|
||||
{ global_settings.wps_file, "wps", wps_data_load},
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
{ global_settings.rsbs_file, "rsbs", sb_skin_data_load},
|
||||
{ global_settings.rwps_file, "rwps", wps_data_load},
|
||||
#endif
|
||||
};
|
||||
void settings_apply_skins(void)
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
/* re-initialize the skin buffer before we start reloading skins */
|
||||
skin_buffer_init();
|
||||
enum screen_type screen = SCREEN_MAIN;
|
||||
unsigned int i;
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
skin_backdrop_init();
|
||||
skin_font_init();
|
||||
#endif
|
||||
for (i=0; i<sizeof(skins)/sizeof(*skins); i++)
|
||||
{
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN;
|
||||
#endif
|
||||
if (skins[i].setting[0] && skins[i].setting[0] != '-')
|
||||
{
|
||||
snprintf(buf, sizeof buf, WPS_DIR "/%s.%s",
|
||||
skins[i].setting, skins[i].suffix);
|
||||
skins[i].loadfunc(screen, buf, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
skins[i].loadfunc(screen, NULL, true);
|
||||
}
|
||||
}
|
||||
viewportmanager_theme_changed(THEME_STATUSBAR);
|
||||
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
FOR_NB_SCREENS(i)
|
||||
screens[i].backdrop_show(sb_get_backdrop(i));
|
||||
#endif
|
||||
}
|
||||
|
||||
void settings_apply(bool read_disk)
|
||||
void settings_apply(void)
|
||||
{
|
||||
|
||||
char buf[64];
|
||||
|
@ -886,8 +833,6 @@ void settings_apply(bool read_disk)
|
|||
audiohw_enable_speaker(global_settings.speaker_enabled);
|
||||
#endif
|
||||
|
||||
if (read_disk)
|
||||
{
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
/* fonts need to be loaded before the WPS */
|
||||
if ( global_settings.font_file[0]) {
|
||||
|
@ -924,9 +869,6 @@ void settings_apply(bool read_disk)
|
|||
talk_init(); /* use voice of same language */
|
||||
}
|
||||
|
||||
/* reload wpses */
|
||||
settings_apply_skins();
|
||||
|
||||
/* load the icon set */
|
||||
icons_init();
|
||||
|
||||
|
@ -934,7 +876,6 @@ void settings_apply(bool read_disk)
|
|||
if (global_settings.colors_file[0])
|
||||
read_color_theme_file();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
|
||||
|
|
|
@ -260,7 +260,7 @@ void sound_settings_apply(void);
|
|||
*/
|
||||
void settings_apply_skins(void);
|
||||
|
||||
void settings_apply(bool read_disk);
|
||||
void settings_apply(void);
|
||||
void settings_apply_pm_range(void);
|
||||
void settings_display(void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue