From 0886786bb56e1ebfb53716127fd3ff0366e9a9f3 Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Sun, 11 Jan 2015 22:04:31 +0100 Subject: GH-721 Redo internal NetJob implementation. NetJob is now using its own task queue and does not start more than 6 actions at the same time --- logic/net/NetJob.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'logic/net/NetJob.h') diff --git a/logic/net/NetJob.h b/logic/net/NetJob.h index e8adcfa3..1b6f49b6 100644 --- a/logic/net/NetJob.h +++ b/logic/net/NetJob.h @@ -22,9 +22,10 @@ #include "CacheDownload.h" #include "HttpMetaCache.h" #include "logic/tasks/ProgressProvider.h" +#include "logic/QObjectPtr.h" class NetJob; -typedef std::shared_ptr NetJobPtr; +typedef QObjectPtr NetJobPtr; class NetJob : public ProgressProvider { @@ -81,18 +82,22 @@ public: return m_running; } QStringList getFailedFiles(); + +private: + void startMoreParts(); + signals: void started(); void progress(qint64 current, qint64 total); void succeeded(); void failed(); -public -slots: + +public slots: virtual void start(); // FIXME: implement virtual void abort() {}; -private -slots: + +private slots: void partProgress(int index, qint64 bytesReceived, qint64 bytesTotal); void partSucceeded(int index); void partFailed(int index); @@ -107,9 +112,11 @@ private: QString m_job_name; QList downloads; QList parts_progress; + QQueue m_todo; + QSet m_doing; + QSet m_done; + QSet m_failed; qint64 current_progress = 0; qint64 total_progress = 0; - int num_succeeded = 0; - int num_failed = 0; bool m_running = false; }; -- cgit