diff options
author | Ken Moore <ken@ixsystems.com> | 2017-12-07 13:55:23 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-12-07 13:55:23 -0500 |
commit | f925f25bd8f52c925db974a269d7dfd943f58669 (patch) | |
tree | e0b813e5c1324093cdb0b88576749ea200d8bc2b /src-qt5/core/libLumina/LuminaThemes.cpp | |
parent | Make sure the new traynotification-simple stylesheet is used. (diff) | |
download | lumina-f925f25bd8f52c925db974a269d7dfd943f58669.tar.gz lumina-f925f25bd8f52c925db974a269d7dfd943f58669.tar.bz2 lumina-f925f25bd8f52c925db974a269d7dfd943f58669.zip |
Fix up a couple more things:
1. Add option to load global styles from luminaDesktop.conf
2. Fix up the default icon/menu size of the start menu and item icons.
3. Fix up a signal/slot mis-connect in the start menu.
Diffstat (limited to 'src-qt5/core/libLumina/LuminaThemes.cpp')
-rw-r--r-- | src-qt5/core/libLumina/LuminaThemes.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp index 857e604b..03524941 100644 --- a/src-qt5/core/libLumina/LuminaThemes.cpp +++ b/src-qt5/core/libLumina/LuminaThemes.cpp @@ -34,6 +34,17 @@ QStringList LTHEME::availableSystemThemes(){ return list; } +QStringList LTHEME::availableSystemStyles(){ + //returns: [name::::path] for each item + QDir dir(LOS::LuminaShare()+"../lthemeengine/qss"); + QStringList list = dir.entryList(QStringList() <<"*.qss", QDir::Files, QDir::Name); + for(int i=0; i<list.length(); i++){ + //Format the output entry [<name>::::<fullpath>] + list[i] = list[i].section(".qss",0,0)+"::::"+dir.absoluteFilePath(list[i]); + } + return list; +} + QStringList LTHEME::availableLocalThemes(){ //returns: [name::::path] for each item QDir dir( QString(getenv("XDG_CONFIG_HOME"))+"/lthemeengine/desktop_qss"); QStringList list = dir.entryList(QStringList() <<"*.qss", QDir::Files, QDir::Name); @@ -44,6 +55,16 @@ QStringList LTHEME::availableLocalThemes(){ //returns: [name::::path] for each i return list; } +QStringList LTHEME::availableLocalStyles(){ //returns: [name::::path] for each item + QDir dir( QString(getenv("XDG_CONFIG_HOME"))+"/lthemeengine/qss"); + QStringList list = dir.entryList(QStringList() <<"*.qss", QDir::Files, QDir::Name); + for(int i=0; i<list.length(); i++){ + //Format the output entry [<name>::::<fullpath>] + list[i] = list[i].section(".qss",0,0)+"::::"+dir.absoluteFilePath(list[i]); + } + return list; +} + QStringList LTHEME::availableSystemColors(){ //returns: [name::::path] for each item //returns: [name::::path] for each item QDir dir(LOS::LuminaShare()+"../lthemeengine/colors"); @@ -244,6 +265,23 @@ bool LTHEME::setCursorTheme(QString cursorname){ return LUtils::writeFile(QDir::homePath()+"/.icons/default/index.theme", info, true); } +bool LTHEME::setCurrentStyles(QStringList paths){ + //Verify that the paths are all absolute paths, otherwise scan/replace with absolute paths + QStringList avail = LTHEME::availableSystemStyles(); + for(int i=0; i<paths.length(); i++){ + paths[i] = paths[i].simplified(); + if(paths[i].startsWith("/")){ continue; } //already an absolute path + for(int j=0; j<avail.length(); j++){ + if(avail[j].startsWith(paths[i].section("/",-1).section(".qss",0,0)+"::::") ){ paths[i] = avail[j].section("::::",1,-1); break; } + } + } + //ordered by priority: lowest -> highest + QSettings engineset("lthemeengine","lthemeengine"); + engineset.setValue("Interface/stylesheets",paths); + engineset.sync(); + return true; +} + //Return the complete stylesheet for a given theme/colors QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize){ QString stylesheet = LUtils::readFile(themepath).join("\n"); @@ -340,10 +378,10 @@ void LTHEME::LoadCustomEnvSettings(){ setenv(info[i].section("=",0,0).toLocal8Bit(), info[i].section("=",1,100).simplified().toLocal8Bit(), 1); } } - + } -bool LTHEME::setCustomEnvSetting(QString var, QString val){ +bool LTHEME::setCustomEnvSetting(QString var, QString val){ //variable/value pair (use an empty val to clear it) QStringList info = LTHEME::CustomEnvSettings(true); //user only bool changed = false; |