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