2022-07-08 05:40:41 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "InstanceCreationTask.h"
|
|
|
|
|
2022-08-01 04:20:09 +05:30
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include "minecraft/MinecraftInstance.h"
|
|
|
|
|
2022-07-08 05:40:41 +05:30
|
|
|
#include "modplatform/modrinth/ModrinthPackManifest.h"
|
|
|
|
|
|
|
|
#include "net/NetJob.h"
|
|
|
|
|
|
|
|
class ModrinthCreationTask final : public InstanceCreationTask {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-12-03 18:45:38 +05:30
|
|
|
ModrinthCreationTask(QString staging_path,
|
|
|
|
SettingsObjectPtr global_settings,
|
|
|
|
QWidget* parent,
|
|
|
|
QString id,
|
|
|
|
QString version_id = {},
|
|
|
|
QString original_instance_id = {})
|
|
|
|
: InstanceCreationTask()
|
|
|
|
, m_parent(parent)
|
|
|
|
, m_managed_id(std::move(id))
|
|
|
|
, m_managed_version_id(std::move(version_id))
|
2022-07-08 05:40:41 +05:30
|
|
|
{
|
|
|
|
setStagingPath(staging_path);
|
|
|
|
setParentSettings(global_settings);
|
2022-12-03 18:45:38 +05:30
|
|
|
|
|
|
|
m_original_instance_id = std::move(original_instance_id);
|
2022-07-08 05:40:41 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
bool abort() override;
|
|
|
|
|
|
|
|
bool updateInstance() override;
|
|
|
|
bool createInstance() override;
|
|
|
|
|
|
|
|
private:
|
2022-12-17 21:04:27 +05:30
|
|
|
bool parseManifest(const QString&, std::vector<Modrinth::File>&, bool set_internal_data = true, bool show_optional_dialog = true);
|
2022-07-08 05:40:41 +05:30
|
|
|
|
|
|
|
private:
|
|
|
|
QWidget* m_parent = nullptr;
|
|
|
|
|
|
|
|
QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion;
|
|
|
|
QString m_managed_id, m_managed_version_id, m_managed_name;
|
|
|
|
|
|
|
|
std::vector<Modrinth::File> m_files;
|
|
|
|
NetJob::Ptr m_files_job;
|
2022-08-01 04:20:09 +05:30
|
|
|
|
|
|
|
std::optional<InstancePtr> m_instance;
|
2022-07-08 05:40:41 +05:30
|
|
|
};
|