ToolBarController.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * \package RobotTrajectoryDesigner::gui-plugins::Controller::ToolBarController
17 * \author Max Beddies
18 * \date 2018
19 * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 #ifndef TOOLBARCONTROLLER_H
23 #define TOOLBARCONTROLLER_H
24 #include "AbstractController.h"
25 #include "../View/ToolBar.h"
26 
27 namespace armarx
28 {
29  /**
30  * @class ToolBarController
31  * @brief Subcontroller which handles all user interaction with the tool
32  * bar in the GUI, communicates with other controllers via signals
33  * and slots
34  */
36  {
37  Q_OBJECT
38 
39  public:
40  /**
41  * @brief @see AbstractController
42  */
43  void onInitComponent() override;
44 
45  /**
46  * @brief @see AbstractController
47  */
48  void onConnectComponent() override;
49 
50  /**
51  * @brief @see AbstractController
52  */
53  void onDisconnectComponent() override;
54 
55  /**
56  * @brief @see AbstractController
57  */
58  void onExitComponent() override;
59 
60  /**
61  * @brief Creates a new ToolBarController and assigns a ToolBar to handle
62  * @param guiToolbar Pointer to the ToolBar whose user interaction
63  * is handled by the ToolBarController
64  */
65  ToolBarController(ToolBarPtr guiToolbar);
66 
67  /**
68  * @brief Getter for the ToolBar pointer to guiToolbar
69  * @return A Pointer to the guiToolbar
70  */
72 
73  /**
74  * @brief Setter for the ToolBar pointer to guiToolbar
75  * @param guiToolbar Pointer to the ToolBar whose user interaction
76  * is handled by the ToolBarController
77  */
78  void setGuiToolbar(ToolBarPtr guiToolbar);
79 
80  /**
81  * @brief Getter for the index of the currently selected waypoint
82  * @return Index of the currently selected waypoint
83  */
84  int getCurrentWaypoint();
85 
86  public slots:
87  /**
88  * @brief Setter for the index of the currently selected waypoint
89  * @param currentWaypoint Index of the currently selected waypoint
90  */
91  void setCurrentWaypoint(int currentWaypoint);
92 
93  /**
94  * @brief Retranslates the guiToolbar
95  */
96  void retranslateGui();
97 
98  /**
99  * @brief Enables or disables the delete and change button
100  * @param enable Determines whether to enable or disable the delete button
101  */
102  void enableDeleteChangeButton(bool enable);
103 
104  /**
105  * @brief Enables or disables the add button
106  * @param enable Determines whether to enable or disable the add button
107  */
108  void enableAddButton(bool enable);
109 
110  /**
111  * @brief Enables or disables the prview button
112  * @param enable Determines whether to enable or disable the previes button
113  */
114  void enablePreviewButton(bool enable);
115 
116  /**
117  * @brief Enables or disables the prview all button
118  * @param enable Determines whether to enable or disable the previes button
119  */
120  void enablePreviewAllButton(bool enable);
121 
122  /**
123  * @brief Enables or disables the prview all button
124  * @param enable Determines whether to enable or disable the previes button
125  */
126  void enableStopButton(bool enable);
127 
128 
129  private slots:
130  /**
131  * @brief Adds a new waypoint at the current position of the TCP control
132  * unit after the last waypoint
133  */
134  void setWaypoint();
135 
136  /**
137  * @brief Deletes the currently selected waypoint
138  */
139  void deleteWaypoint();
140 
141  /**
142  * @brief Changes the currently selected waypoint
143  */
144  void changeWaypoint();
145 
146  /**
147  * @brief Plays a preview of all trajectories
148  */
149  void playAllPreview();
150 
151  /**
152  * @brief Plays a preview of the current trajectory
153  */
154  void playPreview();
155 
156  void stopPreview();
157 
158  signals:
159  /**
160  * @brief Notifies other controllers about the addition of a waypoint
161  * at the current position of the TCP control unit after the
162  * last waypoint
163  * @param constraints Constraints of the Waypoint: InsertAfter
164  */
165  void addedWaypoint(int index, bool insertAfter = true);
166 
167  /**
168  * @brief Notifies other controllers about the deletion of the currently
169  * selected waypoint
170  * @param index Index of the currently selected waypoint
171  */
172  void deletedWaypoint(int index);
173 
174  /**
175  * @brief Notifies other controllers about the change of the currently
176  * selected waypoint
177  * @param index Index of the currently selected waypoint
178  */
179  void changeWaypoint(int index);
180 
181  /**
182  * @brief Plays the preview of all trajectories
183  */
184  void notifyAllPreview();
185 
186 
187  /**
188  * @brief Plays the preview of the current trajectory
189  */
190  void notifyPreview();
191 
192  /**
193  * @brief stop the preview of the trajectories
194  */
195  void notifyStopPreview();
196 
197  private:
198  ToolBarPtr guiToolbar;
199  int currentWaypoint;
200  };
201 
202  using ToolBarControllerPtr = std::shared_ptr<ToolBarController>;
203 }
204 
205 #endif // TOOLBARCONTROLLER_H
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::ToolBarController::retranslateGui
void retranslateGui()
Retranslates the guiToolbar.
Definition: ToolBarController.cpp:137
armarx::ToolBarControllerPtr
std::shared_ptr< ToolBarController > ToolBarControllerPtr
Definition: ToolBarController.h:202
armarx::ToolBarController::onExitComponent
void onExitComponent() override
Definition: ToolBarController.cpp:71
armarx::ToolBarController::enableDeleteChangeButton
void enableDeleteChangeButton(bool enable)
Enables or disables the delete and change button.
Definition: ToolBarController.cpp:142
armarx::ToolBarController::addedWaypoint
void addedWaypoint(int index, bool insertAfter=true)
Notifies other controllers about the addition of a waypoint at the current position of the TCP contro...
armarx::ToolBarController::onDisconnectComponent
void onDisconnectComponent() override
Definition: ToolBarController.cpp:66
armarx::ToolBarController::deletedWaypoint
void deletedWaypoint(int index)
Notifies other controllers about the deletion of the currently selected waypoint.
armarx::ToolBarController::setCurrentWaypoint
void setCurrentWaypoint(int currentWaypoint)
Setter for the index of the currently selected waypoint.
Definition: ToolBarController.cpp:99
armarx::ToolBarController::getCurrentWaypoint
int getCurrentWaypoint()
Getter for the index of the currently selected waypoint.
Definition: ToolBarController.cpp:94
AbstractController.h
armarx::ToolBarController::enablePreviewAllButton
void enablePreviewAllButton(bool enable)
Enables or disables the prview all button.
Definition: ToolBarController.cpp:153
armarx::ToolBarController::setGuiToolbar
void setGuiToolbar(ToolBarPtr guiToolbar)
Setter for the ToolBar pointer to guiToolbar.
Definition: ToolBarController.cpp:89
armarx::ToolBarController::enableStopButton
void enableStopButton(bool enable)
Enables or disables the prview all button.
Definition: ToolBarController.cpp:163
armarx::ToolBarController::onConnectComponent
void onConnectComponent() override
Definition: ToolBarController.cpp:36
armarx::ToolBarController::notifyStopPreview
void notifyStopPreview()
stop the preview of the trajectories
armarx::ToolBarController
Subcontroller which handles all user interaction with the tool bar in the GUI, communicates with othe...
Definition: ToolBarController.h:35
armarx::ToolBarController::enableAddButton
void enableAddButton(bool enable)
Enables or disables the add button.
Definition: ToolBarController.cpp:148
armarx::ToolBarController::onInitComponent
void onInitComponent() override
Definition: ToolBarController.cpp:26
armarx::ToolBarController::enablePreviewButton
void enablePreviewButton(bool enable)
Enables or disables the prview button.
Definition: ToolBarController.cpp:158
armarx::ToolBarController::getGuiToolbar
ToolBarPtr getGuiToolbar()
Getter for the ToolBar pointer to guiToolbar.
Definition: ToolBarController.cpp:84
armarx::ToolBarController::notifyAllPreview
void notifyAllPreview()
Plays the preview of all trajectories.
armarx::ToolBarController::ToolBarController
ToolBarController(ToolBarPtr guiToolbar)
Creates a new ToolBarController and assigns a ToolBar to handle.
Definition: ToolBarController.cpp:76
ToolBarPtr
std::shared_ptr< ToolBar > ToolBarPtr
Definition: ToolBar.h:50
armarx::ToolBarController::notifyPreview
void notifyPreview()
Plays the preview of the current trajectory.
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