summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/SkinUpload.h
blob: 86944b82d108d620b0149b118fe552499cc1e0b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#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\
{
Q_OBJECT
public:
	enum Model
	{
		STEVE,
		ALEX
	};

	// Note this class takes ownership of the file.
	SkinUpload(QObject *parent, AuthSessionPtr session, QByteArray skin, Model model = STEVE);

	virtual ~SkinUpload() {}

private:
	Model m_model;
	QByteArray m_skin;
	AuthSessionPtr m_session;
	std::shared_ptr<QNetworkReply> m_reply;
protected:
	virtual void executeTask();

public slots:

	void downloadError(QNetworkReply::NetworkError);

	void downloadFinished();
};