2013-12-20 13:47:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Task.h"
|
|
|
|
|
|
|
|
#include <QQueue>
|
|
|
|
#include <memory>
|
|
|
|
|
2021-07-25 18:11:59 +01:00
|
|
|
class SequentialTask : public Task
|
2013-12-20 13:47:26 +00:00
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
Q_OBJECT
|
2013-12-20 13:47:26 +00:00
|
|
|
public:
|
2018-07-15 13:51:05 +01:00
|
|
|
explicit SequentialTask(QObject *parent = 0);
|
|
|
|
virtual ~SequentialTask() {};
|
2013-12-20 13:47:26 +00:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
void addTask(std::shared_ptr<Task> task);
|
2013-12-20 13:47:26 +00:00
|
|
|
|
|
|
|
protected:
|
2018-07-15 13:51:05 +01:00
|
|
|
void executeTask();
|
2013-12-20 13:47:26 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
slots:
|
2018-07-15 13:51:05 +01:00
|
|
|
void startNext();
|
|
|
|
void subTaskFailed(const QString &msg);
|
|
|
|
void subTaskStatus(const QString &msg);
|
|
|
|
void subTaskProgress(qint64 current, qint64 total);
|
2013-12-20 13:47:26 +00:00
|
|
|
|
|
|
|
private:
|
2018-07-15 13:51:05 +01:00
|
|
|
QQueue<std::shared_ptr<Task> > m_queue;
|
|
|
|
int m_currentIndex;
|
2013-12-20 13:47:26 +00:00
|
|
|
};
|