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 "AbstractController.h"
25 #include "../Util/WheelEventFilter.h"
26 
27 #include <QComboBox>
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  /**
44  * @brief @see AbstractController
45  */
46  void onInitComponent() override;
47 
48  /**
49  * @brief @see AbstractController
50  */
51  void onConnectComponent() override;
52 
53  /**
54  * @brief @see AbstractController
55  */
56  void onDisconnectComponent() override;
57 
58  /**
59  * @brief @see AbstractController
60  */
61  void onExitComponent() override;
62 
63  /**
64  * @brief Creates a new TCPSelectionController and assigns a QWidget to handle
65  * @param currentTCPCombobox Pointer to the QComboBox whose user interaction
66  * is handled by the TCPSelectionController
67  */
68  TCPSelectionController(QComboBox* currentTCPCombobox);
69 
70  /**
71  * @brief Getter for the QComboBox pointer to currentTCPCombobox
72  * @return A Pointer to the currentTCPCombobox
73  */
74  QComboBox* getCurrentTCPCombobox();
75 
76  /**
77  * @brief Setter for the QComboBox pointer to currentTCPCombobox
78  * @param currentTCPCombobox Pointer to the QComboBox whose user interaction
79  * is handled by the TCPSelectionController
80  */
81  void setCurrentTCPCombobox(QComboBox* currentTCPCombobox);
82 
83  public slots:
84  /**
85  * @brief Updates the currently displayed trajectory of the corresponding TCP
86  * @param trajectory String identifier of the trajectory
87  */
88  void updateSelectedTCP(QString trajectory);
89 
90  /**
91  * @brief Adds a new trajectory to the combobox of available trajectories
92  * @param trajectory String identifier of the trajectory
93  */
94  void addTrajectory(QString trajectory);
95 
96  /**
97  * @brief Removes the given trajectory from the TCP selection combo box
98  * @param trajectory String identifier of the trajectory
99  */
100  void removeTrajectory(QString trajectory);
101 
102  /**
103  * @brief Enables or disables the selected tcp combobox
104  * @param enable Determines whether to enable or disable the selected tcp combobox
105  */
106  void enableSelectedTCP(bool enable);
107 
108  /**
109  * @brief Removes all trajectorie is tcpComboBox
110  */
111  void removeAllTrajectories();
112 
113  private slots:
114  /**
115  * @brief Updates the currently displayed trajectory of the corresponding TCP
116  * @param index Index of the trajectory
117  */
118  void updateSelectedTCP(int index);
119 
120 
121  signals:
122  /**
123  * @brief Notifies other controllers about changes of the currently displayed trajectory
124  * @param index Index of the trajectory
125  */
126  void changedSelectedTCP(QString trajectory);
127 
128  private:
129  QComboBox* currentTCPCombobox;
130  };
131 
132  using TCPSelectionControllerPtr = std::shared_ptr<TCPSelectionController>;
133 }
134 
135 #endif // TCPSELECTIONCONTROLLER_H
armarx::TCPSelectionController::onExitComponent
void onExitComponent() override
Definition: TCPSelectionController.cpp:53
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::TCPSelectionController::removeAllTrajectories
void removeAllTrajectories()
Removes all trajectorie is tcpComboBox.
Definition: TCPSelectionController.cpp:130
armarx::TCPSelectionController::onDisconnectComponent
void onDisconnectComponent() override
Definition: TCPSelectionController.cpp:48
armarx::TCPSelectionController::addTrajectory
void addTrajectory(QString trajectory)
Adds a new trajectory to the combobox of available trajectories.
Definition: TCPSelectionController.cpp:96
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:39
armarx::TCPSelectionController::onInitComponent
void onInitComponent() override
Definition: TCPSelectionController.cpp:27
AbstractController.h
armarx::TCPSelectionController::setCurrentTCPCombobox
void setCurrentTCPCombobox(QComboBox *currentTCPCombobox)
Setter for the QComboBox pointer to currentTCPCombobox.
Definition: TCPSelectionController.cpp:70
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:65
armarx::TCPSelectionControllerPtr
std::shared_ptr< TCPSelectionController > TCPSelectionControllerPtr
Definition: TCPSelectionController.h:132
armarx::TCPSelectionController::enableSelectedTCP
void enableSelectedTCP(bool enable)
Enables or disables the selected tcp combobox.
Definition: TCPSelectionController.cpp:125
armarx::TCPSelectionController::updateSelectedTCP
void updateSelectedTCP(QString trajectory)
Updates the currently displayed trajectory of the corresponding TCP.
Definition: TCPSelectionController.cpp:86
armarx::TCPSelectionController::TCPSelectionController
TCPSelectionController(QComboBox *currentTCPCombobox)
Creates a new TCPSelectionController and assigns a QWidget to handle.
Definition: TCPSelectionController.cpp:58
armarx::TCPSelectionController::removeTrajectory
void removeTrajectory(QString trajectory)
Removes the given trajectory from the TCP selection combo box.
Definition: TCPSelectionController.cpp:111
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