diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-06-01 01:19:12 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-06-01 01:19:12 +0200 |
commit | 405cea177877234981019c6916f6f97d818dfd51 (patch) | |
tree | 2e1cc92f5bb807836fe8c4ecee98c1015305ce04 /logic/icons | |
parent | 96c497f6542daabeaa67e96e4298df50f65663d0 (diff) | |
download | MultiMC-405cea177877234981019c6916f6f97d818dfd51.tar MultiMC-405cea177877234981019c6916f6f97d818dfd51.tar.gz MultiMC-405cea177877234981019c6916f6f97d818dfd51.tar.lz MultiMC-405cea177877234981019c6916f6f97d818dfd51.tar.xz MultiMC-405cea177877234981019c6916f6f97d818dfd51.zip |
GH-1031 include icon in exported instance if it is custom
Diffstat (limited to 'logic/icons')
-rw-r--r-- | logic/icons/IconList.cpp | 18 | ||||
-rw-r--r-- | logic/icons/IconList.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/logic/icons/IconList.cpp b/logic/icons/IconList.cpp index 40949392..45d39575 100644 --- a/logic/icons/IconList.cpp +++ b/logic/icons/IconList.cpp @@ -261,6 +261,24 @@ void IconList::installIcons(QStringList iconFiles) } } +bool IconList::iconFileExists(QString key) +{ + auto iconEntry = icon(key); + if(!iconEntry) + { + return false; + } + return iconEntry->has(MMCIcon::FileBased); +} + +const MMCIcon *IconList::icon(QString key) +{ + int iconIdx = getIconIndex(key); + if (iconIdx == -1) + return nullptr; + return &icons[iconIdx]; +} + bool IconList::deleteIcon(QString key) { int iconIdx = getIconIndex(key); diff --git a/logic/icons/IconList.h b/logic/icons/IconList.h index 07fb1379..cc2ba5c4 100644 --- a/logic/icons/IconList.h +++ b/logic/icons/IconList.h @@ -43,6 +43,7 @@ public: bool addIcon(QString key, QString name, QString path, MMCIcon::Type type); bool deleteIcon(QString key); + bool iconFileExists(QString key); virtual QStringList mimeTypes() const; virtual Qt::DropActions supportedDropActions() const; @@ -52,6 +53,8 @@ public: void installIcons(QStringList iconFiles); + const MMCIcon * icon(QString key); + void startWatching(); void stopWatching(); |