diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-07-25 19:11:59 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-07-25 19:50:44 +0200 |
commit | 20b9f2b42a3b58b6081af271774fbcc34025dccb (patch) | |
tree | 064fa59facb3357139b47bd4e60bfc8edb35ca11 /api/logic/icons | |
parent | dd133680858351e3e07690e286882327a4f42ba5 (diff) | |
download | PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.tar.gz PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.tar.bz2 PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.zip |
NOISSUE Flatten gui and logic libraries into MultiMC
Diffstat (limited to 'api/logic/icons')
-rw-r--r-- | api/logic/icons/IIconList.cpp | 7 | ||||
-rw-r--r-- | api/logic/icons/IIconList.h | 26 | ||||
-rw-r--r-- | api/logic/icons/IconUtils.cpp | 62 | ||||
-rw-r--r-- | api/logic/icons/IconUtils.h | 14 |
4 files changed, 0 insertions, 109 deletions
diff --git a/api/logic/icons/IIconList.cpp b/api/logic/icons/IIconList.cpp deleted file mode 100644 index b3a8fb43..00000000 --- a/api/logic/icons/IIconList.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "IIconList.h" - -// blargh -IIconList::~IIconList() -{ -} - diff --git a/api/logic/icons/IIconList.h b/api/logic/icons/IIconList.h deleted file mode 100644 index 9a3fe022..00000000 --- a/api/logic/icons/IIconList.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include <QString> -#include <QStringList> -#include "multimc_logic_export.h" - -enum IconType : unsigned -{ - Builtin, - Transient, - FileBased, - ICONS_TOTAL, - ToBeDeleted -}; - -class MULTIMC_LOGIC_EXPORT IIconList -{ -public: - virtual ~IIconList(); - virtual bool addIcon(const QString &key, const QString &name, const QString &path, const IconType type) = 0; - virtual bool deleteIcon(const QString &key) = 0; - 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; -}; diff --git a/api/logic/icons/IconUtils.cpp b/api/logic/icons/IconUtils.cpp deleted file mode 100644 index bf530c16..00000000 --- a/api/logic/icons/IconUtils.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "IconUtils.h" - -#include "FileSystem.h" -#include <QDirIterator> - -#include <array> - -namespace { -std::array<const char *, 6> validIconExtensions = {{ - "svg", - "png", - "ico", - "gif", - "jpg", - "jpeg" -}}; -} - -namespace IconUtils{ - -QString findBestIconIn(const QString &folder, const QString & iconKey) { - int best_found = validIconExtensions.size(); - QString best_filename; - - QDirIterator it(folder, QDir::NoDotAndDotDot | QDir::Files, QDirIterator::NoIteratorFlags); - while (it.hasNext()) { - it.next(); - auto fileInfo = it.fileInfo(); - - if(fileInfo.completeBaseName() != iconKey) - continue; - - auto extension = fileInfo.suffix(); - - for(int i = 0; i < best_found; i++) { - if(extension == validIconExtensions[i]) { - best_found = i; - qDebug() << i << " : " << fileInfo.fileName(); - best_filename = fileInfo.fileName(); - } - } - } - return FS::PathCombine(folder, best_filename); -} - -QString getIconFilter() { - QString out; - QTextStream stream(&out); - stream << '('; - for(size_t i = 0; i < validIconExtensions.size() - 1; i++) { - if(i > 0) { - stream << " "; - } - stream << "*." << validIconExtensions[i]; - } - stream << " *." << validIconExtensions[validIconExtensions.size() - 1]; - stream << ')'; - return out; -} - -} - diff --git a/api/logic/icons/IconUtils.h b/api/logic/icons/IconUtils.h deleted file mode 100644 index ce236946..00000000 --- a/api/logic/icons/IconUtils.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include <QString> -#include "multimc_logic_export.h" - -namespace IconUtils { - -// Given a folder and an icon key, find 'best' of the icons with the given key in there and return its path -MULTIMC_LOGIC_EXPORT QString findBestIconIn(const QString &folder, const QString & iconKey); - -// Get icon file type filter for file browser dialogs -MULTIMC_LOGIC_EXPORT QString getIconFilter(); - -} |