aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-theme-engine
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2017-09-11 18:27:38 -0400
committerZackaryWelch <welch.zackary@gmail.com>2017-09-11 18:27:38 -0400
commit09022703b189a3784ae7ed4c416ad5a08df2716f (patch)
treef21ab1478d9405763ade1de4f89fbebb64b40d4b /src-qt5/core/lumina-theme-engine
parentAdded video file detection and correct desktop file translation (diff)
parentRename the "stylesheets" tab and split it up into two tabs: (diff)
downloadlumina-09022703b189a3784ae7ed4c416ad5a08df2716f.tar.gz
lumina-09022703b189a3784ae7ed4c416ad5a08df2716f.tar.bz2
lumina-09022703b189a3784ae7ed4c416ad5a08df2716f.zip
Merge branch 'master' of https://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/core/lumina-theme-engine')
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp4
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp14
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h2
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp3
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp18
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h3
6 files changed, 36 insertions, 8 deletions
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp
index 453bde1d..692223c7 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp
@@ -211,7 +211,9 @@ void lthemeenginePlatformTheme::readSettings(){
}
//load style sheets
#ifdef QT_WIDGETS_LIB
- QStringList qssPaths = settings.value("stylesheets").toStringList();
+ QStringList qssPaths;
+ if(qApp->applicationName()=="lumina-desktop"){ qssPaths << settings.value("desktop_stylesheets").toStringList(); }
+ qssPaths << settings.value("stylesheets").toStringList();
m_userStyleSheet = loadStyleSheets(qssPaths);
#endif
settings.endGroup();
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 fdeb8966..701745c4 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp
@@ -53,6 +53,20 @@ QStringList lthemeengine::sharedStyleSheetPath(){
return dirs;
}
+QString lthemeengine::userDesktopStyleSheetPath(){
+ return configPath() + "desktop_qss/";
+}
+
+QStringList lthemeengine::sharedDesktopStyleSheetPath(){
+ QStringList dirs;
+ dirs << QString(getenv("XDG_CONFIG_HOME"));
+ dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":");
+ dirs << QString(getenv("XDG_DATA_DIRS")).split(":");
+ for(int i=0; i<dirs.length(); i++){ dirs[i].append("/lthemeengine/desktop_qss/"); }
+ if(dirs.isEmpty()){ dirs << LTHEMEENGINE_DATADIR"/lthemeengine/desktop_qss/"; } //no XDG settings - use the hardcoded path
+ return dirs;
+ }
+
QString lthemeengine::userColorSchemePath(){
return configPath() + "colors/";
}
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h
index 8a466ed9..06dd3e09 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h
@@ -21,6 +21,8 @@ public:
static QStringList iconPaths();
static QString userStyleSheetPath();
static QStringList sharedStyleSheetPath();
+ static QString userDesktopStyleSheetPath();
+ static QStringList sharedDesktopStyleSheetPath();
static QString userColorSchemePath();
static QStringList sharedColorSchemePath();
static QString systemLanguageID();
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp
index 719a0f49..91db14ee 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp
@@ -16,7 +16,8 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent), m_ui(new Ui::MainWind
m_ui->tabWidget->addTab(new IconThemePage(this), tr("Icon Theme"));
m_ui->tabWidget->addTab(new InterfacePage(this), tr("Interface"));
#ifdef USE_WIDGETS
- m_ui->tabWidget->addTab(new QSSPage(this), tr("Style Sheets"));
+ m_ui->tabWidget->addTab(new QSSPage(this, false), tr("Application Theme"));
+ m_ui->tabWidget->addTab(new QSSPage(this, true), tr("Desktop Theme"));
#endif
QSettings settings(lthemeengine::configFile(), QSettings::IniFormat);
restoreGeometry(settings.value("SettingsWindow/geometry").toByteArray());
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 2cf0f221..681de6c9 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
@@ -12,8 +12,9 @@
#define QSS_FULL_PATH_ROLE (Qt::ItemDataRole(Qt::UserRole))
#define QSS_WRITABLE_ROLE (Qt::ItemDataRole(Qt::UserRole + 1))
-QSSPage::QSSPage(QWidget *parent) : TabPage(parent), m_ui(new Ui::QSSPage){
+QSSPage::QSSPage(QWidget *parent, bool desktop) : TabPage(parent), m_ui(new Ui::QSSPage){
m_ui->setupUi(this);
+ desktop_qss = desktop;
QDir("/").mkpath(lthemeengine::userStyleSheetPath());
m_menu = new QMenu(this);
m_menu->addAction(QIcon::fromTheme("accessories-text-editor"), tr("Edit"), this, SLOT(on_editButton_clicked()));
@@ -37,7 +38,8 @@ void QSSPage::writeSettings(){
for(int i = 0; i < m_ui->qssListWidget->count(); ++i){
QListWidgetItem *item = m_ui->qssListWidget->item(i);
if(item->checkState() == Qt::Checked){ styleSheets << item->data(QSS_FULL_PATH_ROLE).toString(); }
- settings.setValue("Interface/stylesheets", styleSheets);
+ if(desktop_qss){ settings.setValue("Interface/desktop_stylesheets", styleSheets); }
+ else{ settings.setValue("Interface/stylesheets", styleSheets); }
}
}
@@ -58,7 +60,9 @@ void QSSPage::on_createButton_clicked(){
QString name = QInputDialog::getText(this, tr("Enter Style Sheet Name"), tr("File name:"));
if(name.isEmpty()){ return; }
if(!name.endsWith(".qss", Qt::CaseInsensitive)){ name.append(".qss"); }
- QString filePath = lthemeengine::userStyleSheetPath() + name;
+ QString filePath;
+ if(desktop_qss){ filePath = lthemeengine::userDesktopStyleSheetPath() + name; }
+ else{ filePath = lthemeengine::userStyleSheetPath() + name; }
if(QFile::exists(filePath)){
QMessageBox::warning(this, tr("Error"), tr("The file \"%1\" already exists").arg(filePath));
return;
@@ -95,9 +99,13 @@ void QSSPage::on_removeButton_clicked(){
void QSSPage::readSettings(){
//load stylesheets
m_ui->qssListWidget->clear();
- findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath());
+ if(desktop_qss){ findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath()); }
+ else{findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath()); }
QSettings settings(lthemeengine::configFile(), QSettings::IniFormat);
- QStringList styleSheets = settings.value("Interface/stylesheets").toStringList();
+ QStringList styleSheets;
+ if(desktop_qss){ styleSheets = settings.value("Interface/desktop_stylesheets").toStringList(); }
+ else{ styleSheets = settings.value("Interface/stylesheets").toStringList(); }
+
for(int i = 0; i < m_ui->qssListWidget->count(); ++i){
QListWidgetItem *item = m_ui->qssListWidget->item(i);
if(styleSheets.contains(item->data(QSS_FULL_PATH_ROLE).toString())){ item->setCheckState(Qt::Checked); }
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 5e924ad9..76417ddf 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h
@@ -15,7 +15,7 @@ class QSSPage : public TabPage
Q_OBJECT
public:
- explicit QSSPage(QWidget *parent = 0);
+ explicit QSSPage(QWidget *parent = 0, bool desktop = false);
~QSSPage();
void writeSettings();
@@ -33,6 +33,7 @@ private:
void findStyleSheets(QStringList paths);
Ui::QSSPage *m_ui;
QMenu *m_menu;
+ bool desktop_qss;
};
#endif // QSSPAGE_H
bgstack15