aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/ResourceModel.h
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-05-04 22:35:16 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-05-04 22:35:16 +0300
commit8b14b946e248c327046777eb2ed494170452f108 (patch)
treeaa19e6bffe19775623ada24e38d724031480f40a /launcher/ui/pages/modplatform/ResourceModel.h
parentf7b912fc9d804902a725fa903be8574e1e202f69 (diff)
parente4449a0ba32593b4fd76e3f2ced176e5b3bbd952 (diff)
downloadPrismLauncher-8b14b946e248c327046777eb2ed494170452f108.tar.gz
PrismLauncher-8b14b946e248c327046777eb2ed494170452f108.tar.bz2
PrismLauncher-8b14b946e248c327046777eb2ed494170452f108.zip
Merge branch 'Fix_Assert' of github.com:Trial97/PrismLauncher into develop
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/ui/pages/modplatform/ResourceModel.h')
-rw-r--r--launcher/ui/pages/modplatform/ResourceModel.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/launcher/ui/pages/modplatform/ResourceModel.h b/launcher/ui/pages/modplatform/ResourceModel.h
index 5eb63901..735d1687 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,8 +83,13 @@ 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& add) { m_selected.append(add); }
- void removePack(QString& rem);
+ void addPack(ModPlatform::IndexedPack& 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. */
@@ -127,7 +135,7 @@ class ResourceModel : public QAbstractListModel {
QSet<QUrl> m_failed_icon_actions;
QList<ModPlatform::IndexedPack> m_packs;
- QList<ModPlatform::IndexedPack> m_selected;
+ 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?