ToolBarController.cpp
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#include "ToolBarController.h"
23
24namespace armarx
25{
26 void
28 {
29 ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on init";
31 enableAddButton(false);
34 enableStopButton(false);
35 }
36
37 void
39 {
40 ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on connect";
41
42 // Set waypoint: clicked
43 QObject::connect(guiToolbar.get()->getToolBar()->setWaypointButton,
44 SIGNAL(clicked()),
45 this,
46 SLOT(setWaypoint()));
47
48 // Delete waypoint: clicked
49 QObject::connect(guiToolbar.get()->getToolBar()->deleteWaypointButton,
50 SIGNAL(clicked()),
51 this,
52 SLOT(deleteWaypoint()));
53
54 // Change Waypoint: clicked
55 QObject::connect(guiToolbar.get()->getToolBar()->changeWaypointButton,
56 SIGNAL(clicked()),
57 this,
58 SLOT(changeWaypoint()));
59
60 // Play preview: clicked
61 QObject::connect(guiToolbar.get()->getToolBar()->playPreviewButton,
62 SIGNAL(clicked()),
63 this,
64 SLOT(playPreview()));
65
66 // Play all preview: clicked
67 QObject::connect(guiToolbar.get()->getToolBar()->playPreviewAllButton,
68 SIGNAL(clicked()),
69 this,
70 SLOT(playAllPreview()));
71
72 // Stop preview: clicked
73 QObject::connect(guiToolbar.get()->getToolBar()->stopPreviewButton,
74 SIGNAL(clicked()),
75 this,
76 SLOT(stopPreview()));
77 }
78
79 void
81 {
82 ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on disconnect";
83 }
84
85 void
87 {
88 ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on exit";
89 }
90
92 guiToolbar(guiToolbar), currentWaypoint(0)
93 {
96 }
97
100 {
101 return this->guiToolbar;
102 }
103
104 void
106 {
107 this->guiToolbar = guiToolbar;
108 }
109
110 int
112 {
113 return this->currentWaypoint;
114 }
115
116 void
118 {
119 if (currentWaypoint >= 0)
120 {
121 this->currentWaypoint = currentWaypoint;
122 }
123 }
124
125 void
126 ToolBarController::setWaypoint()
127 {
128 emit addedWaypoint(this->currentWaypoint);
129 }
130
131 void
132 ToolBarController::deleteWaypoint()
133 {
134 emit deletedWaypoint(this->currentWaypoint);
135 }
136
137 void
138 ToolBarController::changeWaypoint()
139 {
140 emit changeWaypoint(this->currentWaypoint);
141 }
142
143 void
144 ToolBarController::playAllPreview()
145 {
146 emit notifyAllPreview();
147 }
148
149 void
150 ToolBarController::playPreview()
151 {
152 emit notifyPreview();
153 }
154
155 void
156 ToolBarController::stopPreview()
157 {
158 emit notifyStopPreview();
159 }
160
161 void
163 {
164 throw("not yet implemented");
165 }
166
167 void
169 {
170 guiToolbar->getToolBar()->changeWaypointButton->setEnabled(enable);
171 guiToolbar->getToolBar()->deleteWaypointButton->setEnabled(enable);
172 }
173
174 void
176 {
177 guiToolbar->getToolBar()->setWaypointButton->setEnabled(enable);
178 }
179
180 void
182 {
183 guiToolbar->getToolBar()->playPreviewAllButton->setEnabled(enable);
184 }
185
186 void
188 {
189 guiToolbar->getToolBar()->playPreviewButton->setEnabled(enable);
190 }
191
192 void
194 {
195 guiToolbar->getToolBar()->stopPreviewButton->setEnabled(enable);
196 }
197
198} // namespace armarx
std::shared_ptr< ToolBar > ToolBarPtr
Definition ToolBar.h:52
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 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.
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
This file offers overloads of toIce() and fromIce() functions for STL container types.