TCPSelectionController.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::TCPSelectionController
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 TCPSELECTIONCONTROLLER_H
23 #define TCPSELECTIONCONTROLLER_H
24 #include <QComboBox>
25 
26 #include "../Util/WheelEventFilter.h"
27 #include "AbstractController.h"
28 
29 namespace armarx
30 {
31  /**
32  * @class TCPSelectionController
33  * @brief Subcontroller which handles all user interaction with the active TCP
34  * selection in the GUI, communicates with other controllers via
35  * signals and slots
36  */
38  {
39  Q_OBJECT
40 
41  public:
42  /**
43  * @brief @see AbstractController
44  */
45  void onInitComponent() override;
46 
47  /**
48  * @brief @see AbstractController
49  */
50  void onConnectComponent() override;
51 
52  /**
53  * @brief @see AbstractController
54  */
55  void onDisconnectComponent() override;
56 
57  /**
58  * @brief @see AbstractController
59  */
60  void onExitComponent() override;
61 
62  /**
63  * @brief Creates a new TCPSelectionController and assigns a QWidget to handle
64  * @param currentTCPCombobox Pointer to the QComboBox whose user interaction
65  * is handled by the TCPSelectionController
66  */
67  TCPSelectionController(QComboBox* currentTCPCombobox);
68 
69  /**
70  * @brief Getter for the QComboBox pointer to currentTCPCombobox
71  * @return A Pointer to the currentTCPCombobox
72  */
73  QComboBox* getCurrentTCPCombobox();
74 
75  /**
76  * @brief Setter for the QComboBox pointer to currentTCPCombobox
77  * @param currentTCPCombobox Pointer to the QComboBox whose user interaction
78  * is handled by the TCPSelectionController
79  */
80  void setCurrentTCPCombobox(QComboBox* currentTCPCombobox);
81 
82  public slots:
83  /**
84  * @brief Updates the currently displayed trajectory of the corresponding TCP
85  * @param trajectory String identifier of the trajectory
86  */
87  void updateSelectedTCP(QString trajectory);
88 
89  /**
90  * @brief Adds a new trajectory to the combobox of available trajectories
91  * @param trajectory String identifier of the trajectory
92  */
93  void addTrajectory(QString trajectory);
94 
95  /**
96  * @brief Removes the given trajectory from the TCP selection combo box
97  * @param trajectory String identifier of the trajectory
98  */
99  void removeTrajectory(QString trajectory);
100 
101  /**
102  * @brief Enables or disables the selected tcp combobox
103  * @param enable Determines whether to enable or disable the selected tcp combobox
104  */
105  void enableSelectedTCP(bool enable);
106 
107  /**
108  * @brief Removes all trajectorie is tcpComboBox
109  */
110  void removeAllTrajectories();
111 
112  private slots:
113  /**
114  * @brief Updates the currently displayed trajectory of the corresponding TCP
115  * @param index Index of the trajectory
116  */
117  void updateSelectedTCP(int index);
118 
119 
120  signals:
121  /**
122  * @brief Notifies other controllers about changes of the currently displayed trajectory
123  * @param index Index of the trajectory
124  */
125  void changedSelectedTCP(QString trajectory);
126 
127  private:
128  QComboBox* currentTCPCombobox;
129  };
130 
131  using TCPSelectionControllerPtr = std::shared_ptr<TCPSelectionController>;
132 } // namespace armarx
133 
134 #endif // TCPSELECTIONCONTROLLER_H
armarx::TCPSelectionController::onExitComponent
void onExitComponent() override
Definition: TCPSelectionController.cpp:58
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::TCPSelectionController::removeAllTrajectories
void removeAllTrajectories()
Removes all trajectorie is tcpComboBox.
Definition: TCPSelectionController.cpp:143
armarx::TCPSelectionController::onDisconnectComponent
void onDisconnectComponent() override
Definition: TCPSelectionController.cpp:52
armarx::TCPSelectionController::addTrajectory
void addTrajectory(QString trajectory)
Adds a new trajectory to the combobox of available trajectories.
Definition: TCPSelectionController.cpp:106
armarx::TCPSelectionController
Subcontroller which handles all user interaction with the active TCP selection in the GUI,...
Definition: TCPSelectionController.h:37
armarx::TCPSelectionController::onConnectComponent
void onConnectComponent() override
Definition: TCPSelectionController.cpp:42
armarx::TCPSelectionController::onInitComponent
void onInitComponent() override
Definition: TCPSelectionController.cpp:29
AbstractController.h
armarx::TCPSelectionController::setCurrentTCPCombobox
void setCurrentTCPCombobox(QComboBox *currentTCPCombobox)
Setter for the QComboBox pointer to currentTCPCombobox.
Definition: TCPSelectionController.cpp:77
armarx::TCPSelectionController::changedSelectedTCP
void changedSelectedTCP(QString trajectory)
Notifies other controllers about changes of the currently displayed trajectory.
armarx::TCPSelectionController::getCurrentTCPCombobox
QComboBox * getCurrentTCPCombobox()
Getter for the QComboBox pointer to currentTCPCombobox.
Definition: TCPSelectionController.cpp:71
armarx::TCPSelectionControllerPtr
std::shared_ptr< TCPSelectionController > TCPSelectionControllerPtr
Definition: TCPSelectionController.h:131
armarx::TCPSelectionController::enableSelectedTCP
void enableSelectedTCP(bool enable)
Enables or disables the selected tcp combobox.
Definition: TCPSelectionController.cpp:137
armarx::TCPSelectionController::updateSelectedTCP
void updateSelectedTCP(QString trajectory)
Updates the currently displayed trajectory of the corresponding TCP.
Definition: TCPSelectionController.cpp:95
armarx::TCPSelectionController::TCPSelectionController
TCPSelectionController(QComboBox *currentTCPCombobox)
Creates a new TCPSelectionController and assigns a QWidget to handle.
Definition: TCPSelectionController.cpp:63
armarx::TCPSelectionController::removeTrajectory
void removeTrajectory(QString trajectory)
Removes the given trajectory from the TCP selection combo box.
Definition: TCPSelectionController.cpp:122
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::AbstractController
Abstract controller providing a set of methods which must be implemented by every controller.
Definition: AbstractController.h:37