aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-09-21 13:45:33 -0400
committerKen Moore <ken@ixsystems.com>2017-09-21 13:45:33 -0400
commit8ada7303ef98d97b0da1d8cd05c4ad32d43bb858 (patch)
tree86fbb10c04d62323c4517df6834e6b10361fcf38 /src-qt5/core
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-8ada7303ef98d97b0da1d8cd05c4ad32d43bb858.tar.gz
lumina-8ada7303ef98d97b0da1d8cd05c4ad32d43bb858.tar.bz2
lumina-8ada7303ef98d97b0da1d8cd05c4ad32d43bb858.zip
Fix up the application of theme settings from the system config file.
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.cpp13
-rw-r--r--src-qt5/core/libLumina/LuminaThemes.cpp56
-rw-r--r--src-qt5/core/libLumina/LuminaThemes.h8
-rw-r--r--src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf2
-rw-r--r--src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf2
5 files changed, 38 insertions, 43 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp
index 54e660e6..9b7ee6d0 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.cpp
+++ b/src-qt5/core/libLumina/LDesktopUtils.cpp
@@ -401,7 +401,7 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
QStringList syscolors = LTHEME::availableSystemColors();
//theme file
//qDebug() << "Detected Themes/colors:" << systhemes << syscolors;
- if( !themesettings[0].startsWith("/") || !QFile::exists(themesettings[0]) || !themesettings[0].endsWith(".qss.template")){
+ if( !themesettings[0].startsWith("/") || !QFile::exists(themesettings[0]) || !themesettings[0].endsWith(".qss")){
themesettings[0] = themesettings[0].section(".qss",0,0).simplified();
for(int i=0; i<systhemes.length(); i++){
if(systhemes[i].startsWith(themesettings[0]+"::::",Qt::CaseInsensitive)){
@@ -411,9 +411,9 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
}
}
//color file
- if( !themesettings[1].startsWith("/") || !QFile::exists(themesettings[1]) || !themesettings[1].endsWith(".qss.colors") ){
+ if( !themesettings[1].startsWith("/") || !QFile::exists(themesettings[1]) || !themesettings[1].endsWith(".conf") ){
//Remove any extra/invalid extension
- themesettings[1] = themesettings[1].section(".qss",0,0).simplified();
+ themesettings[1] = themesettings[1].section(".conf",0,0).simplified();
for(int i=0; i<syscolors.length(); i++){
if(syscolors[i].startsWith(themesettings[1]+"::::",Qt::CaseInsensitive)){
themesettings[1] = syscolors[i].section("::::",1,1); //Replace with the full path
@@ -434,13 +434,6 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
//Now save the settings files
if(setTheme){
LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]);
- QSettings themeset("lthemeengine","lthemeengine");
- themeset.setValue("Appearance/icon_theme",themesettings[2]);
- //Quick hack for a "dark" theme/color to be uniform across the desktop/applications
- if(themesettings[0].contains("DarkGlass") || themesettings[1].contains("Black")){
- themeset.setValue("Appearance/custom_palette", true);
- themeset.setValue("Appearance/color_scheme_path", LOS::LuminaShare().section("/",0,-3)+"/lthemeengine/colors/darker.conf");
- }
}
LUtils::writeFile(setdir+"/sessionsettings.conf", sesset, true);
LUtils::writeFile(setdir+"/desktopsettings.conf", deskset, true);
diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp
index ddbc7b37..f6868651 100644
--- a/src-qt5/core/libLumina/LuminaThemes.cpp
+++ b/src-qt5/core/libLumina/LuminaThemes.cpp
@@ -25,42 +25,42 @@
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);
+ QDir dir(LOS::LuminaShare()+"../lthemeengine/desktop_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]);
+ 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"))+"/lumina-desktop/themes");
- QStringList list = dir.entryList(QStringList() <<"*.qss.template", QDir::Files, QDir::Name);
+ QDir dir( QString(getenv("XDG_CONFIG_HOME"))+"/lthemeengine/desktop_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]);
+ 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()+"colors");
- QStringList list = dir.entryList(QStringList() <<"*.qss.colors", QDir::Files, QDir::Name);
+ QDir dir(LOS::LuminaShare()+"../lthemeengine/colors");
+ QStringList list = dir.entryList(QStringList() <<"*.conf", 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]);
+ list[i] = list[i].section(".conf",0,0)+"::::"+dir.absoluteFilePath(list[i]);
}
return list;
}
QStringList LTHEME::availableLocalColors(){ //returns: [name::::path] for each item
- QDir dir(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/colors");
- QStringList list = dir.entryList(QStringList() <<"*.qss.colors", QDir::Files, QDir::Name);
+ QDir dir(QString(getenv("XDG_CONFIG_HOME"))+"/lthemeengine/colors");
+ QStringList list = dir.entryList(QStringList() <<"*.conf", 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]);
+ list[i] = list[i].section(".conf",0,0)+"::::"+dir.absoluteFilePath(list[i]);
}
return list;
}
@@ -122,15 +122,17 @@ QStringList LTHEME::availableSystemCursors(){ //returns: [name] for each item
//Save a new theme/color file
bool LTHEME::saveLocalTheme(QString name, QStringList contents){
- QString localdir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/themes/";
- if(!QFile::exists(localdir)){ QDir dir; dir.mkpath(localdir); }
- return LUtils::writeFile(localdir+name+".qss.template", contents, true);
+ return false; //old format - do not use!!
+ //QString localdir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/themes/";
+ //if(!QFile::exists(localdir)){ QDir dir; dir.mkpath(localdir); }
+ //return LUtils::writeFile(localdir+name+".qss.template", contents, true);
}
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 false; //old format - do not use!!
+ // 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 the currently selected Theme/Colors/Icons
@@ -181,22 +183,22 @@ 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);
+ //Save these settings into the theme engine settings
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
-
-
+ engineset.setValue("Appearance/custom_palette", QFile::exists(colorpath) );
+ engineset.setValue("Appearance/color_scheme_path", colorpath);
+ engineset.setValue("Interface/desktop_stylesheets", QStringList() << themepath);
+ return true;
//Now save the theme settings file
- QStringList contents;
+ /*QStringList contents;
contents << "THEMEFILE="+themepath;
contents << "COLORFILE="+colorpath;
contents << "ICONTHEME="+iconname;
contents << "FONTFAMILY="+font;
contents << "FONTSIZE="+fontsize;
bool ok = LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/themesettings.cfg", contents, true);
-
- return ok;
+ return ok;*/
}
//Change the current Cursor Theme
@@ -299,13 +301,13 @@ QStringList LTHEME::cursorInformation(QString name){
}
}
return out;
-}
+}
QStringList LTHEME::CustomEnvSettings(bool useronly){ //view all the key=value settings
QStringList newinfo;
if(!useronly){
QStringList sysfiles; sysfiles << L_ETCDIR+"/lumina_environment.conf" << LOS::LuminaShare()+"lumina_environment.conf";
- for(int i=0; i<sysfiles.length() && newinfo.isEmpty(); i++){
+ for(int i=0; i<sysfiles.length() && newinfo.isEmpty(); i++){
newinfo << LUtils::readFile(sysfiles[i]);
}
}
diff --git a/src-qt5/core/libLumina/LuminaThemes.h b/src-qt5/core/libLumina/LuminaThemes.h
index 39602f58..ca79e0bd 100644
--- a/src-qt5/core/libLumina/LuminaThemes.h
+++ b/src-qt5/core/libLumina/LuminaThemes.h
@@ -34,7 +34,7 @@ public:
//Save a new theme/color file
static bool saveLocalTheme(QString name, QStringList contents);
static bool saveLocalColors(QString name, QStringList contents);
-
+
//Return the currently selected Theme/Colors/Icons
static QStringList currentSettings(); //returns [theme path, colorspath, iconsname, font, fontsize]
static QString currentCursor(); //returns: current cursor theme name
@@ -45,16 +45,16 @@ public:
//Return the complete stylesheet for a given theme/colors
static QString assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize);
-
+
//Additional info for a cursor theme
static QStringList cursorInformation(QString name); //returns: [Name, Comment, Sample Image File]
-
+
//Environment settings
static QStringList CustomEnvSettings(bool useronly = false); //view all the key=value settings
static void LoadCustomEnvSettings(); //will push the custom settings into the environment (recommended before loading the initial QApplication)
static bool setCustomEnvSetting(QString var, QString val); //variable/value pair (use an empty val to clear it)
static QString readCustomEnvSetting(QString var);
-
+
};
// Qt Style override to allow custom themeing/colors
diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf
index e453c0b8..e9520a3c 100644
--- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf
+++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf
@@ -53,7 +53,7 @@ mime_default_application/x-tar_ifexists=lumina-archiver.desktop
#THEME SETTINGS
theme_themefile=DarkGlass #Name of the theme to use (disable for Lumina-Default)
-theme_colorfile=Black #Name of the color spec file to use for theming
+theme_colorfile=darker #Name of the color spec file to use for theming
theme_iconset=material-design-dark #Name of the icon theme to use
theme_font=Noto Sans #Name of the font family to use
theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (<number>%) )
diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
index 1327f148..40ece4f0 100644
--- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
+++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
@@ -51,7 +51,7 @@ mime_default_application/x-shellscript=lumina-textedit.desktop
#THEME SETTINGS
theme_themefile=DarkGlass #Name of the theme to use (disable for Lumina-Default)
-theme_colorfile=Black #Name of the color spec file to use for theming
+theme_colorfile=darker #Name of the color spec file to use for theming
theme_iconset=material-design-dark #Name of the icon theme to use
theme_font=Arial #Name of the font family to use
theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (<number>%) )
bgstack15