aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs/ModUpdateDialog.h
diff options
context:
space:
mode:
authorkumquat-ir <66188216+kumquat-ir@users.noreply.github.com>2022-07-18 14:05:23 -0400
committerkumquat-ir <66188216+kumquat-ir@users.noreply.github.com>2022-07-18 14:05:23 -0400
commit20b1723e78149c1f2ac4072cbd46997e9c5160fa (patch)
tree7d97c8bc2edfe5cb41b91e6d04ba36da8aa163e6 /launcher/ui/dialogs/ModUpdateDialog.h
parentbe78afeee54a19cd0115e1d2ec63f3a3201a3940 (diff)
parentdec81c4f274dd8388d442062cf9fa18600aa850d (diff)
downloadPrismLauncher-20b1723e78149c1f2ac4072cbd46997e9c5160fa.tar.gz
PrismLauncher-20b1723e78149c1f2ac4072cbd46997e9c5160fa.tar.bz2
PrismLauncher-20b1723e78149c1f2ac4072cbd46997e9c5160fa.zip
merge origin/develop
Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/dialogs/ModUpdateDialog.h')
-rw-r--r--launcher/ui/dialogs/ModUpdateDialog.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/launcher/ui/dialogs/ModUpdateDialog.h b/launcher/ui/dialogs/ModUpdateDialog.h
new file mode 100644
index 00000000..76aaab36
--- /dev/null
+++ b/launcher/ui/dialogs/ModUpdateDialog.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#include "BaseInstance.h"
+#include "ModDownloadTask.h"
+#include "ReviewMessageBox.h"
+
+#include "minecraft/mod/ModFolderModel.h"
+
+#include "modplatform/CheckUpdateTask.h"
+
+class Mod;
+class ModrinthCheckUpdate;
+class FlameCheckUpdate;
+class ConcurrentTask;
+
+class ModUpdateDialog final : public ReviewMessageBox {
+ Q_OBJECT
+ public:
+ explicit ModUpdateDialog(QWidget* parent,
+ BaseInstance* instance,
+ const std::shared_ptr<ModFolderModel> mod_model,
+ QList<Mod::Ptr>& search_for);
+
+ void checkCandidates();
+
+ void appendMod(const CheckUpdateTask::UpdatableMod& info);
+
+ const QList<ModDownloadTask*> getTasks();
+ auto indexDir() const -> QDir { return m_mod_model->indexDir(); }
+
+ auto noUpdates() const -> bool { return m_no_updates; };
+ auto aborted() const -> bool { return m_aborted; };
+
+ private:
+ auto ensureMetadata() -> bool;
+
+ private slots:
+ void onMetadataEnsured(Mod*);
+ void onMetadataFailed(Mod*, bool try_others = false, ModPlatform::Provider first_choice = ModPlatform::Provider::MODRINTH);
+
+ private:
+ QWidget* m_parent;
+
+ ModrinthCheckUpdate* m_modrinth_check_task = nullptr;
+ FlameCheckUpdate* m_flame_check_task = nullptr;
+
+ const std::shared_ptr<ModFolderModel> m_mod_model;
+
+ QList<Mod::Ptr>& m_candidates;
+ QList<Mod*> m_modrinth_to_update;
+ QList<Mod*> m_flame_to_update;
+
+ ConcurrentTask* m_second_try_metadata;
+ QList<std::tuple<Mod*, QString>> m_failed_metadata;
+ QList<std::tuple<Mod*, QString, QUrl>> m_failed_check_update;
+
+ QHash<QString, ModDownloadTask*> m_tasks;
+ BaseInstance* m_instance;
+
+ bool m_no_updates = false;
+ bool m_aborted = false;
+};