mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-02 15:44:28 +02:00

Let's move off our custom QuaZip. In the olden times we needed the custom version of QuaZip, as it was basically unmaintained and on SourceForge (eww). But nowadays it's maintained and on GitHub. See new GitHub page: https://github.com/stachenov/quazip
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
#pragma once
|
|
#include "InstanceTask.h"
|
|
#include "net/NetJob.h"
|
|
#include "QuaZip-Qt5-1.2/quazip/quazip.h"
|
|
#include "QuaZip-Qt5-1.2/quazip/quazipdir.h"
|
|
#include "meta/Index.h"
|
|
#include "meta/Version.h"
|
|
#include "meta/VersionList.h"
|
|
#include "PackHelpers.h"
|
|
|
|
#include "net/NetJob.h"
|
|
|
|
#include <nonstd/optional>
|
|
|
|
namespace LegacyFTB {
|
|
|
|
class PackInstallTask : public InstanceTask
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network, Modpack pack, QString version);
|
|
virtual ~PackInstallTask(){}
|
|
|
|
bool canAbort() const override { return true; }
|
|
bool abort() override;
|
|
|
|
protected:
|
|
//! Entry point for tasks.
|
|
virtual void executeTask() override;
|
|
|
|
private:
|
|
void downloadPack();
|
|
void unzip();
|
|
void install();
|
|
|
|
private slots:
|
|
void onDownloadSucceeded();
|
|
void onDownloadFailed(QString reason);
|
|
void onDownloadProgress(qint64 current, qint64 total);
|
|
|
|
void onUnzipFinished();
|
|
void onUnzipCanceled();
|
|
|
|
private: /* data */
|
|
shared_qobject_ptr<QNetworkAccessManager> m_network;
|
|
bool abortable = false;
|
|
std::unique_ptr<QuaZip> m_packZip;
|
|
QFuture<nonstd::optional<QStringList>> m_extractFuture;
|
|
QFutureWatcher<nonstd::optional<QStringList>> m_extractFutureWatcher;
|
|
NetJob::Ptr netJobContainer;
|
|
QString archivePath;
|
|
|
|
Modpack m_pack;
|
|
QString m_version;
|
|
};
|
|
|
|
}
|