diff options
author | Ken Moore <moorekou@gmail.com> | 2015-12-17 16:22:39 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-12-17 16:22:39 -0500 |
commit | bdd5a2d104f4dea0e36b24389fcd42b7f5c464e3 (patch) | |
tree | 1d20845e20c236e1c45142445f5b208054a06b67 | |
parent | Adjust the initial Lumina theming a bit: Use the "bora_black" fluxbox theme, ... (diff) | |
download | lumina-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.
-rw-r--r-- | libLumina/LuminaThemes.cpp | 11 | ||||
-rw-r--r-- | libLumina/LuminaThemes.h | 4 | ||||
-rw-r--r-- | libLumina/LuminaUtils.cpp | 16 | ||||
-rw-r--r-- | lumina-desktop/defaults/luminaDesktop.conf | 2 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 5 |
5 files changed, 25 insertions, 13 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 +} diff --git a/lumina-desktop/defaults/luminaDesktop.conf b/lumina-desktop/defaults/luminaDesktop.conf index f2632e0e..2c973adb 100644 --- a/lumina-desktop/defaults/luminaDesktop.conf +++ b/lumina-desktop/defaults/luminaDesktop.conf @@ -29,7 +29,7 @@ session_playlogoutaudio=true #[true/false] Play the audio chimes on log out #THEME SETTINGS #theme.themefile=<file path> #Absolute path to the theme template file to use (disable for Lumina-Default) -theme.colorfile=Black #Name of the color spec file to use for theming +theme_colorfile=Black #Name of the color spec file to use for theming theme_iconset=oxygen #Name of the icon theme to use theme_font=Arial #Name of the font family to use theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (<number>%) ) diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 3602c10e..50ad7ef4 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -70,8 +70,7 @@ int main(int argc, char ** argv) setenv("DESKTOP_SESSION","Lumina",1); setenv("XDG_CURRENT_DESKTOP","Lumina",1); unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... - //Startup the Application - if(DEBUG){ qDebug() << "Session Init:";} + //Startup the session LSession a(argc, argv); if(!a.isPrimaryProcess()){ return 0; } //Setup the log file @@ -95,7 +94,7 @@ int main(int argc, char ** argv) //LUtils::LoadTranslation(&a, "lumina-desktop"); if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); } a.setupSession(); - + theme.refresh(); if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;} int retCode = a.exec(); //qDebug() << "Stopping the window manager"; |