aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-09-11 14:53:32 -0400
committerKen Moore <ken@ixsystems.com>2017-09-11 14:53:32 -0400
commit91b49f991eaa2c2c6ba50ec129db9f7c0405c14d (patch)
treecba9d453d0c35dee10b2abc088e6cdcadaca9839 /src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
parentAdd support for a "desktop_stylesheets" config knob which will activated if t... (diff)
downloadlumina-91b49f991eaa2c2c6ba50ec129db9f7c0405c14d.tar.gz
lumina-91b49f991eaa2c2c6ba50ec129db9f7c0405c14d.tar.bz2
lumina-91b49f991eaa2c2c6ba50ec129db9f7c0405c14d.zip
Rename the "stylesheets" tab and split it up into two tabs:
"Application Theme" and "Desktop Theme". Also re-work the qsspage class a bit to understand whether it is running in "desktop" or "application" mode.
Diffstat (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp')
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp18
1 files changed, 13 insertions, 5 deletions
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); }
bgstack15