17 #ifndef GEPETTO_GUI_PLUGINMANAGERDIALOG_HH
18 #define GEPETTO_GUI_PLUGINMANAGERDIALOG_HH
23 #include <QPluginLoader>
24 #include <QSignalMapper>
25 #include <QTableWidgetItem>
29 class PluginManagerDialog;
36 typedef QPair<QString, QPluginLoader*>
Pair;
37 typedef QMap<QString, QPluginLoader*>
Map;
38 typedef QPair<QString, QString>
PyPair;
39 typedef QMap<QString, QString>
PyMap;
47 template <
typename Interface>
50 template <
typename Interface>
51 QList<Interface*>
get();
53 static QIcon
icon(
const QPluginLoader* pl);
55 static QString
status(
const QPluginLoader* pl);
84 template <
typename Interface>
85 static const Interface* const_instance_cast(
const QPluginLoader* pl);
87 QMap<QString, QPluginLoader*> plugins_;
88 static QList<QDir> pluginDirs_;
89 QMap<QString, QString> pyplugins_;
102 void load(
const QString& name);
115 static const int P_NAME;
116 static const int P_FILE;
117 static const int P_FULLPATH;
118 static const int P_VERSION;
122 ::Ui::PluginManagerDialog* ui_;
127 template <
typename Interface>
129 foreach (QPluginLoader* p, plugins_) {
131 PluginInterface* check = qobject_cast<PluginInterface*>(p->instance());
132 if (check && check->
isInit()) {
133 Interface* pi = qobject_cast<Interface*>(p->instance());
141 template <
typename Interface>
143 QList<Interface*> list;
144 foreach (QPluginLoader* p, plugins_) {
146 PluginInterface* check = qobject_cast<PluginInterface*>(p->instance());
147 if (check && check->
isInit()) {
148 Interface* pi = qobject_cast<Interface*>(p->instance());
149 if (pi) list.append(pi);
156 template <
typename Interface>
157 const Interface* PluginManager::const_instance_cast(
const QPluginLoader* pl) {
158 return (
const Interface*)qobject_cast<Interface*>(
159 const_cast<QPluginLoader*
>(pl)->instance());
Definition: plugin-interface.hh:34
bool isInit() const
Definition: plugin-interface.hh:51
Definition: pluginmanagerdialog.hh:92
PluginManagerDialog(PluginManager *pm, QWidget *parent=0)
void contextMenu(const QPoint &pos)
void pyUnload(const QString &name)
void pyContextMenu(const QPoint &pos)
void pyLoad(const QString &name)
void unload(const QString &name)
void onItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
void load(const QString &name)
Definition: pluginmanagerdialog.hh:34
bool initPlugin(const QString &name)
bool unloadPyPlugin(const QString &name)
~PluginManager()
Definition: pluginmanagerdialog.hh:41
bool unloadPlugin(const QString &name)
bool loadPlugin(const QString &name)
bool loadPyPlugin(const QString &name)
const PyMap & pyplugins() const
Definition: pluginmanagerdialog.hh:45
QPair< QString, QString > PyPair
Definition: pluginmanagerdialog.hh:38
bool declarePlugin(const QString &name, QWidget *parent=NULL)
void declareAllPlugins(QWidget *parent=NULL)
QMap< QString, QPluginLoader * > Map
Definition: pluginmanagerdialog.hh:37
void declareAllPyPlugins()
bool declarePyPlugin(const QString &name)
Interface * getFirstOf()
Definition: pluginmanagerdialog.hh:128
QPair< QString, QPluginLoader * > Pair
Definition: pluginmanagerdialog.hh:36
const Map & plugins() const
Definition: pluginmanagerdialog.hh:43
static QString status(const QPluginLoader *pl)
static void addPluginDir(const QString &path)
bool isPyPluginLoaded(const QString &name)
QMap< QString, QString > PyMap
Definition: pluginmanagerdialog.hh:39
QList< Interface * > get()
Definition: pluginmanagerdialog.hh:142
static QIcon icon(const QPluginLoader *pl)
Definition: dialogloadenvironment.hh:23
Definition: action-search-bar.hh:27