summaryrefslogtreecommitdiffstats
path: root/api/logic/updater/DownloadTask.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-05-28 19:54:17 +0200
committerPetr Mrázek <peterix@gmail.com>2016-06-05 23:55:39 +0200
commita1abbd9e05c80584d831b1d12c27c5f7d731cece (patch)
tree3324eaf37efa228e07a0e3136952673f0bc3405a /api/logic/updater/DownloadTask.cpp
parenta750f6e63c783730380c19788deff2acfb3f4836 (diff)
downloadMultiMC-a1abbd9e05c80584d831b1d12c27c5f7d731cece.tar
MultiMC-a1abbd9e05c80584d831b1d12c27c5f7d731cece.tar.gz
MultiMC-a1abbd9e05c80584d831b1d12c27c5f7d731cece.tar.lz
MultiMC-a1abbd9e05c80584d831b1d12c27c5f7d731cece.tar.xz
MultiMC-a1abbd9e05c80584d831b1d12c27c5f7d731cece.zip
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.
Diffstat (limited to 'api/logic/updater/DownloadTask.cpp')
-rw-r--r--api/logic/updater/DownloadTask.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/api/logic/updater/DownloadTask.cpp b/api/logic/updater/DownloadTask.cpp
index 6947e8bf..9bb31695 100644
--- a/api/logic/updater/DownloadTask.cpp
+++ b/api/logic/updater/DownloadTask.cpp
@@ -43,22 +43,19 @@ void DownloadTask::loadVersionInfo()
{
setStatus(tr("Loading version information..."));
- m_currentVersionFileListDownload.reset();
- m_newVersionFileListDownload.reset();
-
NetJob *netJob = new NetJob("Version Info");
// Find the index URL.
QUrl newIndexUrl = QUrl(m_status.newRepoUrl).resolved(QString::number(m_status.newVersionId) + ".json");
qDebug() << m_status.newRepoUrl << " turns into " << newIndexUrl;
- netJob->addNetAction(m_newVersionFileListDownload = ByteArrayDownload::make(newIndexUrl));
+ netJob->addNetAction(m_newVersionFileListDownload = Net::Download::makeByteArray(newIndexUrl, &newVersionFileListData));
// If we have a current version URL, get that one too.
if (!m_status.currentRepoUrl.isEmpty())
{
QUrl cIndexUrl = QUrl(m_status.currentRepoUrl).resolved(QString::number(m_status.currentVersionId) + ".json");
- netJob->addNetAction(m_currentVersionFileListDownload = ByteArrayDownload::make(cIndexUrl));
+ netJob->addNetAction(m_currentVersionFileListDownload = Net::Download::makeByteArray(cIndexUrl, &currentVersionFileListData));
qDebug() << m_status.currentRepoUrl << " turns into " << cIndexUrl;
}
@@ -92,7 +89,7 @@ void DownloadTask::processDownloadedVersionInfo()
setStatus(tr("Reading file list for new version..."));
qDebug() << "Reading file list for new version...";
QString error;
- if (!parseVersionInfo(m_newVersionFileListDownload->m_data, m_newVersionFileList, error))
+ if (!parseVersionInfo(newVersionFileListData, m_newVersionFileList, error))
{
qCritical() << error;
emitFailed(error);
@@ -106,7 +103,7 @@ void DownloadTask::processDownloadedVersionInfo()
qDebug() << "Reading file list for current version...";
// if this fails, it's not a complete loss.
QString error;
- if(!parseVersionInfo( m_currentVersionFileListDownload->m_data, m_currentVersionFileList, error))
+ if(!parseVersionInfo( currentVersionFileListData, m_currentVersionFileList, error))
{
qDebug() << error << "This is not a fatal error.";
}