Learn Environment
task_ui.hpp
Go to the documentation of this file.
1 #ifndef TASKUI_HPP
2 #define TASKUI_HPP
3 
4 #include "ui/sidebar.hpp"
5 #include "common/task.hpp"
7 #include "ui/execute_frame.hpp"
8 
9 #include <QObject>
10 #include <QVBoxLayout>
11 #include <QLabel>
12 #include <QToolButton>
13 #include <QPushButton>
14 #include <QFrame>
15 
24 class TaskUI : public QWidget {
25  Q_OBJECT
26 
27 public:
42  TaskUI(QVBoxLayout *subtaskListLayout, QLabel *mainTitleLabel,
43  QLabel *difficultyLabel, QLabel *folderLabel, QLabel *topicLabel,
44  QPushButton *nextButton, QPushButton *previousButton, QToolButton *menuButton,
45  QToolButton *resetRobotStartButton, QFrame *resetRobotFrame, QWidget *centralwidget, QWidget *parent = nullptr);
46 
51  void initializeUI(const QVector<QSharedPointer<Task>> &tasks);
52 
58  void setTaskUI(int currentTaskIndex, const QVector<QSharedPointer<Task>> &tasks);
59 
63  void updateSubtaskItemsUI();
64 
69  void setTaskManager(TaskManager *manager);
70 
75  void startedRobotResetUI(bool noSubtasksLeft);
76 
80  void finishedRobotResetUI();
81 
86  void failedRobotResetUI(const QString &error);
87 
88 Q_SIGNALS:
93  void taskSelected(int index);
94 
95 private Q_SLOTS:
99  void toggleSidebarVisibility();
100 
101 private:
102  Sidebar *sidebar;
103  QVBoxLayout *subtaskListLayout;
104  QLabel *mainTitleLabel;
105  QLabel *difficultyLabel;
106  QLabel *folderLabel;
107  QLabel *topicLabel;
108  QPushButton *nextButton;
109  QPushButton *previousButton;
110  QToolButton *menuButton;
111  QToolButton *resetRobotStartButton;
112  QFrame *resetRobotFrame;
113  ExecuteFrame *executeResetRobotFrame;
114  QWidget *centralwidget;
115  TaskManager *taskManager;
116 
122  void setSubtaskItems(int currentTaskIndex, const QVector<QSharedPointer<Task>> &tasks);
123 
127  void addLineBetweenWidgets();
128 
132  void setupSplitterAndLayout();
133 };
134 
135 #endif // TASKUI_HPP
QFrame
task.hpp
TaskManager
Manages tasks and their execution within the application.
Definition: task_manager.hpp:20
TaskUI::setTaskUI
void setTaskUI(int currentTaskIndex, const QVector< QSharedPointer< Task >> &tasks)
Sets the UI elements for the current task.
TaskUI::TaskUI
TaskUI(QVBoxLayout *subtaskListLayout, QLabel *mainTitleLabel, QLabel *difficultyLabel, QLabel *folderLabel, QLabel *topicLabel, QPushButton *nextButton, QPushButton *previousButton, QToolButton *menuButton, QToolButton *resetRobotStartButton, QFrame *resetRobotFrame, QWidget *centralwidget, QWidget *parent=nullptr)
Constructs a TaskUI object.
Sidebar
Represents the sidebar UI component for displaying tasks.
Definition: sidebar.hpp:22
subtask_item.hpp
Sidebar::selectTask
void selectTask(int index)
Selects a task in the sidebar by its index.
Definition: sidebar.cpp:114
TaskManager::selectTask
void selectTask(int index)
Selects a task by its index.
Definition: task_manager.cpp:88
TaskUI::updateSubtaskItemsUI
void updateSubtaskItemsUI()
Updates the UI elements for the subtasks.
QWidget
TaskUI
Manages the user interface for tasks and subtasks.
Definition: task_ui.hpp:24
execute_frame.hpp
sidebar.hpp
TaskManager::forceResetRobot
void forceResetRobot()
Forces the reset of the robot to its initial state.
Definition: task_manager.cpp:170
TaskUI::finishedRobotResetUI
void finishedRobotResetUI()
Update the UI to show that the robot reset has finished.
TaskManager::nextTask
void nextTask()
Slot for changing to the next task.
Definition: task_manager.cpp:113
Sidebar::taskSelected
void taskSelected(int index)
Signal emitted when a task is selected.
Sidebar::fillSidebarWithTasks
void fillSidebarWithTasks(const QVector< QSharedPointer< Task >> &tasks)
Populates the sidebar with tasks.
Definition: sidebar.cpp:64
ExecuteFrame::setImage
void setImage(const QString &path)
Sets the image to be displayed.
Definition: execute_frame.cpp:52
TaskUI::setTaskManager
void setTaskManager(TaskManager *manager)
Sets the TaskManager object.
SubtaskItem
Represents a UI item for a subtask.
Definition: subtask_item.hpp:25
ExecuteFrame::getText
QString getText()
Gets the current text being displayed.
Definition: execute_frame.cpp:93
ExecuteFrame::setText
void setText(const QString &text)
Sets the text to be displayed.
Definition: execute_frame.cpp:84
TaskUI::startedRobotResetUI
void startedRobotResetUI(bool noSubtasksLeft)
Update the UI to show that the robot reset has been started.
task_manager.hpp
TaskManager::previousTask
void previousTask()
Slot for changing to the previous task.
Definition: task_manager.cpp:120
TaskUI::initializeUI
void initializeUI(const QVector< QSharedPointer< Task >> &tasks)
Initializes the UI with the loaded tasks.
TaskUI::taskSelected
void taskSelected(int index)
Signal emitted when a task is selected.
SubtaskItem::updateUI
void updateUI(bool constructorCall=false)
Updates the UI elements based on the subtask's status.
Definition: subtask_item.cpp:88
Subtask
Represents a subtask within a task.
Definition: task.hpp:31
ExecuteFrame
A custom QFrame that displays an image and text. For logging and task execution.
Definition: execute_frame.hpp:13
SubtaskItem::setTaskManager
void setTaskManager(TaskManager *manager)
Sets the TaskManager object.
Definition: subtask_item.cpp:151
TaskUI::failedRobotResetUI
void failedRobotResetUI(const QString &error)
Update the UI to show that the robot reset has failed.
task_ui.hpp