From 89d3a66658ebdb16582a4d7a2cab57cfd6906393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 26 Jun 2017 01:14:32 +0200 Subject: NOISSUE some safe refactors and changes of the task subsystem Possibly also some bug fixes. --- api/logic/net/NetJob.h | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) (limited to 'api/logic/net/NetJob.h') diff --git a/api/logic/net/NetJob.h b/api/logic/net/NetJob.h index ca4f5df1..cd576664 100644 --- a/api/logic/net/NetJob.h +++ b/api/logic/net/NetJob.h @@ -32,30 +32,8 @@ class MULTIMC_LOGIC_EXPORT NetJob : public Task public: explicit NetJob(QString job_name) : Task(), m_job_name(job_name) {} virtual ~NetJob() {} - bool addNetAction(NetActionPtr action) - { - action->m_index_within_job = downloads.size(); - downloads.append(action); - part_info pi; - { - pi.current_progress = action->currentProgress(); - pi.total_progress = action->totalProgress(); - pi.failures = action->numberOfFailures(); - } - parts_progress.append(pi); - total_progress += pi.total_progress; - // if this is already running, the action needs to be started right away! - if (isRunning()) - { - setProgress(current_progress, total_progress); - connect(action.get(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int))); - connect(action.get(), SIGNAL(failed(int)), SLOT(partFailed(int))); - connect(action.get(), SIGNAL(netActionProgress(int, qint64, qint64)), - SLOT(partProgress(int, qint64, qint64))); - action->start(); - } - return true; - } + + bool addNetAction(NetActionPtr action); NetActionPtr operator[](int index) { @@ -75,10 +53,6 @@ public: { return downloads.size(); } - virtual bool isRunning() const override - { - return m_running; - } QStringList getFailedFiles(); bool canAbort() const override; @@ -113,6 +87,5 @@ private: QSet m_failed; qint64 current_progress = 0; qint64 total_progress = 0; - bool m_running = false; bool m_aborted = false; }; -- cgit v1.2.3