summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/gui/icons/IconList.cpp11
-rw-r--r--api/gui/icons/IconList.h1
-rw-r--r--api/logic/icons/IIconList.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/api/gui/icons/IconList.cpp b/api/gui/icons/IconList.cpp
index 5c2c1386..997a03db 100644
--- a/api/gui/icons/IconList.cpp
+++ b/api/gui/icons/IconList.cpp
@@ -269,6 +269,17 @@ void IconList::installIcons(const QStringList &iconFiles)
}
}
+void IconList::installIcon(const QString &file, const QString &name)
+{
+ QFileInfo fileinfo(file);
+ if(!fileinfo.isReadable() || !fileinfo.isFile())
+ return;
+
+ QString target = FS::PathCombine(m_dir.dirName(), name);
+
+ QFile::copy(file, target);
+}
+
bool IconList::iconFileExists(const QString &key) const
{
auto iconEntry = icon(key);
diff --git a/api/gui/icons/IconList.h b/api/gui/icons/IconList.h
index b8599103..fad3336f 100644
--- a/api/gui/icons/IconList.h
+++ b/api/gui/icons/IconList.h
@@ -56,6 +56,7 @@ public:
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
void installIcons(const QStringList &iconFiles) override;
+ void installIcon(const QString &file, const QString &name) override;
const MMCIcon * icon(const QString &key) const;
diff --git a/api/logic/icons/IIconList.h b/api/logic/icons/IIconList.h
index ebf99d05..e6c16d50 100644
--- a/api/logic/icons/IIconList.h
+++ b/api/logic/icons/IIconList.h
@@ -22,4 +22,5 @@ public:
virtual void saveIcon(const QString &key, const QString &path, const char * format) const = 0;
virtual bool iconFileExists(const QString &key) const = 0;
virtual void installIcons(const QStringList &iconFiles) = 0;
+ virtual void installIcon(const QString &file, const QString &name) = 0;
};