From afaa1dc223ec87b685778ee0aed81cb6caaa05c7 Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Wed, 7 Aug 2013 01:38:18 +0200 Subject: Get rid of QNAM (now subclassed and less needy). Basic LWJGL download and extraction. --- backend/lists/LwjglVersionList.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'backend/lists/LwjglVersionList.cpp') 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 #include @@ -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(); -- cgit