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