diff options
Diffstat (limited to 'api/gui/icons/IconList.cpp')
-rw-r--r-- | api/gui/icons/IconList.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/api/gui/icons/IconList.cpp b/api/gui/icons/IconList.cpp index 3da0a8ea..5c2c1386 100644 --- a/api/gui/icons/IconList.cpp +++ b/api/gui/icons/IconList.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2017 MultiMC Contributors +/* Copyright 2013-2018 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -261,7 +261,7 @@ void IconList::installIcons(const QStringList &iconFiles) QString target = FS::PathCombine(m_dir.dirName(), fileinfo.fileName()); QString suffix = fileinfo.suffix(); - if (suffix != "jpeg" && suffix != "png" && suffix != "jpg" && suffix != "ico") + if (suffix != "jpeg" && suffix != "png" && suffix != "jpg" && suffix != "ico" && suffix != "svg") continue; if (!QFile::copy(file, target)) @@ -331,7 +331,7 @@ bool IconList::addIcon(const QString &key, const QString &name, const QString &p { // replace the icon even? is the input valid? QIcon icon(path); - if (!icon.availableSizes().size()) + if (icon.isNull()) return false; auto iter = name_index.find(key); if (iter != name_index.end()) @@ -392,20 +392,6 @@ QIcon IconList::getIcon(const QString &key) const return QIcon(); } -QIcon IconList::getBigIcon(const QString &key) const -{ - int icon_index = getIconIndex(key); - - // Fallback for icons that don't exist. - icon_index = getIconIndex(icon_index == -1 ? "infinity" : key); - - if (icon_index == -1) - return QIcon(); - - QPixmap bigone = icons[icon_index].icon().pixmap(256,256).scaled(256,256); - return QIcon(bigone); -} - int IconList::getIconIndex(const QString &key) const { auto iter = name_index.find(key == "default" ? "infinity" : key); @@ -415,4 +401,9 @@ int IconList::getIconIndex(const QString &key) const return -1; } +QString IconList::getDirectory() const +{ + return m_dir.absolutePath(); +} + //#include "IconList.moc" |