aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-12-17 16:22:39 -0500
committerKen Moore <moorekou@gmail.com>2015-12-17 16:22:39 -0500
commitbdd5a2d104f4dea0e36b24389fcd42b7f5c464e3 (patch)
tree1d20845e20c236e1c45142445f5b208054a06b67 /libLumina
parentAdjust the initial Lumina theming a bit: Use the "bora_black" fluxbox theme, ... (diff)
downloadlumina-bdd5a2d104f4dea0e36b24389fcd42b7f5c464e3.tar.gz
lumina-bdd5a2d104f4dea0e36b24389fcd42b7f5c464e3.tar.bz2
lumina-bdd5a2d104f4dea0e36b24389fcd42b7f5c464e3.zip
Fix up the loading of theme colors on first-run. Also find/fix a typo in the default luminaDesktop.conf file.
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaThemes.cpp11
-rw-r--r--libLumina/LuminaThemes.h4
-rw-r--r--libLumina/LuminaUtils.cpp16
3 files changed, 22 insertions, 9 deletions
diff --git a/libLumina/LuminaThemes.cpp b/libLumina/LuminaThemes.cpp
index 351189eb..415b3acf 100644
--- a/libLumina/LuminaThemes.cpp
+++ b/libLumina/LuminaThemes.cpp
@@ -429,7 +429,7 @@ LuminaThemeEngine::LuminaThemeEngine(QApplication *app){
watcher->addPath( QDir::homePath()+"/.lumina/envsettings.conf" );
watcher->addPath( QDir::homePath()+"/.lumina/themesettings.cfg" );
watcher->addPaths( QStringList() << theme << colors << QDir::homePath()+"/.icons/default/index.theme" ); //also watch these files for changes
- connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange()) );
+ connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange(QString)) );
connect(syncTimer, SIGNAL(timeout()), this, SLOT(reloadFiles()) );
}
@@ -437,14 +437,19 @@ LuminaThemeEngine::~LuminaThemeEngine(){
}
-void LuminaThemeEngine::watcherChange(){
+void LuminaThemeEngine::refresh(){
+ QTimer::singleShot(100,this, SLOT(reloadFiles()) );
+}
+
+void LuminaThemeEngine::watcherChange(QString file){
if(syncTimer->isActive()){ syncTimer->stop(); }
syncTimer->start();
+ if(!watcher->files().contains(file)){ watcher->addPath(file); }
}
void LuminaThemeEngine::reloadFiles(){
//Check the Theme file/settings
- if(lastcheck < QFileInfo(QDir::homePath()+"/.lumina/themesettings.cfg").lastModified() ){
+ if(lastcheck < QFileInfo(QDir::homePath()+"/.lumina/themesettings.cfg").lastModified().addSecs(1) ){
QStringList current = LTHEME::currentSettings();
application->setStyleSheet( LTHEME::assembleStyleSheet(current[0], current[1], current[3], current[4]) );
if(icons!=current[2]){
diff --git a/libLumina/LuminaThemes.h b/libLumina/LuminaThemes.h
index 0ff15aa1..f0b8c2b6 100644
--- a/libLumina/LuminaThemes.h
+++ b/libLumina/LuminaThemes.h
@@ -92,6 +92,8 @@ public:
LuminaThemeEngine(QApplication *app);
~LuminaThemeEngine();
+ void refresh();
+
private:
QApplication *application;
QFileSystemWatcher *watcher;
@@ -101,7 +103,7 @@ private:
//LuminaThemeStyle *style;
private slots:
- void watcherChange();
+ void watcherChange(QString);
void reloadFiles();
signals:
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp
index cad7f817..a8ddfc90 100644
--- a/libLumina/LuminaUtils.cpp
+++ b/libLumina/LuminaUtils.cpp
@@ -574,6 +574,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
QString var = tmp[i].section("=",0,0).toLower().simplified();
QString val = tmp[i].section("=",1,1).section("#",0,0).simplified();
+ if(val.isEmpty()){ continue; }
QString istrue = (val.toLower()=="true") ? "true": "false";
//Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while
if(var.contains(".")){ var.replace(".","_"); }
@@ -621,6 +622,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
QString var = tmp[i].section("=",0,0).toLower().simplified();
QString val = tmp[i].section("=",1,1).section("#",0,0).simplified();
+ if(val.isEmpty()){ continue; }
QString istrue = (val.toLower()=="true") ? "true": "false";
//Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while
if(var.contains(".")){ var.replace(".","_"); }
@@ -643,6 +645,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
QString var = tmp[i].section("=",0,0).toLower().simplified();
QString val = tmp[i].section("=",1,1).section("#",0,0).simplified();
+ if(val.isEmpty()){ continue; }
QString istrue = (val.toLower()=="true") ? "true": "false";
//Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while
if(var.contains(".")){ var.replace(".","_"); }
@@ -675,6 +678,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
QString var = tmp[i].section("=",0,0).simplified();
QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ if(val.isEmpty()){ continue; }
//Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while
if(var.contains(".")){ var.replace(".","_"); }
//Now parse the variable and put the value in the proper file
@@ -701,7 +705,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
//Now do any theme settings
QStringList themesettings = LTHEME::currentSettings();
//List: [theme path, colorspath, iconsname, font, fontsize]
- qDebug() << "Current Theme Color:" << themesettings[1];
+ //qDebug() << "Current Theme Color:" << themesettings[1];
tmp = sysDefaults.filter("theme_");
if(tmp.isEmpty()){ tmp = sysDefaults.filter("theme."); }
bool setTheme = !tmp.isEmpty();
@@ -709,6 +713,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
QString var = tmp[i].section("=",0,0).toLower().simplified();
QString val = tmp[i].section("=",1,1).section("#",0,0).simplified();
+ if(val.isEmpty()){ continue; }
//Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while
if(var.contains(".")){ var.replace(".","_"); }
//Now parse the variable and put the value in the proper file
@@ -728,8 +733,8 @@ void LUtils::LoadSystemDefaults(bool skipOS){
QStringList systhemes = LTHEME::availableSystemThemes();
QStringList syscolors = LTHEME::availableSystemColors();
//theme file
- qDebug() << "Detected Themes/colors:" << systhemes << syscolors;
- if( !themesettings[0].startsWith("/") || !QFile::exists(themesettings[0]) || !themesettings[1].endsWith(".qss.template")){
+ //qDebug() << "Detected Themes/colors:" << systhemes << syscolors;
+ if( !themesettings[0].startsWith("/") || !QFile::exists(themesettings[0]) || !themesettings[0].endsWith(".qss.template")){
themesettings[0] = themesettings[0].section(".qss",0,0).simplified();
for(int i=0; i<systhemes.length(); i++){
if(systhemes[i].startsWith(themesettings[0]+"::::",Qt::CaseInsensitive)){
@@ -750,7 +755,8 @@ void LUtils::LoadSystemDefaults(bool skipOS){
}
}
}
-
+ //qDebug() << " - Final Theme Color:" << themesettings[1];
+
//Ensure that the settings directory exists
QString setdir = QDir::homePath()+"/.lumina/LuminaDE";
if(!QFile::exists(setdir)){
@@ -848,4 +854,4 @@ void ResizeMenu::mouseReleaseEvent(QMouseEvent *ev){
}else{
QMenu::mouseReleaseEvent(ev); //do normal processing
}
-} \ No newline at end of file
+}
bgstack15