2018-03-01 00:12:30 +05:30
|
|
|
#pragma once
|
|
|
|
#include "tasks/Task.h"
|
|
|
|
#include "modplatform/FtbPackDownloader.h"
|
|
|
|
#include "BaseInstanceProvider.h"
|
|
|
|
#include "net/NetJob.h"
|
|
|
|
#include "quazip.h"
|
|
|
|
#include "quazipdir.h"
|
2018-03-04 01:52:00 +05:30
|
|
|
#include "meta/Index.h"
|
|
|
|
#include "meta/Version.h"
|
|
|
|
#include "meta/VersionList.h"
|
2018-03-01 00:12:30 +05:30
|
|
|
|
|
|
|
class MULTIMC_LOGIC_EXPORT FtbPackInstallTask : public Task {
|
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-03-04 01:52:00 +05:30
|
|
|
explicit FtbPackInstallTask(FtbPackDownloader *downloader, SettingsObjectPtr settings, const QString &stagingPath, const QString &instName,
|
2018-03-01 00:12:30 +05:30
|
|
|
const QString &instIcon, const QString &instGroup);
|
2018-03-04 01:52:00 +05:30
|
|
|
bool abort() override;
|
2018-03-01 00:12:30 +05:30
|
|
|
|
|
|
|
protected:
|
|
|
|
//! Entry point for tasks.
|
|
|
|
virtual void executeTask() override;
|
|
|
|
|
|
|
|
private: /* data */
|
|
|
|
SettingsObjectPtr m_globalSettings;
|
|
|
|
QString m_stagingPath;
|
|
|
|
QString m_instName;
|
|
|
|
QString m_instIcon;
|
|
|
|
QString m_instGroup;
|
|
|
|
NetJobPtr m_netJobPtr;
|
2018-03-04 01:52:00 +05:30
|
|
|
|
|
|
|
FtbPackDownloader *m_downloader;
|
2018-03-01 00:12:30 +05:30
|
|
|
|
|
|
|
std::unique_ptr<QuaZip> m_packZip;
|
|
|
|
QFuture<QStringList> m_extractFuture;
|
|
|
|
QFutureWatcher<QStringList> m_extractFutureWatcher;
|
|
|
|
|
|
|
|
void downloadPack();
|
|
|
|
void unzip(QString archivePath);
|
|
|
|
void install();
|
|
|
|
|
2018-03-04 01:52:00 +05:30
|
|
|
bool moveRecursively(QString source, QString dest);
|
|
|
|
|
|
|
|
bool abortable = false;
|
|
|
|
|
2018-03-01 00:12:30 +05:30
|
|
|
private slots:
|
|
|
|
void onDownloadSucceeded(QString archivePath);
|
|
|
|
void onDownloadFailed(QString reason);
|
|
|
|
void onDownloadProgress(qint64 current, qint64 total);
|
|
|
|
|
|
|
|
void onUnzipFinished();
|
|
|
|
void onUnzipCanceled();
|
2018-03-04 01:52:00 +05:30
|
|
|
|
2018-03-01 00:12:30 +05:30
|
|
|
};
|