2018-02-28 18:42:30 +00:00
|
|
|
#pragma once
|
2018-03-19 01:36:12 +00:00
|
|
|
#include "InstanceTask.h"
|
2018-03-16 22:33:58 +00:00
|
|
|
#include "modplatform/ftb/FtbPackDownloader.h"
|
2018-02-28 18:42:30 +00:00
|
|
|
#include "BaseInstanceProvider.h"
|
|
|
|
#include "net/NetJob.h"
|
|
|
|
#include "quazip.h"
|
|
|
|
#include "quazipdir.h"
|
2018-03-03 20:22:00 +00:00
|
|
|
#include "meta/Index.h"
|
|
|
|
#include "meta/Version.h"
|
|
|
|
#include "meta/VersionList.h"
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
class MULTIMC_LOGIC_EXPORT FtbPackInstallTask : public InstanceTask {
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-03-19 01:36:12 +00:00
|
|
|
explicit FtbPackInstallTask(FtbModpack pack, QString version);
|
|
|
|
virtual ~FtbPackInstallTask(){}
|
|
|
|
|
2018-03-03 20:22:00 +00:00
|
|
|
bool abort() override;
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//! Entry point for tasks.
|
|
|
|
virtual void executeTask() override;
|
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
private:
|
2018-02-28 18:42:30 +00:00
|
|
|
void downloadPack();
|
2018-03-19 01:36:12 +00:00
|
|
|
void unzip();
|
2018-02-28 18:42:30 +00:00
|
|
|
void install();
|
|
|
|
|
|
|
|
private slots:
|
2018-03-19 01:36:12 +00:00
|
|
|
void onDownloadSucceeded();
|
2018-02-28 18:42:30 +00:00
|
|
|
void onDownloadFailed(QString reason);
|
|
|
|
void onDownloadProgress(qint64 current, qint64 total);
|
|
|
|
|
|
|
|
void onUnzipFinished();
|
|
|
|
void onUnzipCanceled();
|
2018-03-03 20:22:00 +00:00
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
private: /* data */
|
|
|
|
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;
|
2018-02-28 18:42:30 +00:00
|
|
|
};
|