diff options
Diffstat (limited to 'api/logic/net/NetJob.h')
-rw-r--r-- | api/logic/net/NetJob.h | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/api/logic/net/NetJob.h b/api/logic/net/NetJob.h index ca4f5df1..be58c61a 100644 --- a/api/logic/net/NetJob.h +++ b/api/logic/net/NetJob.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2017 MultiMC Contributors +/* Copyright 2013-2018 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,32 +30,13 @@ class MULTIMC_LOGIC_EXPORT NetJob : public Task { Q_OBJECT public: - explicit NetJob(QString job_name) : Task(), m_job_name(job_name) {} - virtual ~NetJob() {} - bool addNetAction(NetActionPtr action) + explicit NetJob(QString job_name) : Task() { - 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; + setObjectName(job_name); } + virtual ~NetJob() {} + + bool addNetAction(NetActionPtr action); NetActionPtr operator[](int index) { @@ -75,10 +56,6 @@ public: { return downloads.size(); } - virtual bool isRunning() const override - { - return m_running; - } QStringList getFailedFiles(); bool canAbort() const override; @@ -102,17 +79,13 @@ private: qint64 current_progress = 0; qint64 total_progress = 1; int failures = 0; - bool connected = false; }; - QString m_job_name; QList<NetActionPtr> downloads; QList<part_info> parts_progress; QQueue<int> m_todo; QSet<int> m_doing; QSet<int> m_done; QSet<int> m_failed; - qint64 current_progress = 0; - qint64 total_progress = 0; - bool m_running = false; + qint64 m_current_progress = 0; bool m_aborted = false; }; |