diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-05 03:29:50 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-05 03:29:50 +0200 |
commit | 183a7351456940d01f14a49112ddeb68ffc4693a (patch) | |
tree | 579aeb0b8670e634de4f083e54b3c826bf548ec9 /backend/lists | |
parent | 005a010ee6a67191ec24583780310fcf217ff30c (diff) | |
download | MultiMC-183a7351456940d01f14a49112ddeb68ffc4693a.tar MultiMC-183a7351456940d01f14a49112ddeb68ffc4693a.tar.gz MultiMC-183a7351456940d01f14a49112ddeb68ffc4693a.tar.lz MultiMC-183a7351456940d01f14a49112ddeb68ffc4693a.tar.xz MultiMC-183a7351456940d01f14a49112ddeb68ffc4693a.zip |
Runnable 1.6 instances!
Diffstat (limited to 'backend/lists')
-rw-r--r-- | backend/lists/MinecraftVersionList.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/backend/lists/MinecraftVersionList.cpp b/backend/lists/MinecraftVersionList.cpp index 4abfbfb8..7f220086 100644 --- a/backend/lists/MinecraftVersionList.cpp +++ b/backend/lists/MinecraftVersionList.cpp @@ -172,24 +172,21 @@ MCVListLoadTask::~MCVListLoadTask() void MCVListLoadTask::executeTask() { - // NOTE: this executes in the QThread setStatus("Loading instance version list..."); netMgr = new QNetworkAccessManager(); vlistReply = netMgr->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) + "versions.json"))); connect(vlistReply, SIGNAL(finished()), this, SLOT(list_downloaded())); - exec(); } void MCVListLoadTask::list_downloaded() { - // NOTE: this executes in the main thread - if(vlistReply->error() != QNetworkReply::QNetworkReply::NoError) { qDebug() << "Failed to load Minecraft main version list" << vlistReply->errorString(); vlistReply->deleteLater(); - exit(0); + emitEnded(); + return; } QJsonParseError jsonError; @@ -199,13 +196,15 @@ void MCVListLoadTask::list_downloaded() if (jsonError.error != QJsonParseError::NoError) { qDebug() << "Error parsing version list JSON:" << jsonError.errorString(); - exit(0); + emitEnded(); + return; } if(!jsonDoc.isObject()) { qDebug() << "Error parsing version list JSON: " << "jsonDoc is not an object"; - exit(0); + emitEnded(); + return; } QJsonObject root = jsonDoc.object(); @@ -214,7 +213,8 @@ void MCVListLoadTask::list_downloaded() if(!root.value("latest").isObject()) { qDebug() << "Error parsing version list JSON: " << "version list is missing 'latest' object"; - exit(0); + emitEnded(); + return; } QJsonObject latest = root.value("latest").toObject(); @@ -224,19 +224,22 @@ void MCVListLoadTask::list_downloaded() if(latestReleaseID.isEmpty()) { qDebug() << "Error parsing version list JSON: " << "latest release field is missing"; - exit(0); + emitEnded(); + return; } if(latestSnapshotID.isEmpty()) { qDebug() << "Error parsing version list JSON: " << "latest snapshot field is missing"; - exit(0); + emitEnded(); + return; } // Now, get the array of versions. if(!root.value("versions").isArray()) { qDebug() << "Error parsing version list JSON: " << "version list object is missing 'versions' array"; - exit(0); + emitEnded(); + return; } QJsonArray versions = root.value("versions").toArray(); @@ -303,7 +306,8 @@ void MCVListLoadTask::list_downloaded() #ifdef PRINT_VERSIONS m_list->printToStdOut(); #endif - exit(1); + emitEnded(); + return; } // FIXME: we should have a local cache of the version list and a local cache of version data |