diff options
-rw-r--r-- | libLumina/LuminaThemes.cpp | 9 | ||||
-rw-r--r-- | libLumina/LuminaThemes.h | 3 | ||||
-rw-r--r-- | lumina-config/mainUI.cpp | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/libLumina/LuminaThemes.cpp b/libLumina/LuminaThemes.cpp index 269af259..e4c13ae7 100644 --- a/libLumina/LuminaThemes.cpp +++ b/libLumina/LuminaThemes.cpp @@ -177,10 +177,14 @@ LuminaThemeEngine::LuminaThemeEngine(QApplication *app){ theme = current[0]; colors=current[1]; icons=current[2]; font=current[3]; fontsize=current[4]; application->setStyleSheet( LTHEME::assembleStyleSheet(theme, colors, font, fontsize) ); QIcon::setThemeName(icons); //make sure this sets set within this environment + syncTimer = new QTimer(this); + syncTimer->setSingleShot(true); + syncTimer->setInterval(500); //wait 1/2 second before re-loading the files watcher = new QFileSystemWatcher(this); watcher->addPath( QDir::homePath()+"/.lumina/themesettings.cfg" ); watcher->addPaths( QStringList() << theme << colors ); //also watch these files for changes connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange()) ); + connect(syncTimer, SIGNAL(timeout()), this, SLOT(reloadFiles()) ); } LuminaThemeEngine::~LuminaThemeEngine(){ @@ -188,6 +192,11 @@ LuminaThemeEngine::~LuminaThemeEngine(){ } void LuminaThemeEngine::watcherChange(){ + if(syncTimer->isActive()){ syncTimer->stop(); } + syncTimer->start(); +} + +void LuminaThemeEngine::reloadFiles(){ QStringList current = LTHEME::currentSettings(); application->setStyleSheet( LTHEME::assembleStyleSheet(current[0], current[1], current[3], current[4]) ); diff --git a/libLumina/LuminaThemes.h b/libLumina/LuminaThemes.h index e4bbd208..9b5ad5bc 100644 --- a/libLumina/LuminaThemes.h +++ b/libLumina/LuminaThemes.h @@ -16,6 +16,7 @@ #include <QString> #include <QFile> #include <QDir> +#include <QTimer> class LTHEME{ public: @@ -63,9 +64,11 @@ private: QApplication *application; QFileSystemWatcher *watcher; QString theme,colors,icons, font, fontsize; //current settings + QTimer *syncTimer; private slots: void watcherChange(); + void reloadFiles(); signals: void updateIcons(); diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 724d4556..99576376 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -1833,6 +1833,7 @@ void MainUI::saveSessionSettings(){ QString iconset = ui->combo_session_icontheme->currentText(); QString font = ui->font_session_theme->currentFont().family(); QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; + //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); } |