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 
24 namespace armarx
25 {
27  {
28  ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on init";
30  enableAddButton(false);
31  enablePreviewButton(false);
33  enableStopButton(false);
34  }
35 
37  {
38  ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on connect";
39 
40  // Set waypoint: clicked
41  QObject::connect(guiToolbar.get()->getToolBar()->setWaypointButton, SIGNAL(clicked()),
42  this, SLOT(setWaypoint()));
43 
44  // Delete waypoint: clicked
45  QObject::connect(guiToolbar.get()->getToolBar()->deleteWaypointButton, SIGNAL(clicked()),
46  this, SLOT(deleteWaypoint()));
47 
48  // Change Waypoint: clicked
49  QObject::connect(guiToolbar.get()->getToolBar()->changeWaypointButton, SIGNAL(clicked()),
50  this, SLOT(changeWaypoint()));
51 
52  // Play preview: clicked
53  QObject::connect(guiToolbar.get()->getToolBar()->playPreviewButton, SIGNAL(clicked()),
54  this, SLOT(playPreview()));
55 
56  // Play all preview: clicked
57  QObject::connect(guiToolbar.get()->getToolBar()->playPreviewAllButton, SIGNAL(clicked()),
58  this, SLOT(playAllPreview()));
59 
60  // Stop preview: clicked
61  QObject::connect(guiToolbar.get()->getToolBar()->stopPreviewButton, SIGNAL(clicked()),
62  this, SLOT(stopPreview()));
63 
64  }
65 
67  {
68  ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on disconnect";
69  }
70 
72  {
73  ARMARX_INFO << "RobotTrajectoryDesigner: ToolBarController on exit";
74  }
75 
77  guiToolbar(guiToolbar),
78  currentWaypoint(0)
79  {
82  }
83 
85  {
86  return this->guiToolbar;
87  }
88 
90  {
91  this->guiToolbar = guiToolbar;
92  }
93 
95  {
96  return this->currentWaypoint;
97  }
98 
99  void ToolBarController::setCurrentWaypoint(int currentWaypoint)
100  {
101  if (currentWaypoint >= 0)
102  {
103  this->currentWaypoint = currentWaypoint;
104  }
105  }
106 
107  void ToolBarController::setWaypoint()
108  {
109  emit addedWaypoint(this->currentWaypoint);
110  }
111 
112  void ToolBarController::deleteWaypoint()
113  {
114  emit deletedWaypoint(this->currentWaypoint);
115  }
116 
117  void ToolBarController::changeWaypoint()
118  {
119  emit changeWaypoint(this->currentWaypoint);
120  }
121 
122  void ToolBarController::playAllPreview()
123  {
124  emit notifyAllPreview();
125  }
126 
127  void ToolBarController::playPreview()
128  {
129  emit notifyPreview();
130  }
131 
132  void ToolBarController::stopPreview()
133  {
134  emit notifyStopPreview();
135  }
136 
138  {
139  throw ("not yet implemented");
140  }
141 
143  {
144  guiToolbar->getToolBar()->changeWaypointButton->setEnabled(enable);
145  guiToolbar->getToolBar()->deleteWaypointButton->setEnabled(enable);
146  }
147 
149  {
150  guiToolbar->getToolBar()->setWaypointButton->setEnabled(enable);
151  }
152 
154  {
155  guiToolbar->getToolBar()->playPreviewAllButton->setEnabled(enable);
156  }
157 
159  {
160  guiToolbar->getToolBar()->playPreviewButton->setEnabled(enable);
161  }
162 
164  {
165  guiToolbar->getToolBar()->stopPreviewButton->setEnabled(enable);
166  }
167 
168 }
armarx::ToolBarController::retranslateGui
void retranslateGui()
Retranslates the guiToolbar.
Definition: ToolBarController.cpp:137
armarx::ToolBarController::onExitComponent
void onExitComponent() override
Definition: ToolBarController.cpp:71
ToolBarController.h
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
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_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::ToolBarController::onConnectComponent
void onConnectComponent() override
Definition: ToolBarController.cpp:36
armarx::ToolBarController::notifyStopPreview
void notifyStopPreview()
stop the preview of the trajectories
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