NOISSUE fix fix fix the accounts again

This commit is contained in:
Petr Mrázek 2021-11-23 01:25:24 +01:00
parent 27e328c044
commit b49987e876
8 changed files with 17 additions and 10 deletions

View File

@ -77,6 +77,12 @@ public:
{
return m_ptr;
}
bool operator==(const shared_qobject_ptr<T>& other) {
return m_ptr == other.m_ptr;
}
bool operator!=(const shared_qobject_ptr<T>& other) {
return m_ptr != other.m_ptr;
}
private:
std::shared_ptr <T> m_ptr;

View File

@ -22,6 +22,7 @@
#include <QJsonDocument>
#include <QNetworkReply>
#include <QByteArray>
#include <QDebug>
#include "Application.h"

View File

@ -18,7 +18,7 @@ void CapeChange::setCape(QString& cape) {
setStatus(tr("Equipping cape"));
m_reply = std::shared_ptr<QNetworkReply>(rep);
m_reply = shared_qobject_ptr<QNetworkReply>(rep);
connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress);
connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished()));
@ -32,7 +32,7 @@ void CapeChange::clearCape() {
setStatus(tr("Removing cape"));
m_reply = std::shared_ptr<QNetworkReply>(rep);
m_reply = shared_qobject_ptr<QNetworkReply>(rep);
connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress);
connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished()));

View File

@ -5,6 +5,7 @@
#include <memory>
#include <minecraft/auth/AuthSession.h>
#include "tasks/Task.h"
#include "QObjectPtr.h"
class CapeChange : public Task
{
@ -20,7 +21,7 @@ private:
private:
QString m_capeId;
AuthSessionPtr m_session;
std::shared_ptr<QNetworkReply> m_reply;
shared_qobject_ptr<QNetworkReply> m_reply;
protected:
virtual void executeTask();

View File

@ -15,7 +15,7 @@ void SkinDelete::executeTask()
QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/skins/active"));
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_session->access_token).toLocal8Bit());
QNetworkReply *rep = APPLICATION->network()->deleteResource(request);
m_reply = std::shared_ptr<QNetworkReply>(rep);
m_reply = shared_qobject_ptr<QNetworkReply>(rep);
setStatus(tr("Deleting skin"));
connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress);

View File

@ -2,11 +2,10 @@
#include <QFile>
#include <QtNetwork/QtNetwork>
#include <memory>
#include <minecraft/auth/AuthSession.h>
#include "tasks/Task.h"
typedef std::shared_ptr<class SkinDelete> SkinDeletePtr;
typedef shared_qobject_ptr<class SkinDelete> SkinDeletePtr;
class SkinDelete : public Task
{
@ -17,7 +16,7 @@ public:
private:
AuthSessionPtr m_session;
std::shared_ptr<QNetworkReply> m_reply;
shared_qobject_ptr<QNetworkReply> m_reply;
protected:
virtual void executeTask();

View File

@ -40,7 +40,7 @@ void SkinUpload::executeTask()
multiPart->append(model);
QNetworkReply *rep = APPLICATION->network()->post(request, multiPart);
m_reply = std::shared_ptr<QNetworkReply>(rep);
m_reply = shared_qobject_ptr<QNetworkReply>(rep);
setStatus(tr("Uploading skin"));
connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress);

View File

@ -6,7 +6,7 @@
#include <minecraft/auth/AuthSession.h>
#include "tasks/Task.h"
typedef std::shared_ptr<class SkinUpload> SkinUploadPtr;
typedef shared_qobject_ptr<class SkinUpload> SkinUploadPtr;
class SkinUpload : public Task
{
@ -26,7 +26,7 @@ private:
Model m_model;
QByteArray m_skin;
AuthSessionPtr m_session;
std::shared_ptr<QNetworkReply> m_reply;
shared_qobject_ptr<QNetworkReply> m_reply;
protected:
virtual void executeTask();