PrismLauncher/launcher/ModDownloadTask.h

36 lines
784 B
C
Raw Normal View History

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);
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;
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
};