2022-06-04 05:56:26 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "minecraft/mod/Mod.h"
|
|
|
|
#include "modplatform/ModAPI.h"
|
|
|
|
#include "modplatform/ModIndex.h"
|
|
|
|
#include "tasks/Task.h"
|
|
|
|
|
|
|
|
class ModDownloadTask;
|
|
|
|
class ModFolderModel;
|
|
|
|
|
|
|
|
class CheckUpdateTask : public Task {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CheckUpdateTask(std::list<Mod>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder)
|
2022-06-16 20:15:29 +05:30
|
|
|
: Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders(loaders), m_mods_folder(mods_folder) {};
|
2022-06-04 05:56:26 +05:30
|
|
|
|
|
|
|
struct UpdatableMod {
|
|
|
|
QString name;
|
|
|
|
QString old_hash;
|
|
|
|
QString old_version;
|
|
|
|
QString new_version;
|
|
|
|
QString changelog;
|
|
|
|
ModPlatform::Provider provider;
|
|
|
|
ModDownloadTask* download;
|
|
|
|
|
|
|
|
public:
|
|
|
|
UpdatableMod(QString name, QString old_h, QString old_v, QString new_v, QString changelog, ModPlatform::Provider p, ModDownloadTask* t)
|
|
|
|
: name(name), old_hash(old_h), old_version(old_v), new_version(new_v), changelog(changelog), provider(p), download(t)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
auto getUpdatable() -> std::vector<UpdatableMod>&& { return std::move(m_updatable); }
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
bool abort() override = 0;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void executeTask() override = 0;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void checkFailed(Mod failed, QString reason, QUrl recover_url = {});
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::list<Mod>& m_mods;
|
|
|
|
std::list<Version>& m_game_versions;
|
|
|
|
ModAPI::ModLoaderTypes m_loaders;
|
|
|
|
std::shared_ptr<ModFolderModel> m_mods_folder;
|
|
|
|
|
|
|
|
std::vector<UpdatableMod> m_updatable;
|
|
|
|
};
|