summaryrefslogtreecommitdiffstats
path: root/application/pages/modplatform/FtbListModel.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2019-11-03 23:48:12 +0100
committerPetr Mrázek <peterix@gmail.com>2019-11-03 23:48:12 +0100
commit47ed2f48d4a118876263f37b9fe2ab8911c2a8fe (patch)
tree3caa2000d3fe9f57a82757dec2ae138e7474c499 /application/pages/modplatform/FtbListModel.h
parent0c9340a3d2e32223a9097f95b92b11045aaec845 (diff)
downloadMultiMC-47ed2f48d4a118876263f37b9fe2ab8911c2a8fe.tar
MultiMC-47ed2f48d4a118876263f37b9fe2ab8911c2a8fe.tar.gz
MultiMC-47ed2f48d4a118876263f37b9fe2ab8911c2a8fe.tar.lz
MultiMC-47ed2f48d4a118876263f37b9fe2ab8911c2a8fe.tar.xz
MultiMC-47ed2f48d4a118876263f37b9fe2ab8911c2a8fe.zip
NOISSUE put legacy FTB support in a namespace, fix its base URL
Diffstat (limited to 'application/pages/modplatform/FtbListModel.h')
-rw-r--r--application/pages/modplatform/FtbListModel.h74
1 files changed, 0 insertions, 74 deletions
diff --git a/application/pages/modplatform/FtbListModel.h b/application/pages/modplatform/FtbListModel.h
deleted file mode 100644
index 34749b24..00000000
--- a/application/pages/modplatform/FtbListModel.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#pragma once
-
-#include <modplatform/ftb/PackHelpers.h>
-#include <RWStorage.h>
-
-#include <QAbstractListModel>
-#include <QSortFilterProxyModel>
-#include <QThreadPool>
-#include <QIcon>
-#include <QStyledItemDelegate>
-
-#include <functional>
-
-typedef QMap<QString, QIcon> FtbLogoMap;
-typedef std::function<void(QString)> LogoCallback;
-
-class FtbFilterModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-public:
- FtbFilterModel(QObject* parent = Q_NULLPTR);
- enum Sorting {
- ByName,
- ByGameVersion
- };
- const QMap<QString, Sorting> getAvailableSortings();
- QString translateCurrentSorting();
- void setSorting(Sorting sorting);
- Sorting getCurrentSorting();
-
-protected:
- bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
-
-private:
- QMap<QString, Sorting> sortings;
- Sorting currentSorting;
-
-};
-
-class FtbListModel : public QAbstractListModel
-{
- Q_OBJECT
-private:
- FtbModpackList modpacks;
- QStringList m_failedLogos;
- QStringList m_loadingLogos;
- FtbLogoMap m_logoMap;
- QMap<QString, LogoCallback> waitingCallbacks;
-
- void requestLogo(QString file);
- QString translatePackType(FtbPackType type) const;
-
-
-private slots:
- void logoFailed(QString logo);
- void logoLoaded(QString logo, QIcon out);
-
-public:
- FtbListModel(QObject *parent);
- ~FtbListModel();
- int rowCount(const QModelIndex &parent) const override;
- int columnCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role) const override;
- Qt::ItemFlags flags(const QModelIndex &index) const override;
-
- void fill(FtbModpackList modpacks);
- void addPack(FtbModpack modpack);
- void clear();
- void remove(int row);
-
- FtbModpack at(int row);
- void getLogo(const QString &logo, LogoCallback callback);
-};