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 "../View/ToolBar.h"
25#include "AbstractController.h"
26
27namespace 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 */
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 */
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 */
180
181 /**
182 * @brief Plays the preview of all trajectories
183 */
185
186
187 /**
188 * @brief Plays the preview of the current trajectory
189 */
191
192 /**
193 * @brief stop the preview of the trajectories
194 */
196
197 private:
198 ToolBarPtr guiToolbar;
199 int currentWaypoint;
200 };
201
202 using ToolBarControllerPtr = std::shared_ptr<ToolBarController>;
203} // namespace armarx
204
205#endif // TOOLBARCONTROLLER_H
uint8_t index
std::shared_ptr< ToolBar > ToolBarPtr
Definition ToolBar.h:52
Abstract controller providing a set of methods which must be implemented by every controller.
void setGuiToolbar(ToolBarPtr guiToolbar)
Setter for the ToolBar pointer to guiToolbar.
void retranslateGui()
Retranslates the guiToolbar.
void enablePreviewButton(bool enable)
Enables or disables the prview button.
void addedWaypoint(int index, bool insertAfter=true)
Notifies other controllers about the addition of a waypoint at the current position of the TCP contro...
void enableDeleteChangeButton(bool enable)
Enables or disables the delete and change button.
void onDisconnectComponent() override
void changeWaypoint(int index)
Notifies other controllers about the change of the currently selected waypoint.
void enableAddButton(bool enable)
Enables or disables the add button.
void notifyAllPreview()
Plays the preview of all trajectories.
void deletedWaypoint(int index)
Notifies other controllers about the deletion of the currently selected waypoint.
ToolBarController(ToolBarPtr guiToolbar)
Creates a new ToolBarController and assigns a ToolBar to handle.
void notifyPreview()
Plays the preview of the current trajectory.
ToolBarPtr getGuiToolbar()
Getter for the ToolBar pointer to guiToolbar.
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 notifyStopPreview()
stop the preview of the trajectories
void enablePreviewAllButton(bool enable)
Enables or disables the prview all button.
void enableStopButton(bool enable)
Enables or disables the prview all button.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< ToolBarController > ToolBarControllerPtr