gepetto-viewer  4.13.0
An user-friendly Graphical Interface
plugin-interface.hh
Go to the documentation of this file.
1 // Copyright (c) 2015-2018, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of gepetto-viewer.
5 // gepetto-viewer is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // gepetto-viewer is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef GEPETTO_GUI_PLUGININTERFACE_HH
18 #define GEPETTO_GUI_PLUGININTERFACE_HH
19 
20 #include <QWidget>
21 #include <QtGui>
24 #include <iostream>
25 
26 namespace gepetto {
27 namespace gui {
28 const int DockKeyShortcutBase = Qt::CTRL + Qt::ALT;
29 
33  public:
34  PluginInterface() : errorMsg_("Not initalized"), isInit_(false) {}
35 
36  virtual ~PluginInterface() {}
37 
38  virtual QString name() const = 0;
39 
40  void doInit() {
41  try {
42  init();
43  isInit_ = true;
44  } catch (const std::exception& e) {
45  errorMsg_ = QString(e.what());
46  }
47  }
48 
49  bool isInit() const { return isInit_; }
50 
51  const QString& errorMsg() const { return errorMsg_; }
52 
53  protected:
54  virtual void init() = 0;
55 
56  private:
57  QString errorMsg_;
58  bool isInit_;
59 };
60 
64  public:
66 
67  virtual QAction* action(const std::string& jointName) const = 0;
68 };
69 
73  public:
74  virtual ~ModelInterface() {}
75 
77 
78  virtual void loadEnvironmentModel(
80 
81  virtual std::string getBodyFromJoint(const std::string& jointName) const = 0;
82 };
83 
87  public:
88  virtual ~ConnectionInterface() {}
89 
90  virtual void openConnection() = 0;
91 
92  virtual void closeConnection() = 0;
93 };
94 } // namespace gui
95 } // namespace gepetto
96 
97 Q_DECLARE_INTERFACE(gepetto::gui::PluginInterface, "gepetto-gui.plugins/0.0")
98 Q_DECLARE_INTERFACE(gepetto::gui::JointModifierInterface,
99  "gepetto-gui.plugin.joint-modifier/0.0")
100 Q_DECLARE_INTERFACE(gepetto::gui::ModelInterface,
101  "gepetto-gui.plugin.model/0.0")
102 Q_DECLARE_INTERFACE(gepetto::gui::ConnectionInterface,
103  "gepetto-gui.plugin.connection/0.0")
104 
105 #endif // GEPETTO_GUI_PLUGININTERFACE_HH
gepetto::gui::ModelInterface::loadEnvironmentModel
virtual void loadEnvironmentModel(DialogLoadEnvironment::EnvironmentDefinition ed)=0
gepetto::gui::ModelInterface
Definition: plugin-interface.hh:72
gepetto
Definition: action-search-bar.hh:26
gepetto::gui::PluginInterface::isInit
bool isInit() const
Definition: plugin-interface.hh:49
gepetto::gui::JointModifierInterface::~JointModifierInterface
virtual ~JointModifierInterface()
Definition: plugin-interface.hh:65
gepetto::gui::PluginInterface::init
virtual void init()=0
gepetto::gui::PluginInterface
Definition: plugin-interface.hh:32
gepetto::gui::ModelInterface::loadRobotModel
virtual void loadRobotModel(DialogLoadRobot::RobotDefinition rd)=0
gepetto::gui::ModelInterface::~ModelInterface
virtual ~ModelInterface()
Definition: plugin-interface.hh:74
gepetto::gui::JointModifierInterface::action
virtual QAction * action(const std::string &jointName) const =0
gepetto::gui::PluginInterface::name
virtual QString name() const =0
gepetto::gui::ConnectionInterface
Definition: plugin-interface.hh:86
gepetto::gui::ConnectionInterface::openConnection
virtual void openConnection()=0
gepetto::gui::DialogLoadEnvironment::EnvironmentDefinition
Definition: dialogloadenvironment.hh:36
dialogloadenvironment.hh
gepetto::gui::JointModifierInterface
Definition: plugin-interface.hh:63
gepetto::gui::PluginInterface::errorMsg
const QString & errorMsg() const
Definition: plugin-interface.hh:51
gepetto::gui::PluginInterface::PluginInterface
PluginInterface()
Definition: plugin-interface.hh:34
dialogloadrobot.hh
gepetto::gui::PluginInterface::doInit
void doInit()
Definition: plugin-interface.hh:40
gepetto::gui::DockKeyShortcutBase
const int DockKeyShortcutBase
Definition: plugin-interface.hh:28
gepetto::gui::ConnectionInterface::~ConnectionInterface
virtual ~ConnectionInterface()
Definition: plugin-interface.hh:88
gepetto::gui::ModelInterface::getBodyFromJoint
virtual std::string getBodyFromJoint(const std::string &jointName) const =0
gepetto::gui::DialogLoadRobot::RobotDefinition
Definition: dialogloadrobot.hh:33
gepetto::gui::ConnectionInterface::closeConnection
virtual void closeConnection()=0
gepetto::gui::PluginInterface::~PluginInterface
virtual ~PluginInterface()
Definition: plugin-interface.hh:36