#include "detailscreen.h"
#include "settings.h"
#include "widgetscreen.h"
+#include "themescheduler.h"
namespace
{
bool ThemeLoader::load()
{
- QString theme = Settings::instance().value("theme", "default").toString();
+ if(theme_.isEmpty())
+ {
+ connect(&(ThemeScheduler::instance()), SIGNAL(themeChanged()), this, SLOT(load()));
+ }
+
+ QString theme = ThemeScheduler::instance().currentTheme();
+
+ if(theme == theme_)
+ {
+ return true;
+ }
+
+ theme_ = theme;
QString themeDir = getThemeDir();
- if(QFile::exists(themeDir + theme + THEME_SUFFIX))
+ if(QFile::exists(themeDir + theme_ + THEME_SUFFIX))
{
- reader_ = new ZipReader(themeDir + theme + THEME_SUFFIX);
+ reader_ = new ZipReader(themeDir + theme_ + THEME_SUFFIX);
if(read())
{
}
}
- theme = "default";
- Settings::instance().setValue("theme", theme);
+ theme_ = ThemeScheduler::instance().getDefaultTheme();
+ Settings::instance().setValue("theme", theme_);
- if(QFile::exists(RESOURCE_DIR + theme))
+ if(QFile::exists(RESOURCE_DIR + theme_))
{
if(reader_)
{
delete reader_;
}
- reader_ = new FileReader(RESOURCE_DIR + theme);
+ reader_ = new FileReader(RESOURCE_DIR + theme_);
return read();
}