Go to the documentation of this file. 1 #ifndef TASKMANAGER_HPP
2 #define TASKMANAGER_HPP
9 #include <QSharedPointer>
78 void onTaskExecutionStarted();
83 void onTaskExecutionFinished();
89 void onTaskExecutionFailed(
const QString &error);
94 void onResetRobotStarted();
99 void onResetRobotFinished();
105 void onResetRobotFailed(
const QString &error);
110 QVector<QSharedPointer<Task>> tasks;
111 QVector<Subtask*> queued_and_running_subtasks;
112 int currentQueueStartSolution =
false;
113 int currentTaskIndex;
114 bool resetRobotInProgress =
false;
121 void startSubtask(
Subtask &started_subtask, QSharedPointer<Task> &task,
bool startSolution =
false);
126 void initiateFirstSubtask();
137 void logWithHashes(
const QString &message);
140 #endif // TASKMANAGER_HPP
A class for converting Jupyter notebooks to Python scripts and processing task pools.
Definition: notebook_converter.hpp:23
void resetRobotStarted()
Signal emitted when robot reset starts.
Manages tasks and their execution within the application.
Definition: task_manager.hpp:20
SubtaskStatus status
The status of the subtask.
Definition: task.hpp:46
const QString DIFFICULTY_LEVELS_DEFINITION_PATH
Definition: folder_structure_constants.hpp:45
void setTaskUI(int currentTaskIndex, const QVector< QSharedPointer< Task >> &tasks)
Sets the UI elements for the current task.
void forceStop()
Forces the stop of all currently running tasks.
Definition: task_executor.cpp:62
@ Queued
The subtask is queued for execution.
QString lastExecutionError
The error message from the last execution of the subtask.
Definition: task.hpp:50
@ Running
The subtask is currently being executed.
QVector< QSharedPointer< Task > > loadTasks(const QString &taskPath, const QString &difficultyPath, const QString &topicPath)
Loads tasks with all configuration JSON files.
Definition: task_parser.cpp:33
Executes tasks and manages their execution state.
Definition: task_executor.hpp:19
void resetRobotFinished()
Signal emitted when robot reset finishes.
bool lastExecutionFailed
Whether the subtask has been executed at least once.
Definition: task.hpp:49
const QString TOPIC_DEFINITIONS_PATH
Path to the topic definitions json.
Definition: folder_structure_constants.hpp:39
QString solutionFilePath
The file path to the solution of the subtask.
Definition: task.hpp:36
void selectTask(int index)
Selects a task by its index.
Definition: task_manager.cpp:88
void updateSubtaskItemsUI()
Updates the UI elements for the subtasks.
@ Inactive
The subtask is inactive (state where it can't be executed).
Manages the user interface for tasks and subtasks.
Definition: task_ui.hpp:24
const QString TASK_DEFINITIONS_PATH
Path to the task definitions json.
Definition: folder_structure_constants.hpp:33
QString title
The title of the subtask.
Definition: task.hpp:32
void forceResetRobot()
Forces the reset of the robot to its initial state.
Definition: task_manager.cpp:170
TaskManager(TaskUI *taskUI, QObject *parent=nullptr)
Constructs a TaskManager object.
Definition: task_manager.cpp:11
void finishedRobotResetUI()
Update the UI to show that the robot reset has finished.
void toggleSolution(Subtask &subtask)
Show or hide the solution of a subtask.
Definition: task_manager.cpp:74
void nextTask()
Slot for changing to the next task.
Definition: task_manager.cpp:113
QWeakPointer< Task > parentTask
Weak pointer to the parent task.
Definition: task.hpp:45
void taskExecutionFinished()
Signal emitted when task execution finishes.
void processTaskPool()
Modifies and copies all notebooks from task_pool to users workspace.
Definition: notebook_converter.cpp:95
void taskExecutionStarted()
Signal emitted when task execution starts.
QString filePath
The file path of the subtask.
Definition: task.hpp:35
Parses tasks and subtasks from a JSON file.
Definition: task_parser.hpp:18
void setTaskManager(TaskManager *manager)
Sets the TaskManager object.
void executeTask(const Subtask &subtask, bool startSolution=false)
Executes a given subtask.
Definition: task_executor.cpp:10
void taskExecutionFailed(const QString &error)
Signal emitted when task execution fails.
void resetRobotFailed(const QString &error)
Signal emitted when robot reset fails.
void startedRobotResetUI(bool noSubtasksLeft)
Update the UI to show that the robot reset has been started.
void startStopSubtask(Subtask &subtask, bool startSolution=false)
Starts or stops a subtask.
Definition: task_manager.cpp:45
bool reset_robot_before_executing
Whether to reset the robot before executing the subtask.
Definition: task.hpp:42
@ Ready
The subtask is ready to be executed.
void previousTask()
Slot for changing to the previous task.
Definition: task_manager.cpp:120
void initializeUI(const QVector< QSharedPointer< Task >> &tasks)
Initializes the UI with the loaded tasks.
void toggleSolution(const QString &filePath, const QString &solutionFilePath)
Toggles the solution code in a Jupyter notebook.
Definition: notebook_converter.cpp:266
Represents a subtask within a task.
Definition: task.hpp:31
void resetRobot()
Triggers python script to reset the robot to its initial state and removes all objects from the scene...
Definition: task_executor.cpp:68
void failedRobotResetUI(const QString &error)
Update the UI to show that the robot reset has failed.