2016-05-12 21:51:25 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
#include <QtNetwork/QtNetwork>
|
|
|
|
#include <memory>
|
|
|
|
#include "tasks/Task.h"
|
|
|
|
|
2021-11-23 00:25:24 +00:00
|
|
|
typedef shared_qobject_ptr<class SkinUpload> SkinUploadPtr;
|
2016-05-12 21:51:25 +01:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
class SkinUpload : public Task {
|
2017-07-07 18:46:56 +01:00
|
|
|
Q_OBJECT
|
2023-08-02 17:35:35 +01:00
|
|
|
public:
|
|
|
|
enum Model { STEVE, ALEX };
|
2016-05-12 21:51:25 +01:00
|
|
|
|
|
|
|
// Note this class takes ownership of the file.
|
2023-08-02 17:35:35 +01:00
|
|
|
SkinUpload(QObject* parent, QString token, QByteArray skin, Model model = STEVE);
|
2016-05-12 21:51:25 +01:00
|
|
|
virtual ~SkinUpload() {}
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
private:
|
2016-05-12 21:51:25 +01:00
|
|
|
Model m_model;
|
|
|
|
QByteArray m_skin;
|
2021-12-04 00:18:05 +00:00
|
|
|
QString m_token;
|
2021-11-23 00:25:24 +00:00
|
|
|
shared_qobject_ptr<QNetworkReply> m_reply;
|
2023-08-02 17:35:35 +01:00
|
|
|
|
|
|
|
protected:
|
2016-05-12 21:51:25 +01:00
|
|
|
virtual void executeTask();
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
public slots:
|
2016-05-12 21:51:25 +01:00
|
|
|
|
|
|
|
void downloadError(QNetworkReply::NetworkError);
|
2023-04-18 01:51:34 +01:00
|
|
|
void sslErrors(const QList<QSslError>& errors);
|
2016-05-12 21:51:25 +01:00
|
|
|
|
|
|
|
void downloadFinished();
|
|
|
|
};
|