gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
plugin-interface.hh
Go to the documentation of this file.
1// Copyright (c) 2015-2022, LAAS-CNRS, Heriot-Watt University
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 <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
22#include <QOpenGLContext>
23#include <QWidget>
26#include <iostream>
27
28namespace gepetto {
29namespace gui {
30const int DockKeyShortcutBase = Qt::CTRL + Qt::ALT;
31
35 public:
36 PluginInterface() : errorMsg_("Not initalized"), isInit_(false) {}
37
38 virtual ~PluginInterface() {}
39
40 virtual QString name() const = 0;
41
42 void doInit() {
43 try {
44 init();
45 isInit_ = true;
46 } catch (const std::exception& e) {
47 errorMsg_ = QString(e.what());
48 }
49 }
50
51 bool isInit() const { return isInit_; }
52
53 const QString& errorMsg() const { return errorMsg_; }
54
55 protected:
56 virtual void init() = 0;
57
58 private:
59 QString errorMsg_;
60 bool isInit_;
61};
62
66 public:
68
69 virtual QAction* action(const std::string& jointName) const = 0;
70};
71
75 public:
76 virtual ~ModelInterface() {}
77
79
82
83 virtual std::string getBodyFromJoint(const std::string& jointName) const = 0;
84};
85
89 public:
91
92 virtual void openConnection() = 0;
93
94 virtual void closeConnection() = 0;
95};
96} // namespace gui
97} // namespace gepetto
98
99Q_DECLARE_INTERFACE(gepetto::gui::PluginInterface, "gepetto-gui.plugins/0.0")
100Q_DECLARE_INTERFACE(gepetto::gui::JointModifierInterface,
101 "gepetto-gui.plugin.joint-modifier/0.0")
102Q_DECLARE_INTERFACE(gepetto::gui::ModelInterface,
103 "gepetto-gui.plugin.model/0.0")
104Q_DECLARE_INTERFACE(gepetto::gui::ConnectionInterface,
105 "gepetto-gui.plugin.connection/0.0")
106
107#endif // GEPETTO_GUI_PLUGININTERFACE_HH
Definition plugin-interface.hh:88
virtual ~ConnectionInterface()
Definition plugin-interface.hh:90
Definition plugin-interface.hh:65
virtual QAction * action(const std::string &jointName) const =0
virtual ~JointModifierInterface()
Definition plugin-interface.hh:67
Definition plugin-interface.hh:74
virtual void loadEnvironmentModel(DialogLoadEnvironment::EnvironmentDefinition ed)=0
virtual ~ModelInterface()
Definition plugin-interface.hh:76
virtual void loadRobotModel(DialogLoadRobot::RobotDefinition rd)=0
virtual std::string getBodyFromJoint(const std::string &jointName) const =0
Definition plugin-interface.hh:34
const QString & errorMsg() const
Definition plugin-interface.hh:53
void doInit()
Definition plugin-interface.hh:42
virtual QString name() const =0
bool isInit() const
Definition plugin-interface.hh:51
virtual ~PluginInterface()
Definition plugin-interface.hh:38
PluginInterface()
Definition plugin-interface.hh:36
const int DockKeyShortcutBase
Definition plugin-interface.hh:30
Definition action-search-bar.hh:27
Definition dialogloadrobot.hh:33