From e1465f4848d003cab3d3d1288c1a0f3b945083ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 29 Apr 2017 02:24:00 +0200 Subject: NOISSUE refactor NetAction to be based on Task Still missing some things, this is part 1. --- api/logic/updater/DownloadTask.cpp | 16 ++++++++-------- api/logic/updater/DownloadTask.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'api/logic/updater') diff --git a/api/logic/updater/DownloadTask.cpp b/api/logic/updater/DownloadTask.cpp index 0d40f78a..0d364bfc 100644 --- a/api/logic/updater/DownloadTask.cpp +++ b/api/logic/updater/DownloadTask.cpp @@ -26,7 +26,7 @@ namespace GoUpdate { -DownloadTask::DownloadTask(Status status, QString target, QObject *parent) +DownloadTask::DownloadTask(GoUpdate::Status status, QString target, QObject *parent) : Task(parent), m_updateFilesDir(target) { m_status = status; @@ -41,7 +41,7 @@ void DownloadTask::executeTask() void DownloadTask::loadVersionInfo() { - setStatus(tr("Loading version information...")); + setStatusText(tr("Loading version information...")); NetJob *netJob = new NetJob("Version Info"); @@ -70,7 +70,7 @@ void DownloadTask::vinfoDownloadFailed() { // Something failed. We really need the second download (current version info), so parse // downloads anyways as long as the first one succeeded. - if (m_newVersionFileListDownload->m_status != Job_Failed) + if (m_newVersionFileListDownload->m_status != Status::Failed) { processDownloadedVersionInfo(); return; @@ -86,7 +86,7 @@ void DownloadTask::processDownloadedVersionInfo() VersionFileList m_currentVersionFileList; VersionFileList m_newVersionFileList; - setStatus(tr("Reading file list for new version...")); + setStatusText(tr("Reading file list for new version...")); qDebug() << "Reading file list for new version..."; QString error; if (!parseVersionInfo(newVersionFileListData, m_newVersionFileList, error)) @@ -97,9 +97,9 @@ void DownloadTask::processDownloadedVersionInfo() } // if we have the current version info, use it. - if (m_currentVersionFileListDownload && m_currentVersionFileListDownload->m_status != Job_Failed) + if (m_currentVersionFileListDownload && m_currentVersionFileListDownload->m_status != Status::Failed) { - setStatus(tr("Reading file list for current version...")); + setStatusText(tr("Reading file list for current version...")); qDebug() << "Reading file list for current version..."; // if this fails, it's not a complete loss. QString error; @@ -114,7 +114,7 @@ void DownloadTask::processDownloadedVersionInfo() m_newVersionFileListDownload.reset(); m_vinfoNetJob.reset(); - setStatus(tr("Processing file lists - figuring out how to install the update...")); + setStatusText(tr("Processing file lists - figuring out how to install the update...")); // make a new netjob for the actual update files NetJobPtr netJob (new NetJob("Update Files")); @@ -131,7 +131,7 @@ void DownloadTask::processDownloadedVersionInfo() QObject::connect(netJob.get(), &NetJob::progress, this, &DownloadTask::fileDownloadProgressChanged); QObject::connect(netJob.get(), &NetJob::failed, this, &DownloadTask::fileDownloadFailed); - setStatus(tr("Downloading %1 update files.").arg(QString::number(netJob->size()))); + setStatusText(tr("Downloading %1 update files.").arg(QString::number(netJob->size()))); qDebug() << "Begin downloading update files to" << m_updateFilesDir.path(); m_filesNetJob = netJob; m_filesNetJob->start(); diff --git a/api/logic/updater/DownloadTask.h b/api/logic/updater/DownloadTask.h index bcbe9736..c59b9b94 100644 --- a/api/logic/updater/DownloadTask.h +++ b/api/logic/updater/DownloadTask.h @@ -37,7 +37,7 @@ public: * * target is a template - XXXXXX at the end will be replaced with a random generated string, ensuring uniqueness */ - explicit DownloadTask(Status status, QString target, QObject* parent = 0); + explicit DownloadTask(GoUpdate::Status status, QString target, QObject* parent = 0); /// Get the directory that will contain the update files. QString updateFilesDir(); @@ -71,7 +71,7 @@ protected: NetJobPtr m_filesNetJob; - Status m_status; + GoUpdate::Status m_status; OperationList m_operations; -- cgit v1.2.3