Learn Environment
Loading...
Searching...
No Matches
task_manager.hpp
Go to the documentation of this file.
1#ifndef TASKMANAGER_HPP
2#define TASKMANAGER_HPP
3
4#include "task.hpp"
5#include "task_executor.hpp"
6
7#include <QObject>
8#include <QVector>
9#include <QSharedPointer>
10
11class TaskUI;
12
20class TaskManager : public QObject
21{
22 Q_OBJECT
23
24public:
30 TaskManager(TaskUI *taskUI, QObject *parent = nullptr);
31
37 void startStopSubtask(Subtask &subtask, bool startSolution = false);
38
43 void toggleSolution(Subtask &subtask);
44
45public Q_SLOTS:
49 void nextTask();
50
54 void previousTask();
55
60 void selectTask(int index);
61
66 void startStopSubtask(const Subtask &subtask);
67
71 void forceResetRobot();
72
73private Q_SLOTS:
74
78 void onTaskExecutionStarted();
79
83 void onTaskExecutionFinished();
84
89 void onTaskExecutionFailed(const QString &error);
90
94 void onResetRobotStarted();
95
99 void onResetRobotFinished();
100
105 void onResetRobotFailed(const QString &error);
106
107private:
108 TaskUI *taskUI;
109 TaskExecutor *taskExecutor;
110 QVector<QSharedPointer<Task>> tasks;
111 QVector<Subtask*> queued_and_running_subtasks;
112 int currentQueueStartSolution = false;
113 int currentTaskIndex;
114 bool resetRobotInProgress = false;
115
121 void startSubtask(Subtask &started_subtask, QSharedPointer<Task> &task, bool startSolution = false);
122
126 void initiateFirstSubtask();
127
131 void forceStop();
132
137 void logWithHashes(const QString &message);
138};
139
140#endif // TASKMANAGER_HPP
Executes tasks and manages their execution state.
Definition task_executor.hpp:19
Manages tasks and their execution within the application.
Definition task_manager.hpp:21
void nextTask()
Slot for changing to the next task.
Definition task_manager.cpp:110
void startStopSubtask(const Subtask &subtask)
Starts or stops a subtask.
void selectTask(int index)
Selects a task by its index.
Definition task_manager.cpp:85
void previousTask()
Slot for changing to the previous task.
Definition task_manager.cpp:117
void forceResetRobot()
Forces the reset of the robot to its initial state.
Definition task_manager.cpp:167
TaskManager(TaskUI *taskUI, QObject *parent=nullptr)
Constructs a TaskManager object.
Definition task_manager.cpp:11
void toggleSolution(Subtask &subtask)
Show or hide the solution of a subtask.
Definition task_manager.cpp:71
void startStopSubtask(Subtask &subtask, bool startSolution=false)
Starts or stops a subtask.
Definition task_manager.cpp:42
Manages the user interface for tasks and subtasks.
Definition task_ui.hpp:24
Represents a subtask within a task.
Definition task.hpp:31