From 767e04875146b081f0956805fd7d2932304441d0 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 3 Aug 2017 13:36:21 -0400 Subject: Get the icon loading routines all switched over to the old QIcon::fromTheme() routine now that we have a theme engine available out-of-box. --- src-qt5/core/libLumina/LuminaXDG.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src-qt5/core/libLumina/LuminaXDG.cpp') diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index 8da39564..fed998a2 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -723,7 +723,7 @@ QList LXDG::sortDesktopNames(QList apps){ //Sort the list by name of the application QHash sorter; for(int i=0; iname.toLower(), apps[i]); + sorter.insert(apps[i]->name.toLower(), apps[i]); } QStringList keys = sorter.keys(); keys.sort(); @@ -746,16 +746,22 @@ void LXDG::setEnvironmentVars(){ } QIcon LXDG::findIcon(QString iconName, QString fallback){ + //With the addition of the Lumina theme engine (8/3/17), switch back to using the Qt icon from theme method for apps + QIcon tmp = QIcon::fromTheme(iconName); + if(tmp.isNull()){ tmp = QIcon::fromTheme(fallback); } + return tmp; + + //NOTE: This was re-written on 11/10/15 to avoid using the QIcon::fromTheme() framework // -- Too many issues with SVG files and/or search paths with the built-in system - + //Check if the icon is an absolute path and exists bool DEBUG =false; if(DEBUG){ qDebug() << "[LXDG] Find icon for:" << iconName; } if(QFile::exists(iconName) && iconName.startsWith("/")){ return QIcon(iconName); } else if(iconName.startsWith("/")){ iconName.section("/",-1); } //Invalid absolute path, just look for the icon //Check if the icon is actually given - if(iconName.isEmpty()){ + if(iconName.isEmpty()){ if(fallback.isEmpty()){ return QIcon(); } else{ return LXDG::findIcon(fallback, ""); } } @@ -763,9 +769,9 @@ QIcon LXDG::findIcon(QString iconName, QString fallback){ if(DEBUG){ qDebug() << "[LXDG] Start search for icon"; } //Get the currently-set theme QString cTheme = QIcon::themeName(); - if(cTheme.isEmpty()){ - QIcon::setThemeName("material-design-light"); - cTheme = "material-design-light"; + if(cTheme.isEmpty()){ + QIcon::setThemeName("material-design-light"); + cTheme = "material-design-light"; } //Make sure the current search paths correspond to this theme if( QDir::searchPaths("icontheme").filter("/"+cTheme+"/").isEmpty() ){ -- cgit From 4530400268bf9a8749513e69a7bfb574fca20f09 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 3 Aug 2017 14:03:29 -0400 Subject: Cleanup some fallback routines for loading icons from the Qt theme methods. --- src-qt5/core/libLumina/LuminaXDG.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src-qt5/core/libLumina/LuminaXDG.cpp') diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index fed998a2..01b3305e 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -747,9 +747,12 @@ void LXDG::setEnvironmentVars(){ QIcon LXDG::findIcon(QString iconName, QString fallback){ //With the addition of the Lumina theme engine (8/3/17), switch back to using the Qt icon from theme method for apps - QIcon tmp = QIcon::fromTheme(iconName); - if(tmp.isNull()){ tmp = QIcon::fromTheme(fallback); } - return tmp; + QIcon tmp; + if(!iconName.contains("libreoffice")){ //libreoffice is stupid - their svg icons are un-renderable with Qt + tmp = QIcon::fromTheme(iconName); + if(tmp.isNull()){ tmp = QIcon::fromTheme(fallback); } + } + if(!tmp.isNull()){ return tmp; } //found one in the theme //NOTE: This was re-written on 11/10/15 to avoid using the QIcon::fromTheme() framework -- cgit