diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-02-25 01:52:58 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-02-25 01:52:58 +0100 |
commit | acff15562431d5d9e9f091ed7cf912f5fe34a61a (patch) | |
tree | e78502e7eda84696632be9b6539d386b829053b2 /logic/tasks | |
parent | 49dc9695f5204bb80a91214c411bcb1b868ee0db (diff) | |
parent | 9d4e840a6e1a7169a2863fa1ff1812f8fe19e615 (diff) | |
download | MultiMC-acff15562431d5d9e9f091ed7cf912f5fe34a61a.tar MultiMC-acff15562431d5d9e9f091ed7cf912f5fe34a61a.tar.gz MultiMC-acff15562431d5d9e9f091ed7cf912f5fe34a61a.tar.lz MultiMC-acff15562431d5d9e9f091ed7cf912f5fe34a61a.tar.xz MultiMC-acff15562431d5d9e9f091ed7cf912f5fe34a61a.zip |
Merge branch 'feature_screenshots' into integration_json_and_tools
Conflicts:
logic/net/URLConstants.h
Resolve issues with multiple definitions of URL constants by moving them to their own object file.
Diffstat (limited to 'logic/tasks')
-rw-r--r-- | logic/tasks/SequentialTask.cpp | 15 | ||||
-rw-r--r-- | logic/tasks/SequentialTask.h | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/logic/tasks/SequentialTask.cpp b/logic/tasks/SequentialTask.cpp index 63025eee..e0f8fcdd 100644 --- a/logic/tasks/SequentialTask.cpp +++ b/logic/tasks/SequentialTask.cpp @@ -28,7 +28,7 @@ void SequentialTask::getProgress(qint64 ¤t, qint64 &total) } } -void SequentialTask::addTask(std::shared_ptr<Task> task) +void SequentialTask::addTask(std::shared_ptr<ProgressProvider> task) { m_queue.append(task); } @@ -43,7 +43,7 @@ void SequentialTask::startNext() { if (m_currentIndex != -1) { - std::shared_ptr<Task> previous = m_queue[m_currentIndex]; + std::shared_ptr<ProgressProvider> previous = m_queue[m_currentIndex]; disconnect(previous.get(), 0, this, 0); } m_currentIndex++; @@ -52,7 +52,7 @@ void SequentialTask::startNext() emitSucceeded(); return; } - std::shared_ptr<Task> next = m_queue[m_currentIndex]; + std::shared_ptr<ProgressProvider> next = m_queue[m_currentIndex]; connect(next.get(), SIGNAL(failed(QString)), this, SLOT(subTaskFailed(QString))); connect(next.get(), SIGNAL(status(QString)), this, SLOT(subTaskStatus(QString))); connect(next.get(), SIGNAL(progress(qint64,qint64)), this, SLOT(subTaskProgress())); @@ -73,5 +73,12 @@ void SequentialTask::subTaskProgress() { qint64 current, total; getProgress(current, total); - setProgress(100 * current / total); + if (total == 0) + { + setProgress(0); + } + else + { + setProgress(100 * current / total); + } } diff --git a/logic/tasks/SequentialTask.h b/logic/tasks/SequentialTask.h index 7f046928..c405dca3 100644 --- a/logic/tasks/SequentialTask.h +++ b/logic/tasks/SequentialTask.h @@ -14,7 +14,7 @@ public: virtual QString getStatus() const; virtual void getProgress(qint64 ¤t, qint64 &total); - void addTask(std::shared_ptr<Task> task); + void addTask(std::shared_ptr<ProgressProvider> task); protected: void executeTask(); @@ -27,6 +27,6 @@ slots: void subTaskProgress(); private: - QQueue<std::shared_ptr<Task> > m_queue; + QQueue<std::shared_ptr<ProgressProvider> > m_queue; int m_currentIndex; }; |