diff options
Diffstat (limited to 'api/logic/modplatform/ftb/FtbPackInstallTask.h')
-rw-r--r-- | api/logic/modplatform/ftb/FtbPackInstallTask.h | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/api/logic/modplatform/ftb/FtbPackInstallTask.h b/api/logic/modplatform/ftb/FtbPackInstallTask.h index 7d6e5276..64f4809d 100644 --- a/api/logic/modplatform/ftb/FtbPackInstallTask.h +++ b/api/logic/modplatform/ftb/FtbPackInstallTask.h @@ -1,5 +1,5 @@ #pragma once -#include "tasks/Task.h" +#include "InstanceTask.h" #include "modplatform/ftb/FtbPackDownloader.h" #include "BaseInstanceProvider.h" #include "net/NetJob.h" @@ -9,47 +9,41 @@ #include "meta/Version.h" #include "meta/VersionList.h" -class MULTIMC_LOGIC_EXPORT FtbPackInstallTask : public Task { +class MULTIMC_LOGIC_EXPORT FtbPackInstallTask : public InstanceTask { Q_OBJECT public: - explicit FtbPackInstallTask(FtbPackDownloader *downloader, SettingsObjectPtr settings, const QString &stagingPath, const QString &instName, - const QString &instIcon, const QString &instGroup); + explicit FtbPackInstallTask(FtbModpack pack, QString version); + virtual ~FtbPackInstallTask(){} + bool abort() override; 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; - - FtbPackDownloader *m_downloader; - - std::unique_ptr<QuaZip> m_packZip; - QFuture<QStringList> m_extractFuture; - QFutureWatcher<QStringList> m_extractFutureWatcher; - +private: void downloadPack(); - void unzip(QString archivePath); + void unzip(); void install(); - bool moveRecursively(QString source, QString dest); - - bool abortable = false; - private slots: - void onDownloadSucceeded(QString archivePath); + void onDownloadSucceeded(); void onDownloadFailed(QString reason); void onDownloadProgress(qint64 current, qint64 total); void onUnzipFinished(); void onUnzipCanceled(); +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; }; |