2013-12-20 13:47:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Task.h"
|
2021-11-20 16:08:34 +00:00
|
|
|
#include "QObjectPtr.h"
|
2013-12-20 13:47:26 +00:00
|
|
|
|
|
|
|
#include <QQueue>
|
|
|
|
|
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
|
|
|
|
2021-11-21 22:36:55 +00:00
|
|
|
void addTask(Task::Ptr 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:
|
2021-11-21 22:36:55 +00:00
|
|
|
QQueue<Task::Ptr > m_queue;
|
2018-07-15 13:51:05 +01:00
|
|
|
int m_currentIndex;
|
2013-12-20 13:47:26 +00:00
|
|
|
};
|