aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/ResourceModel.h
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages/modplatform/ResourceModel.h')
-rw-r--r--launcher/ui/pages/modplatform/ResourceModel.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/launcher/ui/pages/modplatform/ResourceModel.h b/launcher/ui/pages/modplatform/ResourceModel.h
index 6a94c399..af33bf55 100644
--- a/launcher/ui/pages/modplatform/ResourceModel.h
+++ b/launcher/ui/pages/modplatform/ResourceModel.h
@@ -5,6 +5,7 @@
#include <QAbstractListModel>
#include "QObjectPtr.h"
+#include "BaseInstance.h"
#include "modplatform/ResourceAPI.h"
#include "tasks/ConcurrentTask.h"
@@ -17,19 +18,18 @@ struct IndexedPack;
namespace ResourceDownload {
-class ResourcePage;
-
class ResourceModel : public QAbstractListModel {
Q_OBJECT
public:
- ResourceModel(ResourcePage* parent, ResourceAPI* api);
+ ResourceModel(BaseInstance const&, ResourceAPI* api);
~ResourceModel() override;
[[nodiscard]] auto data(const QModelIndex&, int role) const -> QVariant override;
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
- [[nodiscard]] auto debugName() const -> QString;
+ [[nodiscard]] virtual auto debugName() const -> QString;
+ [[nodiscard]] virtual auto metaEntryBase() const -> QString = 0;
[[nodiscard]] inline int rowCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : m_packs.size(); }
[[nodiscard]] inline int columnCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : 1; };
@@ -38,6 +38,10 @@ class ResourceModel : public QAbstractListModel {
inline void addActiveJob(Task::Ptr ptr) { m_current_job.addTask(ptr); if (!m_current_job.isRunning()) m_current_job.start(); }
inline Task const& activeJob() { return m_current_job; }
+ signals:
+ void versionListUpdated();
+ void projectInfoUpdated();
+
public slots:
void fetchMore(const QModelIndex& parent) override;
[[nodiscard]] inline bool canFetchMore(const QModelIndex& parent) const override
@@ -72,9 +76,9 @@ class ResourceModel : public QAbstractListModel {
/** Resets the model's data. */
void clearData();
- [[nodiscard]] bool isPackSelected(const ModPlatform::IndexedPack&) const;
-
protected:
+ const BaseInstance& m_base_instance;
+
/* Basic search parameters */
enum class SearchState { None, CanFetchMore, ResetRequested, Finished } m_search_state = SearchState::None;
int m_next_search_offset = 0;
@@ -88,8 +92,6 @@ class ResourceModel : public QAbstractListModel {
QSet<QUrl> m_currently_running_icon_actions;
QSet<QUrl> m_failed_icon_actions;
- ResourcePage* m_associated_page = nullptr;
-
QList<ModPlatform::IndexedPack> m_packs;
// HACK: We need this to prevent callbacks from calling the model after it has already been deleted.