diff options
author | Janrupf <werbung.janrupf@t-online.de> | 2018-04-07 16:15:58 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2018-04-07 22:09:19 +0200 |
commit | 7e1c5d439a2ef6ce1346a3581776f58508a22afe (patch) | |
tree | ed9e037feaee01e100cee36369274492155a8833 /api | |
parent | 38ed0c2a1ff5839cc5b7a1addd25932a7c88b4de (diff) | |
download | MultiMC-7e1c5d439a2ef6ce1346a3581776f58508a22afe.tar MultiMC-7e1c5d439a2ef6ce1346a3581776f58508a22afe.tar.gz MultiMC-7e1c5d439a2ef6ce1346a3581776f58508a22afe.tar.lz MultiMC-7e1c5d439a2ef6ce1346a3581776f58508a22afe.tar.xz MultiMC-7e1c5d439a2ef6ce1346a3581776f58508a22afe.zip |
#2228, #2229 - Auto import pack icons and fixed to big version selection - Closes #2228, Closes #2229
Diffstat (limited to 'api')
-rw-r--r-- | api/gui/icons/IconList.cpp | 11 | ||||
-rw-r--r-- | api/gui/icons/IconList.h | 1 | ||||
-rw-r--r-- | api/logic/icons/IIconList.h | 1 |
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; }; |