summaryrefslogtreecommitdiffstats
path: root/backend/lists/LwjglVersionList.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-07 01:38:18 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-07 01:38:18 +0200
commitafaa1dc223ec87b685778ee0aed81cb6caaa05c7 (patch)
tree4e1e6589d56ba9bc6984547d158d413a0495272f /backend/lists/LwjglVersionList.cpp
parent091b7502cfc1bc01a1abd68a0fb9a0b2693a4658 (diff)
downloadMultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar
MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.gz
MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.lz
MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.xz
MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.zip
Get rid of QNAM (now subclassed and less needy). Basic LWJGL download and extraction.
Diffstat (limited to 'backend/lists/LwjglVersionList.cpp')
-rw-r--r--backend/lists/LwjglVersionList.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/backend/lists/LwjglVersionList.cpp b/backend/lists/LwjglVersionList.cpp
index 824d0906..73a27a58 100644
--- a/backend/lists/LwjglVersionList.cpp
+++ b/backend/lists/LwjglVersionList.cpp
@@ -14,6 +14,7 @@
*/
#include "LwjglVersionList.h"
+#include <net/NetWorker.h>
#include <QtNetwork>
@@ -53,7 +54,7 @@ QVariant LWJGLVersionList::data(const QModelIndex &index, int role) const
return version->name();
case Qt::ToolTipRole:
- return version->url().toString();
+ return version->url();
default:
return QVariant();
@@ -90,7 +91,8 @@ void LWJGLVersionList::loadList()
Q_ASSERT_X(!m_loading, "loadList", "list is already loading (m_loading is true)");
setLoading(true);
- reply = netMgr.get(QNetworkRequest(QUrl(RSS_URL)));
+ auto & worker = NetWorker::spawn();
+ reply = worker.get(QNetworkRequest(QUrl(RSS_URL)));
connect(reply, SIGNAL(finished()), SLOT(netRequestComplete()));
}
@@ -144,9 +146,9 @@ void LWJGLVersionList::netRequestComplete()
// Make sure it's a download link.
if (link.endsWith("/download") && link.contains(lwjglRegex))
{
- QString name = link.mid(lwjglRegex.indexIn(link));
+ QString name = link.mid(lwjglRegex.indexIn(link) + 6);
// Subtract 4 here to remove the .zip file extension.
- name = name.left(lwjglRegex.matchedLength() - 4);
+ name = name.left(lwjglRegex.matchedLength() - 10);
QUrl url(link);
if (!url.isValid())
@@ -179,7 +181,8 @@ const PtrLWJGLVersion LWJGLVersionList::getVersion(const QString &versionName)
{
for (int i = 0; i < count(); i++)
{
- if (at(i)->name() == versionName)
+ QString name = at(i)->name();
+ if ( name == versionName)
return at(i);
}
return PtrLWJGLVersion();