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/Robot.h>
28 
31 
35 
36 #include <RobotAPI/interface/core/RobotState.h>
39 
40 
42 {
43  class Base :
45  public virtual RobotUnitComponentPluginUser,
46  public virtual RobotStateComponentPluginUser
47  {
48  Q_OBJECT
49  public:
50  virtual NJointControllerConfigPtr readFullCFG() const = 0;
51  std::string getControllerName() const;
52  public Q_SLOTS: //for some reason using slots does not work -> use Q_SLOTS
53  virtual void createController();
54  virtual void activateController();
55  virtual void deactivateController();
56  virtual void deleteController();
57  private Q_SLOTS:
58  void doSetupGuiAfterConnect();
59 
60  public:
61  Base();
62  ~Base() override;
63 
64  void connectCreateAcivateDeactivateDelete(QPushButton* cr,
65  QPushButton* ac,
66  QPushButton* dc,
67  QPushButton* de);
68 
69  public:
70  void loadSettings(QSettings* settings) override;
71  void saveSettings(QSettings* settings) override;
72  QPointer<QDialog> getConfigDialog(QWidget* parent) override;
73  void configured() override;
74 
75  public:
76  void
77  onInitComponent() override
78  {
79  }
80  void
81  onConnectComponent() override
82  {
83  }
84  void
86  {
87  }
88  void
89  onExitComponent() override
90  {
91  }
92 
93  public:
94  virtual void setupGuiAfterConnect();
95 
96  protected:
97  void preOnConnectComponent() override;
98  void postOnConnectComponent() override;
99  void postOnDisconnectComponent() override;
100 
101  protected:
102  QPointer<SimpleConfigDialog> _dialog;
103 
104  mutable std::recursive_mutex _allMutex;
106  };
107 } // 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:20
armarx::detail::_NJointControllerGuiPluginBase::Base::postOnConnectComponent
void postOnConnectComponent() override
Definition: NJointControllerGuiPluginBase.cpp:122
armarx::detail::_NJointControllerGuiPluginBase::Base::~Base
~Base() override
Definition: NJointControllerGuiPluginBase.cpp:36
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:65
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:104
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:88
armarx::detail::_NJointControllerGuiPluginBase::Base::deleteController
virtual void deleteController()
Definition: NJointControllerGuiPluginBase.cpp:28
armarx::detail::_NJointControllerGuiPluginBase::Base::connectCreateAcivateDeactivateDelete
void connectCreateAcivateDeactivateDelete(QPushButton *cr, QPushButton *ac, QPushButton *dc, QPushButton *de)
Definition: NJointControllerGuiPluginBase.cpp:41
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:76
armarx::detail::_NJointControllerGuiPluginBase::Base::preOnConnectComponent
void preOnConnectComponent() override
Definition: NJointControllerGuiPluginBase.cpp:112
armarx::detail::_NJointControllerGuiPluginBase::Base::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: NJointControllerGuiPluginBase.h:89
armarx::detail::_NJointControllerGuiPluginBase::Base::deactivateController
virtual void deactivateController()
Definition: NJointControllerGuiPluginBase.cpp:24
armarx::detail::_NJointControllerGuiPluginBase
Definition: NJointControllerGuiPluginBase.cpp:7
armarx::detail::_NJointControllerGuiPluginBase::Base::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: NJointControllerGuiPluginBase.h:85
armarx::detail::_NJointControllerGuiPluginBase::Base::Base
Base()
Definition: NJointControllerGuiPluginBase.cpp:32
armarx::detail::_NJointControllerGuiPluginBase::Base::_dialog
QPointer< SimpleConfigDialog > _dialog
Definition: NJointControllerGuiPluginBase.h:102
armarx::detail::_NJointControllerGuiPluginBase::Base::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: NJointControllerGuiPluginBase.h:77
armarx::detail::_NJointControllerGuiPluginBase::Base
Definition: NJointControllerGuiPluginBase.h:43
armarx::ArmarXComponentWidgetController
Definition: ArmarXComponentWidgetController.h:39
armarx::detail::_NJointControllerGuiPluginBase::Base::_robot
VirtualRobot::RobotPtr _robot
Definition: NJointControllerGuiPluginBase.h:105
armarx::detail::_NJointControllerGuiPluginBase::Base::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: NJointControllerGuiPluginBase.h:81
armarx::RobotStateComponentPluginUser
Definition: RobotStateComponentPlugin.h:167
armarx::detail::_NJointControllerGuiPluginBase::Base::setupGuiAfterConnect
virtual void setupGuiAfterConnect()
Definition: NJointControllerGuiPluginBase.cpp:155
armarx::detail::_NJointControllerGuiPluginBase::Base::postOnDisconnectComponent
void postOnDisconnectComponent() override
Definition: NJointControllerGuiPluginBase.cpp:131
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:103
RobotUnitComponentPlugin.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
ImportExportComponent.h