From b486021b3dab405161082dbbd0b862a7da0e4c0c Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 2 Nov 2016 09:41:07 -0400 Subject: Add a new sessionsettings flag: Qt5_theme_engine= This will allow the user to set some global Qt5 theme engine (such as qt5ct), and activate it for the entire session. --- src-qt5/core/lumina-desktop/LSession.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 8c8562d4..87f270ea 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -150,13 +150,17 @@ void LSession::setupSession(){ if(DEBUG){ qDebug() << " - Init QFileSystemWatcher:" << timer->elapsed();} watcher = new QFileSystemWatcher(this); QString confdir = sessionsettings->fileName().section("/",0,-2); - watcher->addPath( sessionsettings->fileName() ); - watcher->addPath( confdir+"/desktopsettings.conf" ); - watcher->addPath( confdir+"/fluxbox-init" ); - watcher->addPath( confdir+"/fluxbox-keys" ); + watcherChange(sessionsettings->fileName() ); + watcherChange( confdir+"/desktopsettings.conf" ); + watcherChange( confdir+"/fluxbox-init" ); + watcherChange( confdir+"/fluxbox-keys" ); + //watcher->addPath( sessionsettings->fileName() ); + //watcher->addPath( confdir+"/desktopsettings.conf" ); + //watcher->addPath( confdir+"/fluxbox-init" ); + //watcher->addPath( confdir+"/fluxbox-keys" ); //Try to watch the localized desktop folder too - if(QFile::exists(QDir::homePath()+"/"+tr("Desktop"))){ watcher->addPath( QDir::homePath()+"/"+tr("Desktop") ); } - watcher->addPath( QDir::homePath()+"/Desktop" ); + if(QFile::exists(QDir::homePath()+"/"+tr("Desktop"))){ watcherChange( QDir::homePath()+"/"+tr("Desktop") ); } + watcherChange( QDir::homePath()+"/Desktop" ); //connect internal signals/slots //connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screensChanged()) ); @@ -321,8 +325,17 @@ void LSession::reloadIconTheme(){ void LSession::watcherChange(QString changed){ if(DEBUG){ qDebug() << "Session Watcher Change:" << changed; } //if(changed.endsWith("fluxbox-init") || changed.endsWith("fluxbox-keys")){ refreshWindowManager(); } - if(changed.endsWith("sessionsettings.conf") ){ sessionsettings->sync(); emit SessionConfigChanged(); } - else if(changed.endsWith("desktopsettings.conf") ){ emit DesktopConfigChanged(); } + if(changed.endsWith("sessionsettings.conf") ){ + sessionsettings->sync(); + //qDebug() << "Session Settings Changed"; + if(sessionsettings->contains("Qt5_theme_engine")){ + QString engine = sessionsettings->value("Qt5_theme_engine","").toString(); + //qDebug() << "Set Qt5 theme engine: " << engine; + if(engine.isEmpty()){ unsetenv("QT_QPA_PLATFORMTHEME"); } + else{ setenv("QT_QPA_PLATFORMTHEME", engine.toUtf8().data(),1); } + } + emit SessionConfigChanged(); + }else if(changed.endsWith("desktopsettings.conf") ){ emit DesktopConfigChanged(); } else if(changed == QDir::homePath()+"/Desktop" || changed == QDir::homePath()+"/"+tr("Desktop") ){ desktopFiles = QDir(changed).entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs ,QDir::Name | QDir::IgnoreCase | QDir::DirsFirst); if(DEBUG){ qDebug() << "New Desktop Files:" << desktopFiles.length(); } -- cgit