2023-02-04 21:41:24 +00:00
/*
2024-03-15 20:39:32 +00:00
* Copyright 2023 - 2024 arthomnix
2023-02-04 21:41:24 +00:00
*
* 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"
2023-02-05 21:09:16 +00:00
# include "ModrinthHashLookupRequest.h"
2023-02-04 21:41:24 +00:00
2023-02-05 14:28:18 +00:00
namespace Modrinth
{
struct ExportSettings
{
2023-02-04 21:41:24 +00:00
QString version ;
QString name ;
QString description ;
bool includeGameConfig ;
bool includeModConfigs ;
bool includeResourcePacks ;
bool includeShaderPacks ;
2023-05-23 19:51:48 +00:00
bool treatDisabledAsOptional ;
2023-02-05 12:03:00 +00:00
QString datapacksPath ;
2023-02-04 21:41:24 +00:00
QString gameVersion ;
QString forgeVersion ;
QString fabricVersion ;
QString quiltVersion ;
2024-03-15 20:39:32 +00:00
QString neoforgeVersion ;
2023-02-04 21:41:24 +00:00
QString exportPath ;
} ;
// 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)
2023-02-05 14:28:18 +00:00
struct ExportFile
2023-02-04 21:41:24 +00:00
{
QString path ;
QString sha512 ;
QString sha1 ;
QString download ;
qint64 fileSize ;
2023-05-23 19:51:48 +00:00
bool optional = false ;
2023-02-04 21:41:24 +00:00
} ;
2023-02-05 14:28:18 +00:00
class InstanceExportTask : public Task
2023-02-04 21:41:24 +00:00
{
Q_OBJECT
public :
2023-02-05 14:28:18 +00:00
explicit InstanceExportTask ( InstancePtr instance , ExportSettings settings ) ;
2023-02-04 21:41:24 +00:00
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 ;
2023-02-05 14:28:18 +00:00
ExportSettings m_settings ;
2023-02-05 21:09:16 +00:00
std : : shared_ptr < QList < HashLookupResponseData > > m_response ;
2023-02-04 21:41:24 +00:00
NetJob : : Ptr m_netJob ;
2023-02-05 14:28:18 +00:00
} ;
}