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.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/launcher/ui/pages/modplatform/ResourceModel.h b/launcher/ui/pages/modplatform/ResourceModel.h
index facff91d..5f9ce36d 100644
--- a/launcher/ui/pages/modplatform/ResourceModel.h
+++ b/launcher/ui/pages/modplatform/ResourceModel.h
@@ -40,8 +40,9 @@ class ResourceModel : public QAbstractListModel {
[[nodiscard]] inline int columnCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : 1; }
[[nodiscard]] inline auto flags(const QModelIndex& index) const -> Qt::ItemFlags override { return QAbstractListModel::flags(index); }
- 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; }
+ [[nodiscard]] bool hasActiveSearchJob() const { return m_current_search_job && m_current_search_job->isRunning(); }
+ [[nodiscard]] bool hasActiveInfoJob() const { return m_current_info_job.isRunning(); }
+ [[nodiscard]] Task::Ptr activeSearchJob() { return hasActiveSearchJob() ? m_current_search_job : nullptr; }
[[nodiscard]] auto getSortingMethods() const { return m_api->getSortingMethods(); }
@@ -80,6 +81,9 @@ class ResourceModel : public QAbstractListModel {
/** Resets the model's data. */
void clearData();
+ void runSearchJob(NetJob::Ptr);
+ void runInfoJob(Task::Ptr);
+
protected:
const BaseInstance& m_base_instance;
@@ -91,7 +95,10 @@ class ResourceModel : public QAbstractListModel {
std::unique_ptr<ResourceAPI> m_api;
- ConcurrentTask m_current_job;
+ // Job for searching for new entries
+ shared_qobject_ptr<NetJob> m_current_search_job;
+ // Job for fetching versions and extra info on existing entries
+ ConcurrentTask m_current_info_job;
shared_qobject_ptr<NetJob> m_current_icon_job;
QSet<QUrl> m_currently_running_icon_actions;