From 405cea177877234981019c6916f6f97d818dfd51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 1 Jun 2015 01:19:12 +0200 Subject: GH-1031 include icon in exported instance if it is custom --- logic/icons/IconList.cpp | 18 ++++++++++++++++++ logic/icons/IconList.h | 3 +++ 2 files changed, 21 insertions(+) (limited to 'logic/icons') 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(); -- cgit v1.2.3