ShortcutController.h
Go to the documentation of this file.
1 #ifndef SHORTCUTCONTROLLER_H
2 #define SHORTCUTCONTROLLER_H
3 #include <QShortcut>
4 #include <QString>
5 #include <QKeySequence>
6 #include "AbstractController.h"
7 #include "../ui_RobotTrajectoryDesignerGuiPluginWidget.h"
8 #include "../View/ui_ShortcutDialog.h"
9 
10 
11 namespace 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  */
47  int getCurrentWaypoint();
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  */
138  void deletedWaypoint(int index);
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  */
145  void changeWaypoint(int index);
146 
147  /**
148  * @brief Starts a simulation of the current Trajectory
149  */
150  void playPreviewSignal();
151 
152  /**
153  * @brief Plays the preview of all trajectories
154  */
155  void playPreviewAllSignal();
156 
157  /**
158  * @brief Stop the preview of all trajectories
159  */
160  void stopPreviewSignal();
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 
201  };
202  using ShortcutControllerPtr = std::shared_ptr<ShortcutController>;
203 
204 }
205 
206 
207 #endif // SHORTCUTCONTROLLER_H
armarx::ShortcutController::undo
void undo()
Notifies other controllers about undoing the lastly executed operation.
armarx::ShortcutController
Definition: ShortcutController.h:13
armarx::ShortcutController::stopPreviewSignal
void stopPreviewSignal()
Stop the preview of all trajectories.
armarx::ShortcutController::ShortcutController
ShortcutController(QWidget *parent)
Creates a new ShortcutController.
Definition: ShortcutController.cpp:66
armarx::ShortcutController::changedPerspective
void changedPerspective(int perspective)
Change the perspective in the robot visualization.
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::ShortcutController::getCurrentWaypoint
int getCurrentWaypoint()
Getter for the index of the currently selected waypoint.
Definition: ShortcutController.cpp:74
armarx::ShortcutController::onConnectComponent
void onConnectComponent() override
Definition: ShortcutController.cpp:33
armarx::ShortcutController::enableAddShortcut
void enableAddShortcut(bool enable)
Enables or disables the add shortcut.
Definition: ShortcutController.cpp:119
armarx::ShortcutControllerPtr
std::shared_ptr< ShortcutController > ShortcutControllerPtr
Definition: ShortcutController.h:202
AbstractController.h
armarx::ShortcutController::enableDeleteChangeShortcut
void enableDeleteChangeShortcut(bool enable)
Enables or disables the delete and change shortcut.
Definition: ShortcutController.cpp:113
armarx::ShortcutController::onExitComponent
void onExitComponent() override
Definition: ShortcutController.cpp:61
armarx::ShortcutController::setCurrentWaypoint
void setCurrentWaypoint(int currentWaypoint)
Setter for the index of the currently selected waypoint.
Definition: ShortcutController.cpp:79
armarx::ShortcutController::playPreviewAllSignal
void playPreviewAllSignal()
Plays the preview of all trajectories.
armarx::ShortcutController::addedWaypointPressed
void addedWaypointPressed(bool pressed)
armarx::ShortcutController::redo
void redo()
Notifies other controllers about redoing the lastly undone operation.
armarx::ShortcutController::onInitComponent
void onInitComponent() override
Definition: ShortcutController.cpp:5
armarx::ShortcutController::deletedWaypoint
void deletedWaypoint(int index)
Delete a waypoint at the waypointIndex.
armarx::ShortcutController::enableStopPreviewShortcut
void enableStopPreviewShortcut(bool enable)
Enables or disables the stop preview shortcut.
Definition: ShortcutController.cpp:98
armarx::ShortcutController::enableRedoShortcut
void enableRedoShortcut(bool enable)
Enables or disables the redo shortcut.
Definition: ShortcutController.cpp:103
armarx::ShortcutController::addedWaypoint
void addedWaypoint(int index, bool insertAfter=true)
Add a waypoint at the waypointIndex.
armarx::ShortcutController::enablePreviewShortcut
void enablePreviewShortcut(bool enable)
Enables or disables the prview shortcut.
Definition: ShortcutController.cpp:124
armarx::ShortcutController::playPreviewSignal
void playPreviewSignal()
Starts a simulation of the current Trajectory.
armarx::ShortcutController::open
void open()
Open the shortcutDialog.
Definition: ShortcutController.cpp:87
armarx::ShortcutController::changeWaypoint
void changeWaypoint(int index)
Notifies other controllers about the change of the currently selected waypoint.
armarx::ShortcutController::onDisconnectComponent
void onDisconnectComponent() override
Definition: ShortcutController.cpp:56
armarx::ShortcutController::enablePreviewAllShortcut
void enablePreviewAllShortcut(bool enable)
Enables or disables the prview all shortcut.
Definition: ShortcutController.cpp:93
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::AbstractController
Abstract controller providing a set of methods which must be implemented by every controller.
Definition: AbstractController.h:35
armarx::ShortcutController::enableUndoShortcut
void enableUndoShortcut(bool enable)
Enables or disables the undo shortcut.
Definition: ShortcutController.cpp:108