From 17407f813c2e0b4665dd6ca92e0dd09d655111c1 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Thu, 2 Dec 2010 20:03:57 +0200 Subject: [PATCH] Changed: #1206 correct fix is to load the plugins --- .../object_viewer_qt/src/extension_system/iplugin.h | 9 ++++++++- .../src/extension_system/plugin_spec.cpp | 4 ++++ .../object_viewer_qt/src/plugins/example/plugin1.cpp | 11 +++++++++++ .../object_viewer_qt/src/plugins/example/plugin1.h | 12 ++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) 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 ebca366a2..93f61629a 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 @@ -25,6 +25,11 @@ #include "iplugin_manager.h" +namespace NLMISC +{ + class INelContext; +} + namespace NLQT { @@ -37,6 +42,8 @@ public: virtual void extensionsInitialized() = 0; virtual void shutdown() { } + virtual void setNelContext(NLMISC::INelContext *nelContext) = 0; + virtual QString name() const = 0; virtual QString version() const = 0; virtual QString vendor() const = 0; @@ -45,6 +52,6 @@ public: }; //namespace NLQT -Q_DECLARE_INTERFACE(NLQT::IPlugin, "com.ryzom.dev.ObjectViewerQt.IPlugin/0.7") +Q_DECLARE_INTERFACE(NLQT::IPlugin, "com.ryzom.dev.ObjectViewerQt.IPlugin/0.8") #endif // IPLUGIN_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp index 2f58d673d..d4a11f7d9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp @@ -24,6 +24,8 @@ #include #include +#include "nel/misc/app_context.h" + #include "iplugin.h" #include "iplugin_manager.h" @@ -146,6 +148,8 @@ bool CPluginSpec::loadLibrary() return reportError(QCoreApplication::translate("CPluginSpec", "Plugin is not valid (does not derive from IPlugin)")); } + pluginObject->setNelContext(&NLMISC::INelContext::getInstance()); + _name = pluginObject->name(); _version = pluginObject->version(); _vendor = pluginObject->vendor(); 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 index 3c71c77be..56c4b3d76 100644 --- 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 @@ -7,6 +7,8 @@ #include "../../extension_system/plugin_spec.h" +#include "nel/misc/debug.h" + using namespace Plugin; bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString) @@ -23,6 +25,9 @@ bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorStr QMessageBox msgBox; msgBox.setText(str); msgBox.exec(); + + nlinfo("test message"); + return true; } @@ -45,6 +50,12 @@ void MyPlugin::extensionsInitialized() msgBox.exec(); } +void MyPlugin::setNelContext(NLMISC::INelContext *nelContext) +{ + nlassert(!NLMISC::INelContext::isContextInitialised()); + _LibContext = static_cast(nelContext); +} + QString MyPlugin::name() const { return "ExamplePlugin"; 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 index 1e130d4f6..03436177e 100644 --- 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 @@ -3,8 +3,14 @@ #include "../../extension_system/iplugin.h" +#include "nel/misc/app_context.h" + #include +namespace NLMISC +{ +class CLibraryContext; +} namespace Plugin { @@ -17,10 +23,16 @@ public: bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString); void extensionsInitialized(); + void setNelContext(NLMISC::INelContext *nelContext); + QString name() const; QString version() const; QString vendor() const; QString description() const; + +protected: + NLMISC::CLibraryContext *_LibContext; + private: NLQT::IPluginManager *_plugMan;