2022-01-14 08:43:42 +00:00
|
|
|
#pragma once
|
|
|
|
#include "QObjectPtr.h"
|
|
|
|
#include "tasks/Task.h"
|
2022-01-14 11:47:18 +00:00
|
|
|
#include "minecraft/mod/ModFolderModel.h"
|
|
|
|
#include "net/NetJob.h"
|
2022-01-14 08:43:42 +00:00
|
|
|
#include <QUrl>
|
|
|
|
|
|
|
|
|
|
|
|
class ModDownloadTask : public Task {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-01-14 11:47:18 +00:00
|
|
|
explicit ModDownloadTask(const QUrl sourceUrl, const QString filename, const std::shared_ptr<ModFolderModel> mods);
|
2022-02-22 00:34:06 +00:00
|
|
|
const QString& getFilename() const { return filename; }
|
2022-01-14 08:43:42 +00:00
|
|
|
|
2022-01-14 11:47:18 +00:00
|
|
|
public slots:
|
|
|
|
bool abort() override;
|
2022-01-14 08:43:42 +00:00
|
|
|
protected:
|
|
|
|
//! Entry point for tasks.
|
|
|
|
void executeTask() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QUrl m_sourceUrl;
|
2022-01-14 19:22:15 +00:00
|
|
|
NetJob::Ptr m_filesNetJob;
|
2022-01-14 11:47:18 +00:00
|
|
|
const std::shared_ptr<ModFolderModel> mods;
|
|
|
|
const QString filename;
|
|
|
|
|
|
|
|
void downloadProgressChanged(qint64 current, qint64 total);
|
|
|
|
|
|
|
|
void downloadFailed(QString reason);
|
|
|
|
|
|
|
|
void downloadSucceeded();
|
2022-01-14 08:43:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|