Get rid of QNAM (now subclassed and less needy). Basic LWJGL download and extraction.

This commit is contained in:
Petr Mrázek 2013-08-07 01:38:18 +02:00
parent 091b7502cf
commit afaa1dc223
35 changed files with 506 additions and 242 deletions

View file

@ -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 + "/";