diff options
author | q5sys <jt@obs-sec.com> | 2017-07-31 10:46:20 -0400 |
---|---|---|
committer | q5sys <jt@obs-sec.com> | 2017-07-31 10:46:20 -0400 |
commit | ea6f15b08ce9d4218c3fdda33a11c4b1869f6a50 (patch) | |
tree | ef9c881a35cd678a26d95f2fca5698a1e6870c4c /src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp | |
parent | Merge branch 'master' of https://github.com/trueos/lumina (diff) | |
download | lumina-ea6f15b08ce9d4218c3fdda33a11c4b1869f6a50.tar.gz lumina-ea6f15b08ce9d4218c3fdda33a11c4b1869f6a50.tar.bz2 lumina-ea6f15b08ce9d4218c3fdda33a11c4b1869f6a50.zip |
bring bracket sanity to a wasteland of if statements
Diffstat (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp')
-rw-r--r-- | src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp index 979c8c43..36b0c2fa 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp @@ -25,19 +25,16 @@ QStringList lthemeengine::iconPaths(){ paths << "/usr/local/share/icons"; } else{ - foreach (QString p, xdgDataDirs.split(":")) - paths << QDir(p + "/icons/").absolutePath(); + foreach (QString p, xdgDataDirs.split(":")){ paths << QDir(p + "/icons/").absolutePath(); } + } + if(xdgDataHome.isEmpty()){ xdgDataHome = QDir::homePath() + "/.local/share"; } + paths << "/usr/share/pixmaps"; + paths << xdgDataHome + "/icons"; + paths.removeDuplicates(); + //remove invalid + foreach (QString p, paths){ + if(!QDir(p).exists()){ paths.removeAll(p); } } - if(xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + "/.local/share"; - paths << "/usr/share/pixmaps"; - paths << xdgDataHome + "/icons"; - paths.removeDuplicates(); - //remove invalid - foreach (QString p, paths){ - if(!QDir(p).exists()) - paths.removeAll(p); - } return paths; } @@ -49,12 +46,8 @@ QStringList lthemeengine::sharedStyleSheetPath(){ QStringList dirs; dirs << QString(getenv("XDG_CONFIG_HOME")); dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; i<dirs.length(); i++){ - dirs[i].append("/lthemeengine/colors/"); - } - if(dirs.isEmpty()){ - dirs << LTHEMEENGINE_DATADIR"/lthemeengine/qss/"; //no XDG settings - use the hardcoded path - } + for(int i=0; i<dirs.length(); i++){ dirs[i].append("/lthemeengine/colors/"); } + if(dirs.isEmpty()){ dirs << LTHEMEENGINE_DATADIR"/lthemeengine/qss/"; } //no XDG settings - use the hardcoded path return dirs; } @@ -66,24 +59,17 @@ QStringList lthemeengine::sharedColorSchemePath(){ QStringList dirs; dirs << QString(getenv("XDG_CONFIG_HOME")); dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; i<dirs.length(); i++){ - dirs[i].append("/lthemeengine/colors/"); - } - if(dirs.isEmpty()){ - dirs << LTHEMEENGINE_DATADIR"/lthemeengine/colors/"; //no XDG settings - use the hardcoded path - } + for(int i=0; i<dirs.length(); i++){ dirs[i].append("/lthemeengine/colors/"); } + if(dirs.isEmpty()){ dirs << LTHEMEENGINE_DATADIR"/lthemeengine/colors/"; } //no XDG settings - use the hardcoded path return dirs; } QString lthemeengine::systemLanguageID(){ #ifdef Q_OS_UNIX QByteArray v = qgetenv ("LC_ALL"); - if (v.isEmpty()) - v = qgetenv ("LC_MESSAGES"); - if (v.isEmpty()) - v = qgetenv ("LANG"); - if (!v.isEmpty()) - return QLocale (v).name(); + if (v.isEmpty()){ v = qgetenv ("LC_MESSAGES"); } + if (v.isEmpty()){ v = qgetenv ("LANG"); } + if (!v.isEmpty()){ return QLocale (v).name(); } #endif return QLocale::system().name(); } |