2022-07-08 01:10:41 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "InstanceCreationTask.h"
|
|
|
|
|
2022-07-31 23:50:09 +01:00
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include "minecraft/MinecraftInstance.h"
|
|
|
|
|
2022-07-08 01:10:41 +01:00
|
|
|
#include "modplatform/modrinth/ModrinthPackManifest.h"
|
|
|
|
|
|
|
|
#include "net/NetJob.h"
|
|
|
|
|
|
|
|
class ModrinthCreationTask final : public InstanceCreationTask {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ModrinthCreationTask(QString staging_path, SettingsObjectPtr global_settings, QWidget* parent, QString source_url = {})
|
2022-07-31 23:50:09 +01:00
|
|
|
: InstanceCreationTask(), m_parent(parent), m_source_url(std::move(source_url))
|
2022-07-08 01:10:41 +01:00
|
|
|
{
|
|
|
|
setStagingPath(staging_path);
|
|
|
|
setParentSettings(global_settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool abort() override;
|
|
|
|
|
|
|
|
bool updateInstance() override;
|
|
|
|
bool createInstance() override;
|
|
|
|
|
|
|
|
private:
|
2022-08-01 00:29:12 +01:00
|
|
|
bool parseManifest(QString, std::vector<Modrinth::File>&, bool set_managed_info = true, bool show_optional_dialog = true);
|
2022-07-08 01:10:41 +01:00
|
|
|
QString getManagedPackID() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QWidget* m_parent = nullptr;
|
|
|
|
|
|
|
|
QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion;
|
|
|
|
QString m_managed_id, m_managed_version_id, m_managed_name;
|
|
|
|
QString m_source_url;
|
|
|
|
|
|
|
|
std::vector<Modrinth::File> m_files;
|
|
|
|
NetJob::Ptr m_files_job;
|
2022-07-31 23:50:09 +01:00
|
|
|
|
|
|
|
std::optional<InstancePtr> m_instance;
|
2022-07-08 01:10:41 +01:00
|
|
|
};
|