pollymc/api/logic/minecraft/SkinUpload.h

40 lines
816 B
C
Raw Normal View History

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