diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-07 01:38:18 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-07 01:38:18 +0200 |
commit | afaa1dc223ec87b685778ee0aed81cb6caaa05c7 (patch) | |
tree | 4e1e6589d56ba9bc6984547d158d413a0495272f /backend/tasks | |
parent | 091b7502cfc1bc01a1abd68a0fb9a0b2693a4658 (diff) | |
download | MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.gz MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.lz MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.xz MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.zip |
Get rid of QNAM (now subclassed and less needy). Basic LWJGL download and extraction.
Diffstat (limited to 'backend/tasks')
-rw-r--r-- | backend/tasks/LoginTask.cpp | 20 | ||||
-rw-r--r-- | backend/tasks/LoginTask.h | 3 |
2 files changed, 9 insertions, 14 deletions
diff --git a/backend/tasks/LoginTask.cpp b/backend/tasks/LoginTask.cpp index 30e97ca9..7a1d5262 100644 --- a/backend/tasks/LoginTask.cpp +++ b/backend/tasks/LoginTask.cpp @@ -14,27 +14,23 @@ */ #include "LoginTask.h" +#include <net/NetWorker.h> #include <QStringList> -#include <QtNetwork/QNetworkAccessManager> -#include <QtNetwork/QNetworkReply> -#include <QtNetwork/QNetworkRequest> +#include <QNetworkReply> +#include <QNetworkRequest> #include <QUrl> #include <QUrlQuery> -LoginTask::LoginTask( const UserInfo& uInfo, QObject* parent ) : - Task(parent), uInfo(uInfo) -{ - netMgr.reset(new QNetworkAccessManager()); -} +LoginTask::LoginTask( const UserInfo& uInfo, QObject* parent ) : Task(parent), uInfo(uInfo){} void LoginTask::executeTask() { setStatus("Logging in..."); - - connect(netMgr.data(), SIGNAL(finished(QNetworkReply*)), this, SLOT(processNetReply(QNetworkReply*))); + auto & worker = NetWorker::spawn(); + connect(&worker, SIGNAL(finished(QNetworkReply*)), this, SLOT(processNetReply(QNetworkReply*))); QUrl loginURL("https://login.minecraft.net/"); QNetworkRequest netRequest(loginURL); @@ -45,11 +41,13 @@ void LoginTask::executeTask() params.addQueryItem("password", uInfo.password); params.addQueryItem("version", "13"); - netReply = netMgr->post(netRequest, params.query(QUrl::EncodeSpaces).toUtf8()); + netReply = worker.post(netRequest, params.query(QUrl::EncodeSpaces).toUtf8()); } void LoginTask::processNetReply(QNetworkReply *reply) { + if(netReply != reply) + return; // Check for errors. switch (reply->error()) { diff --git a/backend/tasks/LoginTask.h b/backend/tasks/LoginTask.h index e2f72f9e..81d1b6cc 100644 --- a/backend/tasks/LoginTask.h +++ b/backend/tasks/LoginTask.h @@ -33,7 +33,6 @@ struct LoginResponse qint64 latestVersion; }; -class QNetworkAccessManager; class QNetworkReply; class LIBMULTIMC_EXPORT LoginTask : public Task @@ -54,8 +53,6 @@ protected: QNetworkReply* netReply; UserInfo uInfo; -private: - QSharedPointer<QNetworkAccessManager> netMgr; }; #endif // LOGINTASK_H |