MultiMC5/launcher/ModrinthInstanceExportTask.h

70 lines
1.6 KiB
C
Raw Normal View History

2023-02-04 21:41:24 +00:00
/*
* Copyright 2023 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
*/
#pragma once
#include "tasks/Task.h"
#include "BaseInstance.h"
#include "net/NetJob.h"
#include "ui/dialogs/ModrinthExportDialog.h"
struct ModrinthExportSettings {
QString version;
QString name;
QString description;
bool includeGameConfig;
bool includeModConfigs;
bool includeResourcePacks;
bool includeShaderPacks;
QString datapacksPath;
2023-02-04 21:41:24 +00:00
QString gameVersion;
QString forgeVersion;
QString fabricVersion;
QString quiltVersion;
QString exportPath;
};
struct ModrinthLookupData {
QFileInfo fileInfo;
QByteArray response;
};
// Using the existing Modrinth::File struct from the importer doesn't actually make much sense here (doesn't support multiple hashes, hash is a byte array rather than a string, no file size, etc)
struct ModrinthFile
{
QString path;
QString sha512;
QString sha1;
QString download;
qint64 fileSize;
};
class ModrinthInstanceExportTask : public Task
{
Q_OBJECT
public:
explicit ModrinthInstanceExportTask(InstancePtr instance, ModrinthExportSettings settings);
protected:
//! Entry point for tasks.
virtual void executeTask() override;
private slots:
void lookupSucceeded();
2023-02-05 10:15:29 +00:00
void lookupFailed(const QString &reason);
2023-02-04 21:41:24 +00:00
void lookupProgress(qint64 current, qint64 total);
private:
InstancePtr m_instance;
ModrinthExportSettings m_settings;
QList<ModrinthLookupData> m_responses;
NetJob::Ptr m_netJob;
};