pollymc/api/logic/modplatform/ftb/FtbPackInstallTask.h

49 lines
1.1 KiB
C
Raw Normal View History

#pragma once
2018-03-19 07:06:12 +05:30
#include "InstanceTask.h"
#include "net/NetJob.h"
#include "quazip.h"
#include "quazipdir.h"
#include "meta/Index.h"
#include "meta/Version.h"
#include "meta/VersionList.h"
#include "modplatform/ftb/PackHelpers.h"
2018-03-19 07:06:12 +05:30
class MULTIMC_LOGIC_EXPORT FtbPackInstallTask : public InstanceTask {
2018-07-15 18:21:05 +05:30
Q_OBJECT
public:
2018-07-15 18:21:05 +05:30
explicit FtbPackInstallTask(FtbModpack pack, QString version);
virtual ~FtbPackInstallTask(){}
2018-03-19 07:06:12 +05:30
2018-07-15 18:21:05 +05:30
bool abort() override;
protected:
2018-07-15 18:21:05 +05:30
//! Entry point for tasks.
virtual void executeTask() override;
2018-03-19 07:06:12 +05:30
private:
2018-07-15 18:21:05 +05:30
void downloadPack();
void unzip();
void install();
private slots:
2018-07-15 18:21:05 +05:30
void onDownloadSucceeded();
void onDownloadFailed(QString reason);
void onDownloadProgress(qint64 current, qint64 total);
2018-07-15 18:21:05 +05:30
void onUnzipFinished();
void onUnzipCanceled();
2018-03-19 07:06:12 +05:30
private: /* data */
2018-07-15 18:21:05 +05:30
bool abortable = false;
std::unique_ptr<QuaZip> m_packZip;
QFuture<QStringList> m_extractFuture;
QFutureWatcher<QStringList> m_extractFutureWatcher;
NetJobPtr netJobContainer;
QString archivePath;
FtbModpack m_pack;
QString m_version;
};