NJointControllerGuiPluginBase.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 RobotAPI::ArmarXObjects::NJointControllerGuiPluginUtility
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <mutex>
26 
27 #include <VirtualRobot/VirtualRobot.h>
28 
31 
35 
36 #include <RobotAPI/interface/core/RobotState.h>
39 
41 {
42  class Base :
44  public virtual RobotUnitComponentPluginUser,
45  public virtual RobotStateComponentPluginUser
46  {
47  Q_OBJECT
48  public:
49  virtual NJointControllerConfigPtr readFullCFG() const = 0;
50  std::string getControllerName() const;
51  public Q_SLOTS: //for some reason using slots does not work -> use Q_SLOTS
52  virtual void createController();
53  virtual void activateController();
54  virtual void deactivateController();
55  virtual void deleteController();
56  private Q_SLOTS:
57  void doSetupGuiAfterConnect();
58 
59  public:
60  Base();
61  ~Base() override;
62 
63  void connectCreateAcivateDeactivateDelete(QPushButton* cr,
64  QPushButton* ac,
65  QPushButton* dc,
66  QPushButton* de);
67 
68  public:
69  void loadSettings(QSettings* settings) override;
70  void saveSettings(QSettings* settings) override;
71  QPointer<QDialog> getConfigDialog(QWidget* parent) override;
72  void configured() override;
73 
74  public:
75  void
76  onInitComponent() override
77  {
78  }
79 
80  void
81  onConnectComponent() override
82  {
83  }
84 
85  void
87  {
88  }
89 
90  void
91  onExitComponent() override
92  {
93  }
94 
95  public:
96  virtual void setupGuiAfterConnect();
97 
98  protected:
99  void preOnConnectComponent() override;
100  void postOnConnectComponent() override;
101  void postOnDisconnectComponent() override;
102 
103  protected:
104  QPointer<SimpleConfigDialog> _dialog;
105 
106  mutable std::recursive_mutex _allMutex;
108  };
109 } // namespace armarx::detail::_NJointControllerGuiPluginBase
armarx::RobotUnitComponentPluginUser
Provides a ready-to-use RobotUnit.
Definition: RobotUnitComponentPlugin.h:98
armarx::detail::_NJointControllerGuiPluginBase::Base::getControllerName
std::string getControllerName() const
Definition: NJointControllerGuiPluginBase.cpp:10
armarx::detail::_NJointControllerGuiPluginBase::Base::readFullCFG
virtual NJointControllerConfigPtr readFullCFG() const =0
RobotStateComponentPlugin.h
armarx::detail::_NJointControllerGuiPluginBase::Base::activateController
virtual void activateController()
Definition: NJointControllerGuiPluginBase.cpp:21
armarx::detail::_NJointControllerGuiPluginBase::Base::postOnConnectComponent
void postOnConnectComponent() override
Definition: NJointControllerGuiPluginBase.cpp:126
armarx::detail::_NJointControllerGuiPluginBase::Base::~Base
~Base() override
Definition: NJointControllerGuiPluginBase.cpp:39
armarx::detail::_NJointControllerGuiPluginBase::Base::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: NJointControllerGuiPluginBase.cpp:68
trace.h
armarx::detail::_NJointControllerGuiPluginBase::Base::createController
virtual void createController()
Definition: NJointControllerGuiPluginBase.cpp:16
SimpleConfigDialog.h
armarx::detail::_NJointControllerGuiPluginBase::Base::_allMutex
std::recursive_mutex _allMutex
Definition: NJointControllerGuiPluginBase.h:106
ArmarXGuiPlugin.h
armarx::detail::_NJointControllerGuiPluginBase::Base::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: NJointControllerGuiPluginBase.cpp:91
armarx::detail::_NJointControllerGuiPluginBase::Base::deleteController
virtual void deleteController()
Definition: NJointControllerGuiPluginBase.cpp:31
armarx::detail::_NJointControllerGuiPluginBase::Base::connectCreateAcivateDeactivateDelete
void connectCreateAcivateDeactivateDelete(QPushButton *cr, QPushButton *ac, QPushButton *dc, QPushButton *de)
Definition: NJointControllerGuiPluginBase.cpp:44
ArmarXComponentWidgetController.h
armarx::detail::_NJointControllerGuiPluginBase::Base::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: NJointControllerGuiPluginBase.cpp:79
armarx::detail::_NJointControllerGuiPluginBase::Base::preOnConnectComponent
void preOnConnectComponent() override
Definition: NJointControllerGuiPluginBase.cpp:115
armarx::detail::_NJointControllerGuiPluginBase::Base::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: NJointControllerGuiPluginBase.h:91
armarx::detail::_NJointControllerGuiPluginBase::Base::deactivateController
virtual void deactivateController()
Definition: NJointControllerGuiPluginBase.cpp:26
armarx::detail::_NJointControllerGuiPluginBase
Definition: NJointControllerGuiPluginBase.cpp:7
armarx::detail::_NJointControllerGuiPluginBase::Base::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: NJointControllerGuiPluginBase.h:86
armarx::detail::_NJointControllerGuiPluginBase::Base::Base
Base()
Definition: NJointControllerGuiPluginBase.cpp:35
armarx::detail::_NJointControllerGuiPluginBase::Base::_dialog
QPointer< SimpleConfigDialog > _dialog
Definition: NJointControllerGuiPluginBase.h:104
armarx::detail::_NJointControllerGuiPluginBase::Base::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: NJointControllerGuiPluginBase.h:76
armarx::detail::_NJointControllerGuiPluginBase::Base
Definition: NJointControllerGuiPluginBase.h:42
armarx::ArmarXComponentWidgetController
Definition: ArmarXComponentWidgetController.h:38
armarx::detail::_NJointControllerGuiPluginBase::Base::_robot
VirtualRobot::RobotPtr _robot
Definition: NJointControllerGuiPluginBase.h:107
armarx::detail::_NJointControllerGuiPluginBase::Base::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: NJointControllerGuiPluginBase.h:81
armarx::RobotStateComponentPluginUser
Definition: RobotStateComponentPlugin.h:165
armarx::detail::_NJointControllerGuiPluginBase::Base::setupGuiAfterConnect
virtual void setupGuiAfterConnect()
Definition: NJointControllerGuiPluginBase.cpp:160
armarx::detail::_NJointControllerGuiPluginBase::Base::postOnDisconnectComponent
void postOnDisconnectComponent() override
Definition: NJointControllerGuiPluginBase.cpp:136
armarx::detail::_NJointControllerGuiPluginBase::Base::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: NJointControllerGuiPluginBase.cpp:106
RobotUnitComponentPlugin.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
ImportExportComponent.h