#pragma once #include "BaseInstance.h" #include "ResourceDownloadTask.h" #include "ReviewMessageBox.h" #include "minecraft/mod/ModFolderModel.h" #include "modplatform/CheckUpdateTask.h" class Mod; class ModrinthCheckUpdate; class FlameCheckUpdate; class ConcurrentTask; class ResourceUpdateDialog final : public ReviewMessageBox { Q_OBJECT public: explicit ResourceUpdateDialog(QWidget* parent, BaseInstance* instance, std::shared_ptr resourceModel, QList& searchFor, bool includeDeps, QList loadersList = {}); void checkCandidates(); void appendResource(const CheckUpdateTask::Update& info, QStringList requiredBy = {}); const QList getTasks(); auto indexDir() const -> QDir { return m_resourceModel->indexDir(); } auto noUpdates() const -> bool { return m_noUpdates; }; auto aborted() const -> bool { return m_aborted; }; private: auto ensureMetadata() -> bool; private slots: void onMetadataEnsured(Resource* resource); void onMetadataFailed(Resource* resource, bool try_others = false, ModPlatform::ResourceProvider firstChoice = ModPlatform::ResourceProvider::MODRINTH); private: QWidget* m_parent; shared_qobject_ptr m_modrinthCheckTask; shared_qobject_ptr m_flameCheckTask; const std::shared_ptr m_resourceModel; QList& m_candidates; QList m_modrinthToUpdate; QList m_flameToUpdate; ConcurrentTask::Ptr m_secondTryMetadata; QList> m_failedMetadata; QList> m_failedCheckUpdate; QHash m_tasks; BaseInstance* m_instance; bool m_noUpdates = false; bool m_aborted = false; bool m_includeDeps = false; QList m_loadersList; };