summaryrefslogtreecommitdiffstats
path: root/backend/lists
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-09 00:26:35 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-09 00:26:35 +0200
commitbf5f5091ef6daeaf7067f4fc8973eb068ddc52fc (patch)
tree647f77c1d7f8c8e0e7bdf90fb7f3b0eac9aa5f6c /backend/lists
parentc8925e0f667b0c94028345586d99008066358200 (diff)
downloadMultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar.gz
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar.lz
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar.xz
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.zip
Various task related improvements.
* Errors are reported back to task users via Failure signals. * Lwjgl doesn't download on each legacy instance start anymore. * Tasks were unified when it comes to success/failure. * Task dialogs don't get spawned after short tasks finish anymore.
Diffstat (limited to 'backend/lists')
-rw-r--r--backend/lists/LwjglVersionList.cpp3
-rw-r--r--backend/lists/MinecraftVersionList.cpp23
2 files changed, 9 insertions, 17 deletions
diff --git a/backend/lists/LwjglVersionList.cpp b/backend/lists/LwjglVersionList.cpp
index 73a27a58..068394e8 100644
--- a/backend/lists/LwjglVersionList.cpp
+++ b/backend/lists/LwjglVersionList.cpp
@@ -119,8 +119,7 @@ void LWJGLVersionList::netRequestComplete()
int errorLine;
if (!doc.setContent(reply->readAll(), false, &xmlErrorMsg, &errorLine))
{
- failed("Failed to load LWJGL list. XML error: " + xmlErrorMsg +
- " at line " + QString::number(errorLine));
+ failed("Failed to load LWJGL list. XML error: " + xmlErrorMsg + " at line " + QString::number(errorLine));
setLoading(false);
return;
}
diff --git a/backend/lists/MinecraftVersionList.cpp b/backend/lists/MinecraftVersionList.cpp
index e14d7a25..ae28c46d 100644
--- a/backend/lists/MinecraftVersionList.cpp
+++ b/backend/lists/MinecraftVersionList.cpp
@@ -179,9 +179,8 @@ void MCVListLoadTask::list_downloaded()
{
if(vlistReply->error() != QNetworkReply::QNetworkReply::NoError)
{
- qDebug() << "Failed to load Minecraft main version list" << vlistReply->errorString();
vlistReply->deleteLater();
- emitEnded();
+ emitFailed("Failed to load Minecraft main version list" + vlistReply->errorString());
return;
}
@@ -191,15 +190,13 @@ void MCVListLoadTask::list_downloaded()
if (jsonError.error != QJsonParseError::NoError)
{
- qDebug() << "Error parsing version list JSON:" << jsonError.errorString();
- emitEnded();
+ emitFailed("Error parsing version list JSON:" + jsonError.errorString());
return;
}
if(!jsonDoc.isObject())
{
- qDebug() << "Error parsing version list JSON: " << "jsonDoc is not an object";
- emitEnded();
+ emitFailed("Error parsing version list JSON: jsonDoc is not an object");
return;
}
@@ -208,8 +205,7 @@ void MCVListLoadTask::list_downloaded()
// Get the ID of the latest release and the latest snapshot.
if(!root.value("latest").isObject())
{
- qDebug() << "Error parsing version list JSON: " << "version list is missing 'latest' object";
- emitEnded();
+ emitFailed("Error parsing version list JSON: version list is missing 'latest' object");
return;
}
@@ -219,22 +215,19 @@ void MCVListLoadTask::list_downloaded()
QString latestSnapshotID = latest.value("snapshot").toString("");
if(latestReleaseID.isEmpty())
{
- qDebug() << "Error parsing version list JSON: " << "latest release field is missing";
- emitEnded();
+ emitFailed("Error parsing version list JSON: latest release field is missing");
return;
}
if(latestSnapshotID.isEmpty())
{
- qDebug() << "Error parsing version list JSON: " << "latest snapshot field is missing";
- emitEnded();
+ emitFailed("Error parsing version list JSON: latest snapshot field is missing");
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";
- emitEnded();
+ emitFailed("Error parsing version list JSON: version list object is missing 'versions' array");
return;
}
QJsonArray versions = root.value("versions").toArray();
@@ -308,7 +301,7 @@ void MCVListLoadTask::list_downloaded()
#ifdef PRINT_VERSIONS
m_list->printToStdOut();
#endif
- emitEnded();
+ emitSucceeded();
return;
}