aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/ResourceModel.h
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2023-06-14 20:05:02 +0100
committerGitHub <noreply@github.com>2023-06-14 20:05:02 +0100
commit3526d00a2330aad7d01f345816505c4d1cd5b096 (patch)
tree31b34c829f21ef6f49bc3dda6bd1fc6b55ac7029 /launcher/ui/pages/modplatform/ResourceModel.h
parent79ce7eb1fc9351e689e7106e3dc3a641d9614c9a (diff)
parenta4502f44c291fad2174e84bf883cdb754aa08e28 (diff)
downloadPrismLauncher-3526d00a2330aad7d01f345816505c4d1cd5b096.tar.gz
PrismLauncher-3526d00a2330aad7d01f345816505c4d1cd5b096.tar.bz2
PrismLauncher-3526d00a2330aad7d01f345816505c4d1cd5b096.zip
Merge branch 'develop' into feat/dont-hide-settings
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/pages/modplatform/ResourceModel.h')
-rw-r--r--launcher/ui/pages/modplatform/ResourceModel.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/launcher/ui/pages/modplatform/ResourceModel.h b/launcher/ui/pages/modplatform/ResourceModel.h
index 46a02d6e..69e23473 100644
--- a/launcher/ui/pages/modplatform/ResourceModel.h
+++ b/launcher/ui/pages/modplatform/ResourceModel.h
@@ -10,6 +10,7 @@
#include "QObjectPtr.h"
+#include "ResourceDownloadTask.h"
#include "modplatform/ResourceAPI.h"
#include "tasks/ConcurrentTask.h"
@@ -29,6 +30,8 @@ class ResourceModel : public QAbstractListModel {
Q_PROPERTY(QString search_term MEMBER m_search_term WRITE setSearchTerm)
public:
+ using DownloadTaskPtr = shared_qobject_ptr<ResourceDownloadTask>;
+
ResourceModel(ResourceAPI* api);
~ResourceModel() override;
@@ -80,6 +83,14 @@ class ResourceModel : public QAbstractListModel {
/** Gets the icon at the URL for the given index. If it's not fetched yet, fetch it and update when fisinhed. */
std::optional<QIcon> getIcon(QModelIndex&, const QUrl&);
+ void addPack(ModPlatform::IndexedPack::Ptr pack,
+ ModPlatform::IndexedVersion& version,
+ const std::shared_ptr<ResourceFolderModel> packs,
+ bool is_indexed = false,
+ QString custom_target_folder = {});
+ void removePack(const QString& rem);
+ QList<DownloadTaskPtr> selectedPacks() { return m_selected; }
+
protected:
/** Resets the model's data. */
void clearData();
@@ -123,7 +134,8 @@ class ResourceModel : public QAbstractListModel {
QSet<QUrl> m_currently_running_icon_actions;
QSet<QUrl> m_failed_icon_actions;
- QList<ModPlatform::IndexedPack> m_packs;
+ QList<ModPlatform::IndexedPack::Ptr> m_packs;
+ QList<DownloadTaskPtr> m_selected;
// HACK: We need this to prevent callbacks from calling the model after it has already been deleted.
// This leaks a tiny bit of memory per time the user has opened a resource dialog. How to make this better?