Runnable 1.6 instances!

This commit is contained in:
Petr Mrázek
2013-08-05 03:29:50 +02:00
parent 005a010ee6
commit 183a735145
23 changed files with 502 additions and 214 deletions

View File

@@ -27,16 +27,14 @@
LoginTask::LoginTask( const UserInfo& uInfo, QObject* parent ) :
Task(parent), uInfo(uInfo)
{
netMgr.reset(new QNetworkAccessManager());
}
void LoginTask::executeTask()
{
setStatus("Logging in...");
QNetworkAccessManager netMgr;
connect(&netMgr, SIGNAL(finished(QNetworkReply*)),
SLOT(processNetReply(QNetworkReply*)));
connect(netMgr.data(), SIGNAL(finished(QNetworkReply*)), this, SLOT(processNetReply(QNetworkReply*)));
QUrl loginURL("https://login.minecraft.net/");
QNetworkRequest netRequest(loginURL);
@@ -47,8 +45,7 @@ void LoginTask::executeTask()
params.addQueryItem("password", uInfo.password);
params.addQueryItem("version", "13");
netReply = netMgr.post(netRequest, params.query(QUrl::EncodeSpaces).toUtf8());
exec();
netReply = netMgr->post(netRequest, params.query(QUrl::EncodeSpaces).toUtf8());
}
void LoginTask::processNetReply(QNetworkReply *reply)
@@ -115,6 +112,5 @@ void LoginTask::processNetReply(QNetworkReply *reply)
emit loginFailed("Login failed: " + reply->errorString());
break;
}
quit();
emitEnded();
}