diff options
Diffstat (limited to 'backend/lists/MinecraftVersionList.cpp')
-rw-r--r-- | backend/lists/MinecraftVersionList.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/backend/lists/MinecraftVersionList.cpp b/backend/lists/MinecraftVersionList.cpp index 7f220086..e14d7a25 100644 --- a/backend/lists/MinecraftVersionList.cpp +++ b/backend/lists/MinecraftVersionList.cpp @@ -14,6 +14,7 @@ */ #include "MinecraftVersionList.h" +#include <net/NetWorker.h> #include <QDebug> @@ -29,8 +30,6 @@ #include <QtNetwork> -#include "netutils.h" - #define MCVLIST_URLBASE "http://s3.amazonaws.com/Minecraft.Download/versions/" #define ASSETS_URLBASE "http://assets.minecraft.net/" #define MCN_URLBASE "http://sonicrules.org/mcnweb.py" @@ -160,21 +159,18 @@ MCVListLoadTask::MCVListLoadTask(MinecraftVersionList *vlist) { m_list = vlist; m_currentStable = NULL; - netMgr = nullptr; vlistReply = nullptr; } MCVListLoadTask::~MCVListLoadTask() { - if(netMgr) - netMgr->deleteLater(); } void MCVListLoadTask::executeTask() { setStatus("Loading instance version list..."); - netMgr = new QNetworkAccessManager(); - vlistReply = netMgr->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) + "versions.json"))); + auto & worker = NetWorker::spawn(); + vlistReply = worker.get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) + "versions.json"))); connect(vlistReply, SIGNAL(finished()), this, SLOT(list_downloaded())); } @@ -283,12 +279,18 @@ void MCVListLoadTask::list_downloaded() { versionType = MinecraftVersion::Snapshot; } + else if(versionTypeStr == "old_beta" || versionTypeStr == "old_alpha") + { + versionType = MinecraftVersion::Nostalgia; + } else { //FIXME: log this somewhere continue; } + //FIXME: detect if snapshots are old or not + // Get the download URL. QString dlUrl = QString(MCVLIST_URLBASE) + versionID + "/"; |