2013-12-20 19:17:26 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Task.h"
|
2021-11-20 21:38:34 +05:30
|
|
|
#include "QObjectPtr.h"
|
2013-12-20 19:17:26 +05:30
|
|
|
|
|
|
|
#include <QQueue>
|
|
|
|
|
2021-07-25 22:41:59 +05:30
|
|
|
class SequentialTask : public Task
|
2013-12-20 19:17:26 +05:30
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
Q_OBJECT
|
2013-12-20 19:17:26 +05:30
|
|
|
public:
|
2018-07-15 18:21:05 +05:30
|
|
|
explicit SequentialTask(QObject *parent = 0);
|
|
|
|
virtual ~SequentialTask() {};
|
2013-12-20 19:17:26 +05:30
|
|
|
|
2021-11-20 21:38:34 +05:30
|
|
|
void addTask(shared_qobject_ptr<Task> task);
|
2013-12-20 19:17:26 +05:30
|
|
|
|
|
|
|
protected:
|
2018-07-15 18:21:05 +05:30
|
|
|
void executeTask();
|
2013-12-20 19:17:26 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
slots:
|
2018-07-15 18:21:05 +05:30
|
|
|
void startNext();
|
|
|
|
void subTaskFailed(const QString &msg);
|
|
|
|
void subTaskStatus(const QString &msg);
|
|
|
|
void subTaskProgress(qint64 current, qint64 total);
|
2013-12-20 19:17:26 +05:30
|
|
|
|
|
|
|
private:
|
2021-11-20 21:38:34 +05:30
|
|
|
QQueue<shared_qobject_ptr<Task> > m_queue;
|
2018-07-15 18:21:05 +05:30
|
|
|
int m_currentIndex;
|
2013-12-20 19:17:26 +05:30
|
|
|
};
|