diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-10-26 19:55:48 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-10-26 19:55:48 +0200 |
commit | 923347729557eed76e4f7e9f6f5f1a79216de0a4 (patch) | |
tree | a54a29be846e76b2b57fed03e74eb6fa5ddcf978 /logic/lists | |
parent | c467ebf1327d6266fc51443edfac6f0b536b6602 (diff) | |
download | MultiMC-923347729557eed76e4f7e9f6f5f1a79216de0a4.tar MultiMC-923347729557eed76e4f7e9f6f5f1a79216de0a4.tar.gz MultiMC-923347729557eed76e4f7e9f6f5f1a79216de0a4.tar.lz MultiMC-923347729557eed76e4f7e9f6f5f1a79216de0a4.tar.xz MultiMC-923347729557eed76e4f7e9f6f5f1a79216de0a4.zip |
S3 bucket listing support and network code refactors.
* Adds support for listing all objects in an S3 bucket.
* Renames a bunch of network related classes (Download->Action)
* Net actions now have static constructors
Diffstat (limited to 'logic/lists')
-rw-r--r-- | logic/lists/ForgeVersionList.cpp | 15 | ||||
-rw-r--r-- | logic/lists/ForgeVersionList.h | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/logic/lists/ForgeVersionList.cpp b/logic/lists/ForgeVersionList.cpp index 491a43d7..27f567cd 100644 --- a/logic/lists/ForgeVersionList.cpp +++ b/logic/lists/ForgeVersionList.cpp @@ -14,7 +14,7 @@ */ #include "ForgeVersionList.h" -#include <logic/net/DownloadJob.h> +#include <logic/net/NetJob.h> #include "MultiMC.h" #include <QtNetwork> @@ -159,14 +159,14 @@ ForgeListLoadTask::ForgeListLoadTask(ForgeVersionList *vlist) : Task() void ForgeListLoadTask::executeTask() { - auto job = new DownloadJob("Version index"); + auto job = new NetJob("Version index"); // we do not care if the version is stale or not. auto forgeListEntry = MMC->metacache()->resolveEntry("minecraftforge", "list.json"); - + // verify by poking the server. forgeListEntry->stale = true; - - job->addCacheDownload(QUrl(JSON_URL), forgeListEntry); + + job->addNetAction(CacheDownload::make(QUrl(JSON_URL), forgeListEntry)); listJob.reset(job); connect(listJob.get(), SIGNAL(succeeded()), SLOT(list_downloaded())); connect(listJob.get(), SIGNAL(failed()), SLOT(list_failed())); @@ -178,7 +178,7 @@ void ForgeListLoadTask::list_failed() { auto DlJob = listJob->first(); auto reply = DlJob->m_reply; - if(reply) + if (reply) { QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); } @@ -193,7 +193,7 @@ void ForgeListLoadTask::list_downloaded() auto DlJob = listJob->first(); auto filename = std::dynamic_pointer_cast<CacheDownload>(DlJob)->m_target_path; QFile listFile(filename); - if(!listFile.open(QIODevice::ReadOnly)) + if (!listFile.open(QIODevice::ReadOnly)) return; data = listFile.readAll(); DlJob.reset(); @@ -202,7 +202,6 @@ void ForgeListLoadTask::list_downloaded() QJsonParseError jsonError; QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError); - if (jsonError.error != QJsonParseError::NoError) { emitFailed("Error parsing version list JSON:" + jsonError.errorString()); diff --git a/logic/lists/ForgeVersionList.h b/logic/lists/ForgeVersionList.h index 56a207c8..52593f94 100644 --- a/logic/lists/ForgeVersionList.h +++ b/logic/lists/ForgeVersionList.h @@ -23,7 +23,7 @@ #include <QNetworkReply> #include "BaseVersionList.h" #include "logic/tasks/Task.h" -#include "logic/net/DownloadJob.h" +#include "logic/net/NetJob.h" class ForgeVersion; typedef std::shared_ptr<ForgeVersion> ForgeVersionPtr; @@ -104,6 +104,6 @@ slots: void list_failed(); protected: - DownloadJobPtr listJob; + NetJobPtr listJob; ForgeVersionList *m_list; }; |