PrismLauncher/launcher/modplatform/legacy_ftb/PackInstallTask.h

55 lines
1.2 KiB
C
Raw Normal View History

#pragma once
2022-01-24 21:55:57 +00:00
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
#include "InstanceTask.h"
#include "PackHelpers.h"
#include "meta/Index.h"
#include "meta/Version.h"
#include "meta/VersionList.h"
#include "net/NetJob.h"
#include "net/NetJob.h"
#include <optional>
namespace LegacyFTB {
class PackInstallTask : public InstanceTask {
2018-07-15 13:51:05 +01:00
Q_OBJECT
public:
explicit PackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network, Modpack pack, QString version);
virtual ~PackInstallTask() {}
2018-03-19 01:36:12 +00:00
bool canAbort() const override { return true; }
2018-07-15 13:51:05 +01:00
bool abort() override;
protected:
2018-07-15 13:51:05 +01:00
//! Entry point for tasks.
virtual void executeTask() override;
private:
2018-07-15 13:51:05 +01:00
void downloadPack();
void unzip();
void install();
private slots:
2018-07-15 13:51:05 +01:00
void onUnzipFinished();
void onUnzipCanceled();
private: /* data */
shared_qobject_ptr<QNetworkAccessManager> m_network;
2018-07-15 13:51:05 +01:00
bool abortable = false;
std::unique_ptr<QuaZip> m_packZip;
QFuture<std::optional<QStringList>> m_extractFuture;
QFutureWatcher<std::optional<QStringList>> m_extractFutureWatcher;
NetJob::Ptr netJobContainer;
2018-07-15 13:51:05 +01:00
QString archivePath;
Modpack m_pack;
2018-07-15 13:51:05 +01:00
QString m_version;
};
} // namespace LegacyFTB