sneedmc/api/logic/tasks/SequentialTask.h

33 lines
614 B
C
Raw Normal View History

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