diff options
author | Jonathan Bauer | 2016-02-25 14:08:52 +0100 |
---|---|---|
committer | Jonathan Bauer | 2016-02-25 14:08:52 +0100 |
commit | 4c892265db2abaa0be211a940beaed8327b46d9b (patch) | |
tree | 02ff14442ff55859063875107018f464243e120f | |
parent | load icon from the filesystem (if path is set in the xsession file) (diff) | |
download | vmchooser2-4c892265db2abaa0be211a940beaed8327b46d9b.tar.gz vmchooser2-4c892265db2abaa0be211a940beaed8327b46d9b.tar.xz vmchooser2-4c892265db2abaa0be211a940beaed8327b46d9b.zip |
Revert "load icon from the filesystem (if path is set in the xsession file)"
This reverts commit 25960be7c786690c14586f3e873012d45935080f.
-rw-r--r-- | src/sessionsiconholder.cpp | 30 | ||||
-rw-r--r-- | src/sessionsiconholder.h | 1 | ||||
-rw-r--r-- | src/xsession.cpp | 1 |
3 files changed, 9 insertions, 23 deletions
diff --git a/src/sessionsiconholder.cpp b/src/sessionsiconholder.cpp index 076abe8..7cce455 100644 --- a/src/sessionsiconholder.cpp +++ b/src/sessionsiconholder.cpp @@ -62,17 +62,16 @@ QIcon SessionsIconHolder::getIcon(const QString& name) { if (icons.contains(name)) { return icons[name]; } + // else load icon from resource QIcon icon; - icon = getIconFromResource(name); - // if we didn't find any, check filesystem - if (icon.isNull() && QFile::exists(name)) { - icon = QIcon(name); - } - if (icon.isNull()) { - // no cached icon, no icon in ressource, no icon in filesystem - // fallback to linux icon if that works ;-) - icon = getIconFromResource("linux"); + QString resName(":" + name.toLower()); + if (QResource(resName + ".svg").isValid()) { + icon = QIcon(resName + ".svg"); + } else if (QResource(resName).isValid()) { + icon = QIcon(resName); + } else { + icon = QIcon(); } // insert icon to hash table @@ -107,16 +106,3 @@ QIcon SessionsIconHolder::getIcon(const QUrl& url) { return QIcon(); } - -QIcon SessionsIconHolder::getIconFromResource(const QString& name) { - QIcon icon; - QString resName(":" + name.toLower()); - if (QResource(resName + ".svg").isValid()) { - icon = QIcon(resName + ".svg"); - } else if (QResource(resName).isValid()) { - icon = QIcon(resName); - } else { - icon = QIcon(); - } - return icon; -} diff --git a/src/sessionsiconholder.h b/src/sessionsiconholder.h index d220cfe..a13156e 100644 --- a/src/sessionsiconholder.h +++ b/src/sessionsiconholder.h @@ -27,7 +27,6 @@ class SessionsIconHolder : public QObject { private: QHash<QString, QIcon> icons; SessionsIconHolder(); - QIcon getIconFromResource(const QString& name); static SessionsIconHolder* instance; signals: diff --git a/src/xsession.cpp b/src/xsession.cpp index 171493b..ff5de57 100644 --- a/src/xsession.cpp +++ b/src/xsession.cpp @@ -105,6 +105,7 @@ QIcon XSession::icon() const { icon = "linux"; } } + return SessionsIconHolder::get()->getIcon(icon); } |