NOISSUE refactor *Download into more, smaller pieces

* Download is now Download.
* Download uses Sink subclasses to process various events.
* Validators can be used to further customize the Sink behaviour.
This commit is contained in:
Petr Mrázek
2016-05-28 19:54:17 +02:00
parent a750f6e63c
commit a1abbd9e05
51 changed files with 824 additions and 765 deletions

View File

@ -6,7 +6,7 @@
#include <QDebug>
#include "Env.h"
#include "net/CacheDownload.h"
#include "net/Download.h"
NotificationChecker::NotificationChecker(QObject *parent)
@ -55,9 +55,8 @@ void NotificationChecker::checkForNotifications()
m_checkJob.reset(new NetJob("Checking for notifications"));
auto entry = ENV.metacache()->resolveEntry("root", "notifications.json");
entry->setStale(true);
m_checkJob->addNetAction(m_download = CacheDownload::make(m_notificationsUrl, entry));
connect(m_download.get(), &CacheDownload::succeeded, this,
&NotificationChecker::downloadSucceeded);
m_checkJob->addNetAction(m_download = Net::Download::makeCached(m_notificationsUrl, entry));
connect(m_download.get(), &Net::Download::succeeded, this, &NotificationChecker::downloadSucceeded);
m_checkJob->start();
}

View File

@ -3,7 +3,7 @@
#include <QObject>
#include "net/NetJob.h"
#include "net/CacheDownload.h"
#include "net/Download.h"
#include "multimc_logic_export.h"
@ -55,7 +55,7 @@ private:
QList<NotificationEntry> m_entries;
QUrl m_notificationsUrl;
NetJobPtr m_checkJob;
CacheDownloadPtr m_download;
Net::Download::Ptr m_download;
QString m_appVersionChannel;
QString m_appPlatform;