From 16ac4234d86202c82abf4c94aa7ee00776b6013e Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Wed, 1 Dec 2010 14:40:21 +0200 Subject: [PATCH] Changed: #1206 Added example plugin. --- .../src/extension_system/iplugin.h | 2 +- .../src/plugins/example/example.pro | 12 +++++ .../src/plugins/example/plugin1.cpp | 50 +++++++++++++++++++ .../src/plugins/example/plugin1.h | 29 +++++++++++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/example/example.pro create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h index 20aca34a1..ebca366a2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h @@ -31,7 +31,7 @@ namespace NLQT class IPlugin { public: - virtual ~IPlugin(); + virtual ~IPlugin() {} virtual bool initialize(IPluginManager *pluginManager, QString *errorString) = 0; virtual void extensionsInitialized() = 0; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example.pro b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example.pro new file mode 100644 index 000000000..fc1a9231f --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example.pro @@ -0,0 +1,12 @@ +TEMPLATE = lib +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +CONFIG += plugin +# Input +HEADERS += plugin1.h \ + ../../extension_system/iplugin.h \ + ../../extension_system/iplugin_manager.h \ + ../../extension_system/plugin_spec.h +SOURCES += plugin1.cpp \ + ../../extension_system/plugin_spec.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp new file mode 100644 index 000000000..669c441a6 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp @@ -0,0 +1,50 @@ +#include "plugin1.h" + +#include +#include + +using namespace Plugin; + +bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString) +{ + Q_UNUSED(errorString); + QString str; + QList listPlug = pluginManager->plugins(); + + Q_FOREACH (NLQT::CPluginSpec *plugSpec, listPlug) + str += plugSpec->name(); + + QMessageBox msgBox; + msgBox.setText(str); + msgBox.exec(); + return true; +} + +void MyPlugin::extensionsInitialized() +{ + QMessageBox msgBox; + msgBox.setText("extensionsInitialize Example Plugin."); + msgBox.exec(); +} + +QString MyPlugin::name() const +{ + return "ExamplePlugin"; +} + +QString MyPlugin::version() const +{ + return "0.1"; +} + +QString MyPlugin::vendor() const +{ + return "dnk"; +} + +QString MyPlugin::description() const +{ + return "Example plugin"; +} + +Q_EXPORT_PLUGIN(MyPlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.h new file mode 100644 index 000000000..9f00f2828 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.h @@ -0,0 +1,29 @@ +#ifndef PLUGIN1_H +#define PLUGIN1_H + +#include "../../extension_system/iplugin.h" +#include "../../extension_system/plugin_spec.h" + +#include + +namespace Plugin +{ + +class MyPlugin : public QObject, public NLQT::IPlugin +{ + Q_OBJECT + Q_INTERFACES(NLQT::IPlugin) +public: + + bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString); + void extensionsInitialized(); + + QString name() const; + QString version() const; + QString vendor() const; + QString description() const; +}; + +} // namespace Plugin1 + +#endif // PLUGIN1_H