From da33fa4090b4510267d06b3fd3ec439ff563b80e Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Mon, 24 Feb 2014 11:30:27 +0100 Subject: Imgur album creation --- logic/tasks/SequentialTask.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'logic/tasks/SequentialTask.cpp') 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) +void SequentialTask::addTask(std::shared_ptr task) { m_queue.append(task); } @@ -43,7 +43,7 @@ void SequentialTask::startNext() { if (m_currentIndex != -1) { - std::shared_ptr previous = m_queue[m_currentIndex]; + std::shared_ptr 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 next = m_queue[m_currentIndex]; + std::shared_ptr 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); + } } -- cgit v1.2.3