diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-10 02:54:53 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-10 02:54:53 +0100 |
commit | f9d94a45eebd5fb7b14d4bcc6ad77cb96ecdd771 (patch) | |
tree | 0b8f492b470c835bc814ebc786dc73bfe2b0f3f4 /api/gui/icons/MMCIcon.cpp | |
parent | 27e26a656b8d9f0aef1dd6a18b50ecc9465494bd (diff) | |
download | PrismLauncher-f9d94a45eebd5fb7b14d4bcc6ad77cb96ecdd771.tar.gz PrismLauncher-f9d94a45eebd5fb7b14d4bcc6ad77cb96ecdd771.tar.bz2 PrismLauncher-f9d94a45eebd5fb7b14d4bcc6ad77cb96ecdd771.zip |
NOISSUE allow using icon themes for instances and instance badges
Diffstat (limited to 'api/gui/icons/MMCIcon.cpp')
-rw-r--r-- | api/gui/icons/MMCIcon.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/api/gui/icons/MMCIcon.cpp b/api/gui/icons/MMCIcon.cpp index f71281d0..11ad93e2 100644 --- a/api/gui/icons/MMCIcon.cpp +++ b/api/gui/icons/MMCIcon.cpp @@ -15,6 +15,7 @@ #include "MMCIcon.h" #include <QFileInfo> +#include <xdgicon.h> IconType operator--(IconType &t, int) { @@ -58,7 +59,11 @@ QIcon MMCIcon::icon() const { if (m_current_type == IconType::ToBeDeleted) return QIcon(); - return m_images[m_current_type].icon; + auto & icon = m_images[m_current_type].icon; + if(!icon.isNull()) + return icon; + // FIXME: inject this. + return XdgIcon::fromTheme(m_images[m_current_type].key); } void MMCIcon::remove(IconType rm_type) @@ -78,12 +83,22 @@ void MMCIcon::remove(IconType rm_type) void MMCIcon::replace(IconType new_type, QIcon icon, QString path) { - QFileInfo foo(path); if (new_type > m_current_type || m_current_type == IconType::ToBeDeleted) { m_current_type = new_type; } m_images[new_type].icon = icon; - m_images[new_type].changed = foo.lastModified(); m_images[new_type].filename = path; + m_images[new_type].key = QString(); +} + +void MMCIcon::replace(IconType new_type, const QString& key) +{ + if (new_type > m_current_type || m_current_type == IconType::ToBeDeleted) + { + m_current_type = new_type; + } + m_images[new_type].icon = QIcon(); + m_images[new_type].filename = QString(); + m_images[new_type].key = key; } |