mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-24 04:22:39 +00:00
GH-4699 Move ModrinthInstanceExportTask to modplatform/modrinth; truncate error messages in dialog
This commit is contained in:
77
launcher/modplatform/modrinth/ModrinthInstanceExportTask.h
Normal file
77
launcher/modplatform/modrinth/ModrinthInstanceExportTask.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
namespace Modrinth
|
||||
{
|
||||
|
||||
struct ExportSettings
|
||||
{
|
||||
QString version;
|
||||
QString name;
|
||||
QString description;
|
||||
|
||||
bool includeGameConfig;
|
||||
bool includeModConfigs;
|
||||
bool includeResourcePacks;
|
||||
bool includeShaderPacks;
|
||||
QString datapacksPath;
|
||||
|
||||
QString gameVersion;
|
||||
QString forgeVersion;
|
||||
QString fabricVersion;
|
||||
QString quiltVersion;
|
||||
|
||||
QString exportPath;
|
||||
};
|
||||
|
||||
struct HashLookupData
|
||||
{
|
||||
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 ExportFile
|
||||
{
|
||||
QString path;
|
||||
QString sha512;
|
||||
QString sha1;
|
||||
QString download;
|
||||
qint64 fileSize;
|
||||
};
|
||||
|
||||
class InstanceExportTask : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InstanceExportTask(InstancePtr instance, ExportSettings settings);
|
||||
|
||||
protected:
|
||||
//! Entry point for tasks.
|
||||
virtual void executeTask() override;
|
||||
|
||||
private slots:
|
||||
void lookupSucceeded();
|
||||
void lookupFailed(const QString &reason);
|
||||
void lookupProgress(qint64 current, qint64 total);
|
||||
|
||||
private:
|
||||
InstancePtr m_instance;
|
||||
ExportSettings m_settings;
|
||||
QList<HashLookupData> m_responses;
|
||||
NetJob::Ptr m_netJob;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user