2016-05-12 20:51:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
#include <QtNetwork/QtNetwork>
|
|
|
|
#include <memory>
|
|
|
|
#include <minecraft/auth/AuthSession.h>
|
|
|
|
#include "tasks/Task.h"
|
|
|
|
|
|
|
|
typedef std::shared_ptr<class SkinUpload> SkinUploadPtr;
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class SkinUpload : public Task
|
2016-05-12 20:51:25 +00:00
|
|
|
{
|
2018-07-15 12:51:05 +00:00
|
|
|
Q_OBJECT
|
2016-05-12 20:51:25 +00:00
|
|
|
public:
|
2018-07-15 12:51:05 +00:00
|
|
|
enum Model
|
|
|
|
{
|
|
|
|
STEVE,
|
|
|
|
ALEX
|
|
|
|
};
|
2016-05-12 20:51:25 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
// Note this class takes ownership of the file.
|
|
|
|
SkinUpload(QObject *parent, AuthSessionPtr session, QByteArray skin, Model model = STEVE);
|
|
|
|
virtual ~SkinUpload() {}
|
2016-05-12 20:51:25 +00:00
|
|
|
|
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
Model m_model;
|
|
|
|
QByteArray m_skin;
|
|
|
|
AuthSessionPtr m_session;
|
|
|
|
std::shared_ptr<QNetworkReply> m_reply;
|
2016-05-12 20:51:25 +00:00
|
|
|
protected:
|
2018-07-15 12:51:05 +00:00
|
|
|
virtual void executeTask();
|
2016-05-12 20:51:25 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
void downloadError(QNetworkReply::NetworkError);
|
2016-05-12 20:51:25 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
void downloadFinished();
|
2016-05-12 20:51:25 +00:00
|
|
|
};
|