Imgur album creation
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user