diff options
author | Alexia <alexia@robotbrain.info> | 2016-05-12 16:51:25 -0400 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-05-15 16:01:05 +0200 |
commit | 377316999ea9ef6adbc75c52a858eb8e526616e7 (patch) | |
tree | 1ad7ba47c89c69d0e25f7e6e0f592782e75b81d1 /api/logic/minecraft/SkinUpload.h | |
parent | f9791a5cc80b8e99eebd68176c33fdc1c377af86 (diff) | |
download | MultiMC-377316999ea9ef6adbc75c52a858eb8e526616e7.tar MultiMC-377316999ea9ef6adbc75c52a858eb8e526616e7.tar.gz MultiMC-377316999ea9ef6adbc75c52a858eb8e526616e7.tar.lz MultiMC-377316999ea9ef6adbc75c52a858eb8e526616e7.tar.xz MultiMC-377316999ea9ef6adbc75c52a858eb8e526616e7.zip |
GH-767 Basic skin upload
Diffstat (limited to 'api/logic/minecraft/SkinUpload.h')
-rw-r--r-- | api/logic/minecraft/SkinUpload.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/api/logic/minecraft/SkinUpload.h b/api/logic/minecraft/SkinUpload.h new file mode 100644 index 00000000..86944b82 --- /dev/null +++ b/api/logic/minecraft/SkinUpload.h @@ -0,0 +1,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(); +}; |