From 8687a43803e0d5937ff5213ab987b05866498362 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 3 Aug 2017 10:48:19 -0400 Subject: Cleanup the lumina-theme-engine subproject 1. Use the built-in OS-detect.pri for build settings 2. Remove the "DISABLE_WIDGETS" flag (desktop always needs it) 3. Clean up the multi-path search routines for qss/color files 4. Add some color files to the default install --- .../lthemeengine-qtplugin.pro | 2 +- .../src/lthemeengine-style/lthemeengine-style.pro | 4 ++-- .../src/lthemeengine/appearancepage.cpp | 18 ++++++++-------- .../src/lthemeengine/appearancepage.h | 2 +- .../src/lthemeengine/lthemeengine.cpp | 6 +++++- .../src/lthemeengine/lthemeengine.pro | 7 +++---- .../lumina-theme-engine/src/lthemeengine/main.cpp | 2 +- .../src/lthemeengine/qsspage.cpp | 24 ++++++++++++---------- .../lumina-theme-engine/src/lthemeengine/qsspage.h | 2 +- 9 files changed, 37 insertions(+), 30 deletions(-) (limited to 'src-qt5/core/lumina-theme-engine/src') diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengine-qtplugin.pro b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengine-qtplugin.pro index a186cd49..3dca4fd1 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengine-qtplugin.pro +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengine-qtplugin.pro @@ -2,7 +2,7 @@ include(../../lthemeengine.pri) TEMPLATE = lib TARGET = lthemeengine -CONFIG += plugin +CONFIG *= plugin greaterThan(QT_MINOR_VERSION, 7) { QT += gui-private theme_support-private diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengine-style.pro b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengine-style.pro index 0b40de64..0f68e7e4 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengine-style.pro +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengine-style.pro @@ -2,11 +2,11 @@ include(../../lthemeengine.pri) TEMPLATE = lib TARGET = lthemeengine-style -QT += widgets +QT *= widgets # Input -CONFIG += plugin +CONFIG *= plugin target.path = $$PLUGINDIR/styles INSTALLS += target diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp index 4d585409..af130ed5 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp @@ -190,8 +190,7 @@ void AppearancePage::readSettings(){ m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); QString colorSchemePath = settings.value("color_scheme_path").toString(); QDir("/").mkpath(lthemeengine::userColorSchemePath()); - findColorSchemes(lthemeengine::userColorSchemePath()); - findColorSchemes(lthemeengine::sharedColorSchemePath().join(", ")); + findColorSchemes( QStringList() << lthemeengine::userColorSchemePath() << lthemeengine::sharedColorSchemePath()); if(m_ui->colorSchemeComboBox->count() == 0){ m_customPalette = palette(); //load fallback palette } @@ -223,12 +222,15 @@ void AppearancePage::setPalette(QWidget *w, QPalette p){ w->setPalette(p); } -void AppearancePage::findColorSchemes(const QString &path){ - QDir dir(path); - dir.setFilter(QDir::Files); - dir.setNameFilters(QStringList() << "*.conf"); - foreach (QFileInfo info, dir.entryInfoList()){ - m_ui->colorSchemeComboBox->addItem(info.baseName(), info.filePath()); +void AppearancePage::findColorSchemes(const QStringList &paths){ + for(int i=0; icolorSchemeComboBox->addItem(info.baseName(), info.filePath()); + } } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h index 23bab52f..21eb5a6d 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h @@ -35,7 +35,7 @@ private: void readSettings(); void setStyle(QWidget *w, QStyle *s); void setPalette(QWidget *w, QPalette p); - void findColorSchemes(const QString &path); + void findColorSchemes(const QStringList &paths); QPalette loadColorScheme(const QString &filePath); void createColorScheme(const QString &name, const QPalette &palette); Ui::AppearancePage *m_ui; diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp index 36b0c2fa..fdeb8966 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp @@ -6,6 +6,7 @@ #define LTHEMEENGINE_DATADIR "/usr/local/share" #endif +#include QString lthemeengine::configPath(){ return QDir::homePath() + "/.config/lthemeengine/"; @@ -46,7 +47,8 @@ QStringList lthemeengine::sharedStyleSheetPath(){ QStringList dirs; dirs << QString(getenv("XDG_CONFIG_HOME")); dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; iQT_STYLE_OVERRIDE environment variable"); } - if(env.value("QT_QPA_PLATFORMTHEME") != "lthemeengine"){ errorMessages << app.translate("main", "The QT_QPA_PLATFORMTHEME environment variable is not set correctly"); } + //if(env.value("QT_QPA_PLATFORMTHEME") != "lthemeengine"){ errorMessages << app.translate("main", "The QT_QPA_PLATFORMTHEME environment variable is not set correctly"); } if(!QStyleFactory::keys().contains("lthemeengine-style")){ errorMessages << app.translate("main", "Unable to find liblthemeengine-style.so"); } if(!errorMessages.isEmpty()){ QMessageBox::critical(0, app.translate("main", "Error"), errorMessages.join("

")); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp index d690ef5d..414273be 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp @@ -95,8 +95,7 @@ void QSSPage::on_removeButton_clicked(){ void QSSPage::readSettings(){ //load stylesheets m_ui->qssListWidget->clear(); - findStyleSheets(lthemeengine::userStyleSheetPath()); - findStyleSheets(lthemeengine::sharedStyleSheetPath().join(", ")); + findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath()); QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); QStringList styleSheets = settings.value("Interface/stylesheets").toStringList(); for(int i = 0; i < m_ui->qssListWidget->count(); ++i){ @@ -106,16 +105,19 @@ void QSSPage::readSettings(){ } } -void QSSPage::findStyleSheets(const QString &path){ - QDir dir(path); - dir.setFilter(QDir::Files); - dir.setNameFilters(QStringList() << "*.qss"); - foreach (QFileInfo info, dir.entryInfoList()){ - QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); - item->setToolTip(info.filePath()); - item->setData(QSS_FULL_PATH_ROLE, info.filePath()); - item->setData(QSS_WRITABLE_ROLE, info.isWritable()); +void QSSPage::findStyleSheets(const QStringList &paths){ + for(int i=0; iqssListWidget); + item->setToolTip(info.filePath()); + item->setData(QSS_FULL_PATH_ROLE, info.filePath()); + item->setData(QSS_WRITABLE_ROLE, info.isWritable()); } + } } void QSSPage::on_renameButton_clicked(){ diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h index 1fe0ed73..884f9a93 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h @@ -30,7 +30,7 @@ private slots: private: void readSettings(); - void findStyleSheets(const QString &path); + void findStyleSheets(const QStringList &paths); Ui::QSSPage *m_ui; QMenu *m_menu; }; -- cgit