ViewController.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::ViewController
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 VIEWCONTROLLER_H
23 #define VIEWCONTROLLER_H
24 #include "AbstractController.h"
25 #include "../View/Perspectives.h"
26 #include "../Util/WheelEventFilter.h"
27 #include <QMouseEvent>
28 #include <QComboBox>
29 #include <QPushButton>
30 #include <QCheckBox>
31 
32 namespace armarx
33 {
34  /**
35  * @class ViewController
36  * @brief Subcontroller which handles all user interaction with the view
37  * selection area in the GUI, communicates with other controllers
38  * via signals and slots
39  */
41  {
42  Q_OBJECT
43 
44  public:
45  /**
46  * @brief @see AbstractController
47  */
48  void onInitComponent() override;
49 
50  /**
51  * @brief @see AbstractController
52  */
53  void onConnectComponent() override;
54 
55  /**
56  * @brief @see AbstractController
57  */
58  void onDisconnectComponent() override;
59 
60  /**
61  * @brief @see AbstractController
62  */
63  void onExitComponent() override;
64 
65  /**
66  * @brief Creates a new ViewController and assigns a Perspectives widget
67  * to handle
68  * @param guiPerspectives Pointer to the Perspectives whose user interaction
69  * is handled by the ViewController
70  */
71  ViewController(PerspectivesPtr guiPerspectives);
72 
73  /**
74  * @brief Getter for the Perspectives pointer to guiPerspectives
75  * @return A Pointer to the guiPerspectives
76  */
78 
79  /**
80  * @brief Setter for the Perspectives pointer to guiPerspectives
81  * @param guiPerspectives Pointer to the Perspectives whose user interaction
82  * is handled by the ViewController
83  */
84  void setGuiPerspectives(PerspectivesPtr guiPerspectives);
85 
86  public slots:
87  /**
88  * @brief Sets the perspective on the displayed robot model
89  * @param index Index of the perspective
90  */
91  void setViewPerspective(int index);
92 
93  /**
94  * @brief Retranslates the guiPerspectives
95  */
96  void retranslateGui();
97 
98  private slots:
99  void addViewSlot();
100  void removeViewSlot();
101 
102  signals:
103  /**
104  * @brief Notifies other controllers about changes of the perspective
105  * @param perspective Index of the current perspective
106  */
107  void changedPerspective(int perspective);
108 
109  /**
110  * @brief Notifies RobotVisualizationController to add a view
111  */
112  void addView();
113 
114  /**
115  * @brief Notifies RobotVisualizationController to delete a view
116  */
117  void removeView();
118 
119  private:
120  PerspectivesPtr guiPerspectives;
121  int numberViews;
122 
123  /**
124  * @brief Initializes the perspectives combo box
125  */
126  void initPerspectivesCombobox();
127 
128  void enableAddRemoveViewButton();
129  };
130 
131  using ViewControllerPtr = std::shared_ptr<ViewController>;
132 }
133 
134 #endif // VIEWCONTROLLER_H
armarx::ViewController::retranslateGui
void retranslateGui()
Retranslates the guiPerspectives.
Definition: ViewController.cpp:83
armarx::ViewController::addView
void addView()
Notifies RobotVisualizationController to add a view.
armarx::ViewController::onExitComponent
void onExitComponent() override
Definition: ViewController.cpp:56
armarx::ViewController::ViewController
ViewController(PerspectivesPtr guiPerspectives)
Creates a new ViewController and assigns a Perspectives widget to handle.
Definition: ViewController.cpp:61
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::ViewController::onInitComponent
void onInitComponent() override
Definition: ViewController.cpp:26
armarx::ViewController::changedPerspective
void changedPerspective(int perspective)
Notifies other controllers about changes of the perspective.
armarx::ViewController::onDisconnectComponent
void onDisconnectComponent() override
Definition: ViewController.cpp:51
armarx::ViewController::setGuiPerspectives
void setGuiPerspectives(PerspectivesPtr guiPerspectives)
Setter for the Perspectives pointer to guiPerspectives.
Definition: ViewController.cpp:73
armarx::ViewController::getGuiPerspectives
PerspectivesPtr getGuiPerspectives()
Getter for the Perspectives pointer to guiPerspectives.
Definition: ViewController.cpp:68
AbstractController.h
armarx::ViewController::removeView
void removeView()
Notifies RobotVisualizationController to delete a view.
armarx::ViewControllerPtr
std::shared_ptr< ViewController > ViewControllerPtr
Definition: ViewController.h:131
armarx::ViewController
Subcontroller which handles all user interaction with the view selection area in the GUI,...
Definition: ViewController.h:40
armarx::ViewController::setViewPerspective
void setViewPerspective(int index)
Sets the perspective on the displayed robot model.
Definition: ViewController.cpp:78
PerspectivesPtr
std::shared_ptr< Perspectives > PerspectivesPtr
Definition: Perspectives.h:51
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
armarx::ViewController::onConnectComponent
void onConnectComponent() override
Definition: ViewController.cpp:36