diff options
author | Ken Moore <ken@ixsystems.com> | 2017-08-29 08:26:17 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-08-29 08:26:17 -0400 |
commit | dc193f9adcfbdfef928aa58bad14056a088243e5 (patch) | |
tree | 99b3354007acc004cbe9b18b9ebeed22e550729c /src-qt5 | |
parent | Come more work on compositing. Seems like there is a significant difference b... (diff) | |
download | lumina-dc193f9adcfbdfef928aa58bad14056a088243e5.tar.gz lumina-dc193f9adcfbdfef928aa58bad14056a088243e5.tar.bz2 lumina-dc193f9adcfbdfef928aa58bad14056a088243e5.zip |
Fix up the location/detection of icon/cursor themes. They just changes it upstream to dump all of them in the same directory, so need to be careful about detecting them now.
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LuminaThemes.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp index 85d43925..2d4aab53 100644 --- a/src-qt5/core/libLumina/LuminaThemes.cpp +++ b/src-qt5/core/libLumina/LuminaThemes.cpp @@ -72,7 +72,7 @@ QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item xdd << QString(getenv("XDG_DATA_DIRS")).split(":"); for(int i=0; i<xdd.length(); i++){ if(QFile::exists(xdd[i]+"/icons")){ - paths << xdd[i]+"/icons"; + paths << xdd[i]+"/icons"; } } //Now get all the icon themes in these directories @@ -83,8 +83,8 @@ QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item tmpthemes = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); for(int j=0; j<tmpthemes.length(); j++){ if(tmpthemes[j].startsWith("default")){ continue; } - if(QFile::exists(dir.absoluteFilePath(tmpthemes[j]+"/index.theme")) || - QFile::exists(dir.absoluteFilePath(tmpthemes[j]+"/index.desktop")) ){ themes << tmpthemes[j]; } + if( (QFile::exists(dir.absoluteFilePath(tmpthemes[j]+"/index.theme")) || + QFile::exists(dir.absoluteFilePath(tmpthemes[j]+"/index.desktop")) ) ){ themes << tmpthemes[j]; } } } } @@ -92,21 +92,32 @@ QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item themes.sort(); return themes; } - + QStringList LTHEME::availableSystemCursors(){ //returns: [name] for each item - QStringList paths; paths << LOS::SysPrefix()+"lib/X11/icons/" << LOS::AppPrefix()+"lib/X11/icons/"; - QStringList out; + QStringList paths; + paths << QDir::homePath()+"/.icons"; + QStringList xdd = QString(getenv("XDG_DATA_HOME")).split(":"); + xdd << QString(getenv("XDG_DATA_DIRS")).split(":"); + for(int i=0; i<xdd.length(); i++){ + if(QFile::exists(xdd[i]+"/icons")){ + paths << xdd[i]+"/icons"; + } + } + //Now get all the icon themes in these directories + QStringList themes, tmpthemes; + QDir dir; for(int i=0; i<paths.length(); i++){ - if( !QFile::exists(paths[i]) ){ continue; } - QDir dir(paths[i]); - QStringList tmp = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); - for(int j=0; j<tmp.length(); j++){ - if(QFile::exists(paths[i]+tmp[j]+"/cursors")){ - out << tmp[j]; //good theme - save it to the output list - } + if(dir.cd(paths[i])){ + tmpthemes = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); + for(int j=0; j<tmpthemes.length(); j++){ + if(tmpthemes[j].startsWith("default")){ continue; } + if( QFile::exists(dir.absoluteFilePath(tmpthemes[j]+"/cursors")) ){ themes << tmpthemes[j]; } + } } } - return out; + themes.removeDuplicates(); + themes.sort(); + return themes; } //Save a new theme/color file |