diff options
author | Andrew <forkk@forkk.net> | 2013-05-08 12:56:43 -0500 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-05-08 12:56:43 -0500 |
commit | 5f781b3053c5ba8a25d354903acf2c31dc9a56c5 (patch) | |
tree | 94361d20568e55d63db7b18f3c7dded7d1e88e06 /libmultimc/src/minecraftversionlist.cpp | |
parent | 2e62f6e8d8aded1036f96835ebebd4d656c0fcc2 (diff) | |
download | MultiMC-5f781b3053c5ba8a25d354903acf2c31dc9a56c5.tar MultiMC-5f781b3053c5ba8a25d354903acf2c31dc9a56c5.tar.gz MultiMC-5f781b3053c5ba8a25d354903acf2c31dc9a56c5.tar.lz MultiMC-5f781b3053c5ba8a25d354903acf2c31dc9a56c5.tar.xz MultiMC-5f781b3053c5ba8a25d354903acf2c31dc9a56c5.zip |
Implement basic game updater.
Resolves MMC-4: https://jira.forkk.net/browse/MMC-4
Diffstat (limited to 'libmultimc/src/minecraftversionlist.cpp')
-rw-r--r-- | libmultimc/src/minecraftversionlist.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libmultimc/src/minecraftversionlist.cpp b/libmultimc/src/minecraftversionlist.cpp index bb8b0f7a..8b40069e 100644 --- a/libmultimc/src/minecraftversionlist.cpp +++ b/libmultimc/src/minecraftversionlist.cpp @@ -29,6 +29,8 @@ #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" @@ -101,6 +103,7 @@ InstVersion *MinecraftVersionList::getLatestStable() const return m_vlist.at(i); } } + return NULL; } MinecraftVersionList &MinecraftVersionList::getMainList() @@ -169,13 +172,6 @@ inline QDateTime timeFromMCVListTime(QString str) } -inline void waitForNetRequest(QNetworkReply *netReply) -{ - QEventLoop loop; - loop.connect(netReply, SIGNAL(finished()), SLOT(quit())); - loop.exec(); -} - MCVListLoadTask::MCVListLoadTask(MinecraftVersionList *vlist) { @@ -222,7 +218,7 @@ bool MCVListLoadTask::loadFromVList() { QNetworkReply *vlistReply = netMgr->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) + "versions.json"))); - waitForNetRequest(vlistReply); + NetUtils::waitForNetRequest(vlistReply); switch (vlistReply->error()) { @@ -307,6 +303,7 @@ bool MCVListLoadTask::loadFromVList() MinecraftVersion *mcVersion = new MinecraftVersion( versionID, versionID, versionTime.toMSecsSinceEpoch(), dlUrl, ""); + mcVersion->setIsForNewLauncher(true); mcVersion->setVersionType(versionType); tempList.append(mcVersion); } @@ -335,7 +332,7 @@ bool MCVListLoadTask::loadFromAssets() bool succeeded = false; QNetworkReply *assetsReply = netMgr->get(QNetworkRequest(QUrl(ASSETS_URLBASE))); - waitForNetRequest(assetsReply); + NetUtils::waitForNetRequest(assetsReply); switch (assetsReply->error()) { @@ -459,7 +456,7 @@ bool MCVListLoadTask::loadFromAssets() bool MCVListLoadTask::loadMCNostalgia() { QNetworkReply *mcnReply = netMgr->get(QNetworkRequest(QUrl(QString(MCN_URLBASE) + "?pversion=1&list=True"))); - waitForNetRequest(mcnReply); + NetUtils::waitForNetRequest(mcnReply); return true; } |