diff options
author | Ken Moore <ken@ixsystems.com> | 2017-08-29 09:51:16 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-08-29 09:51:16 -0400 |
commit | 664503796f8cd49b42a2f39a000a69a5cae8797d (patch) | |
tree | 258a3de1833215c5e7b8f8430ff77129fbb082c2 /src-qt5/core/libLumina | |
parent | Fix up the location/detection of icon/cursor themes. They just changes it ups... (diff) | |
download | lumina-664503796f8cd49b42a2f39a000a69a5cae8797d.tar.gz lumina-664503796f8cd49b42a2f39a000a69a5cae8797d.tar.bz2 lumina-664503796f8cd49b42a2f39a000a69a5cae8797d.zip |
Syncronize the icon theme option in lumina-config with lthemeengine.
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LuminaThemes.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp index 2d4aab53..ddbc7b37 100644 --- a/src-qt5/core/libLumina/LuminaThemes.cpp +++ b/src-qt5/core/libLumina/LuminaThemes.cpp @@ -23,7 +23,7 @@ //#include "qxcbcursor.h" //needed to prod Qt to refresh the mouse cursor theme //#include <QCursor> -QStringList LTHEME::availableSystemThemes(){ +QStringList LTHEME::availableSystemThemes(){ //returns: [name::::path] for each item QDir dir(LOS::LuminaShare()+"themes"); QStringList list = dir.entryList(QStringList() <<"*.qss.template", QDir::Files, QDir::Name); @@ -31,7 +31,7 @@ QStringList LTHEME::availableSystemThemes(){ //Format the output entry [<name>::::<fullpath>] list[i] = list[i].section(".qss.",0,0)+"::::"+dir.absoluteFilePath(list[i]); } - return list; + return list; } QStringList LTHEME::availableLocalThemes(){ //returns: [name::::path] for each item @@ -52,7 +52,7 @@ QStringList LTHEME::availableSystemColors(){ //returns: [name::::path] for each //Format the output entry [<name>::::<fullpath>] list[i] = list[i].section(".qss.",0,0)+"::::"+dir.absoluteFilePath(list[i]); } - return list; + return list; } QStringList LTHEME::availableLocalColors(){ //returns: [name::::path] for each item @@ -62,7 +62,7 @@ QStringList LTHEME::availableLocalColors(){ //returns: [name::::path] for each //Format the output entry [<name>::::<fullpath>] list[i] = list[i].section(".qss.",0,0)+"::::"+dir.absoluteFilePath(list[i]); } - return list; + return list; } QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item @@ -130,7 +130,7 @@ bool LTHEME::saveLocalTheme(QString name, QStringList contents){ bool LTHEME::saveLocalColors(QString name, QStringList contents){ QString localdir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/colors/"; if(!QFile::exists(localdir)){ QDir dir; dir.mkpath(localdir); } - return LUtils::writeFile(localdir+name+".qss.colors", contents, true); + return LUtils::writeFile(localdir+name+".qss.colors", contents, true); } //Return the currently selected Theme/Colors/Icons @@ -140,21 +140,23 @@ QStringList LTHEME::currentSettings(){ //returns [theme path, colorspath, iconsn for(int i=0; i<settings.length(); i++){ if(settings[i].startsWith("THEMEFILE=")){ out[0] = settings[i].section("=",1,1).simplified(); } else if(settings[i].startsWith("COLORFILE=")){ out[1] = settings[i].section("=",1,1).simplified(); } - else if(settings[i].startsWith("ICONTHEME=")){ out[2] = settings[i].section("=",1,1).simplified(); } + //else if(settings[i].startsWith("ICONTHEME=")){ out[2] = settings[i].section("=",1,1).simplified(); } else if(settings[i].startsWith("FONTFAMILY=")){ out[3] = settings[i].section("=",1,1).simplified(); } else if(settings[i].startsWith("FONTSIZE=")){ out[4] = settings[i].section("=",1,1).simplified(); } } + QSettings engineset("lthemeengine","lthemeengine"); + out[2]=engineset.value("Appearance/icon_theme", "material-design-light").toString(); bool nofile = settings.isEmpty(); if(out[0].isEmpty() || !QFile::exists(out[0]) ){ out[0] = LOS::LuminaShare()+"themes/Lumina-default.qss.template"; } if(out[1].isEmpty() || !QFile::exists(out[1]) ){ out[1] = LOS::LuminaShare()+"colors/Lumina-Glass.qss.colors"; } if(out[3].isEmpty()){ out[3] = QFont().defaultFamily(); } - if(out[4].isEmpty()){ + if(out[4].isEmpty()){ int num = QFont().pointSize(); out[4] = QString::number(num)+"pt"; //Check point size first if(num<0){ num = QFont().pixelSize(); out[4] = QString::number(num)+"px";} //Now check pixel size if(num<0){ out[4] = "9pt"; } //Now hard-code a fallback (just in case) } if(nofile){ setCurrentSettings(out[0], out[1], out[2], out[3], out[4]); } - + return out; } @@ -178,8 +180,14 @@ QString LTHEME::currentCursor(){ //Change the current Theme/Colors/Icons bool LTHEME::setCurrentSettings(QString themepath, QString colorpath, QString iconname, QString font, QString fontsize){ - QIcon::setThemeName(iconname); - //Now save the theme settings file + //QIcon::setThemeName(iconname); + QSettings engineset("lthemeengine","lthemeengine"); + engineset.setValue("Appearance/icon_theme", iconname); + //engineset.setValue("Appearance/color_scheme_path", colorpath); //re-enable this once the color scheme has been synced with lthemeengine + //Need to add theme path saving here too later + + + //Now save the theme settings file QStringList contents; contents << "THEMEFILE="+themepath; contents << "COLORFILE="+colorpath; @@ -206,13 +214,13 @@ bool LTHEME::setCursorTheme(QString cursorname){ bool changed = false; QString newval = "Inherits="+cursorname; for(int i=0; i<info.length() && !changed; i++){ - if(info[i]=="[Icon Theme]"){ + if(info[i]=="[Icon Theme]"){ insection = true; - }else if( info[i].startsWith("[") && insection){ + }else if( info[i].startsWith("[") && insection){ //Section does not have the setting - add it - info.insert(i, newval); + info.insert(i, newval); changed =true; - }else if( info[i].startsWith("[") ){ + }else if( info[i].startsWith("[") ){ insection = false; }else if(insection && info[i].startsWith("Inherits=")){ info[i] = newval; //replace the current setting |