summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJanrupf <werbung.janrupf@t-online.de>2018-04-07 16:15:58 +0200
committerPetr Mrázek <peterix@gmail.com>2018-04-07 22:09:19 +0200
commit7e1c5d439a2ef6ce1346a3581776f58508a22afe (patch)
treeed9e037feaee01e100cee36369274492155a8833 /api
parent38ed0c2a1ff5839cc5b7a1addd25932a7c88b4de (diff)
downloadMultiMC-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.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;
};