pollymc/launcher/ModDownloadTask.h

35 lines
724 B
C
Raw Normal View History

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