ShortcutController.h
Go to the documentation of this file.
1#ifndef SHORTCUTCONTROLLER_H
2#define SHORTCUTCONTROLLER_H
3#include <QKeySequence>
4#include <QShortcut>
5#include <QString>
6
7#include "../View/ui_ShortcutDialog.h"
8#include "../ui_RobotTrajectoryDesignerGuiPluginWidget.h"
10
11namespace armarx
12{
14 {
15 Q_OBJECT
16
17 public:
18 /**
19 * @brief @see AbstractController
20 */
21 void onInitComponent() override;
22
23 /**
24 * @brief @see AbstractController
25 */
26 void onConnectComponent() override;
27
28 /**
29 * @brief @see AbstractController
30 */
31 void onDisconnectComponent() override;
32
33 /**
34 * @brief @see AbstractController
35 */
36 void onExitComponent() override;
37
38 /**
39 * @brief Creates a new ShortcutController
40 */
41 ShortcutController(QWidget* parent);
42
43 /**
44 * @brief Getter for the index of the currently selected waypoint
45 * @return Index of the currently selected waypoint
46 */
48
49 public slots:
50 /**
51 * @brief Setter for the index of the currently selected waypoint
52 * @param currentWaypoint Index of the currently selected waypoint
53 */
54 void setCurrentWaypoint(int currentWaypoint);
55
56 /**
57 * @brief Open the shortcutDialog
58 */
59 void open();
60
61 /**
62 * @brief Enables or disables the delete and change shortcut
63 * @param enable Determines whether to enable or disable the delete shortcut
64 */
65 void enableDeleteChangeShortcut(bool enable);
66
67 /**
68 * @brief Enables or disables the add shortcut
69 * @param enable Determines whether to enable or disable the add shortcut
70 */
71 void enableAddShortcut(bool enable);
72
73 /**
74 * @brief Enables or disables the prview shortcut
75 * @param enable Determines whether to enable or disable the previes shortcut
76 */
77 void enablePreviewShortcut(bool enable);
78
79 /**
80 * @brief Enables or disables the prview all shortcut
81 * @param enable Determines whether to enable or disable the previes shortcut
82 */
83 void enablePreviewAllShortcut(bool enable);
84
85 /**
86 * @brief Enables or disables the stop preview shortcut
87 * @param enable Determines whether to enable or disable the stop preview shortcut
88 */
89 void enableStopPreviewShortcut(bool enable);
90
91 /**
92 * @brief Enables or disables the redo shortcut
93 * @param enable Determines whether to enable or disable the redo shortcut
94 */
95 void enableRedoShortcut(bool enable);
96
97 /**
98 * @brief Enables or disables the undo shortcut
99 * @param enable Determines whether to enable or disable the undo shortcut
100 */
101 void enableUndoShortcut(bool enable);
102
103 private slots:
104 void addedWaypointSlot();
105 void deletedWaypointSlot();
106 void changeWaypointSlot();
107 void playPreviewSlot();
108 void playPreviewAllSlot();
109 void stopPreviewSlot();
110 void changedPerspectiveTopSlot();
111 void changedPerspectiveFrontSlot();
112 void changedPerspectiveBackSlot();
113 void changedPerspectiveLeftSlot();
114 void changedPerspectiveRightSlot();
115 void changedPerspectiveHighAngleSlot();
116 void undoOperation();
117 void redoOperation();
118 void enableSet();
119 void disableSet();
120
121 signals:
122 /*
123 * TODO: change parameterlist to bool, enum, add Index of waypoint?
124 */
125 /**
126 * @brief Add a waypoint at the waypointIndex
127 * @param index Index of the last waypoint
128 * @param isBreakpoint Boolean determining whether to set a breakpoint or not
129 */
130 void addedWaypoint(int index, bool insertAfter = true);
131
132 void addedWaypointPressed(bool pressed);
133
134 /**
135 * @brief Delete a waypoint at the waypointIndex
136 * @param index Index of the currently selected waypoint
137 */
139
140 /**
141 * @brief Notifies other controllers about the change of the currently
142 * selected waypoint
143 * @param index Index of the currently selected waypoint
144 */
146
147 /**
148 * @brief Starts a simulation of the current Trajectory
149 */
151
152 /**
153 * @brief Plays the preview of all trajectories
154 */
156
157 /**
158 * @brief Stop the preview of all trajectories
159 */
161
162 /**
163 * @brief Change the perspective in the robot visualization
164 * @param perspective Integer representing an enum for the different perspectives
165 */
166 void changedPerspective(int perspective);
167
168 /**
169 * @brief Notifies other controllers about undoing the lastly executed operation
170 */
171 void undo();
172
173 /**
174 * @brief Notifies other controllers about redoing the lastly undone operation
175 */
176 void redo();
177
178 private:
179 QWidget* parent;
180 int currentWaypoint;
181 QShortcut* deactivateSetWaypoint;
182 QShortcut* setWaypoint;
183 QShortcut* deleteWaypoint;
184 QShortcut* changeWaypointShortcut;
185 QShortcut* playPreview;
186 QShortcut* playPreviewAll;
187 QShortcut* stopPreview;
188 QShortcut* setPerspectiveTop;
189 QShortcut* setPerspectiveFront;
190 QShortcut* setPerspectiveBack;
191 QShortcut* setPerspectiveLeft;
192 QShortcut* setPerspectiveRight;
193 QShortcut* setPerspectiveHighAngle;
194 QShortcut* undoShortcut;
195 QShortcut* redoShortcut;
196 Ui::ShortcutDialog ui;
197 QDialog* shortcutDialog;
198 };
199
200 using ShortcutControllerPtr = std::shared_ptr<ShortcutController>;
201
202} // namespace armarx
203
204
205#endif // SHORTCUTCONTROLLER_H
uint8_t index
Abstract controller providing a set of methods which must be implemented by every controller.
void stopPreviewSignal()
Stop the preview of all trajectories.
void playPreviewSignal()
Starts a simulation of the current Trajectory.
ShortcutController(QWidget *parent)
Creates a new ShortcutController.
void undo()
Notifies other controllers about undoing the lastly executed operation.
void addedWaypointPressed(bool pressed)
void addedWaypoint(int index, bool insertAfter=true)
Add a waypoint at the waypointIndex.
void changedPerspective(int perspective)
Change the perspective in the robot visualization.
void changeWaypoint(int index)
Notifies other controllers about the change of the currently selected waypoint.
void enableDeleteChangeShortcut(bool enable)
Enables or disables the delete and change shortcut.
void enableRedoShortcut(bool enable)
Enables or disables the redo shortcut.
void deletedWaypoint(int index)
Delete a waypoint at the waypointIndex.
void playPreviewAllSignal()
Plays the preview of all trajectories.
void redo()
Notifies other controllers about redoing the lastly undone operation.
void enablePreviewAllShortcut(bool enable)
Enables or disables the prview all shortcut.
void open()
Open the shortcutDialog.
void enableUndoShortcut(bool enable)
Enables or disables the undo shortcut.
void setCurrentWaypoint(int currentWaypoint)
Setter for the index of the currently selected waypoint.
int getCurrentWaypoint()
Getter for the index of the currently selected waypoint.
void enablePreviewShortcut(bool enable)
Enables or disables the prview shortcut.
void enableAddShortcut(bool enable)
Enables or disables the add shortcut.
void enableStopPreviewShortcut(bool enable)
Enables or disables the stop preview shortcut.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< ShortcutController > ShortcutControllerPtr