Changed: #1206 correct fix is to load the plugins

hg/feature/sound
dnk-88 14 years ago
parent 5fbb37d106
commit f2dd3cd061

@ -25,6 +25,11 @@
#include "iplugin_manager.h" #include "iplugin_manager.h"
namespace NLMISC
{
class INelContext;
}
namespace NLQT namespace NLQT
{ {
@ -37,6 +42,8 @@ public:
virtual void extensionsInitialized() = 0; virtual void extensionsInitialized() = 0;
virtual void shutdown() { } virtual void shutdown() { }
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
virtual QString name() const = 0; virtual QString name() const = 0;
virtual QString version() const = 0; virtual QString version() const = 0;
virtual QString vendor() const = 0; virtual QString vendor() const = 0;
@ -45,6 +52,6 @@ public:
}; //namespace NLQT }; //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 #endif // IPLUGIN_H

@ -24,6 +24,8 @@
#include <QtCore/QPluginLoader> #include <QtCore/QPluginLoader>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include "nel/misc/app_context.h"
#include "iplugin.h" #include "iplugin.h"
#include "iplugin_manager.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)")); return reportError(QCoreApplication::translate("CPluginSpec", "Plugin is not valid (does not derive from IPlugin)"));
} }
pluginObject->setNelContext(&NLMISC::INelContext::getInstance());
_name = pluginObject->name(); _name = pluginObject->name();
_version = pluginObject->version(); _version = pluginObject->version();
_vendor = pluginObject->vendor(); _vendor = pluginObject->vendor();

@ -7,6 +7,8 @@
#include "../../extension_system/plugin_spec.h" #include "../../extension_system/plugin_spec.h"
#include "nel/misc/debug.h"
using namespace Plugin; using namespace Plugin;
bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString) bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString)
@ -23,6 +25,9 @@ bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorStr
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(str); msgBox.setText(str);
msgBox.exec(); msgBox.exec();
nlinfo("test message");
return true; return true;
} }
@ -45,6 +50,12 @@ void MyPlugin::extensionsInitialized()
msgBox.exec(); msgBox.exec();
} }
void MyPlugin::setNelContext(NLMISC::INelContext *nelContext)
{
nlassert(!NLMISC::INelContext::isContextInitialised());
_LibContext = static_cast<NLMISC::CLibraryContext *>(nelContext);
}
QString MyPlugin::name() const QString MyPlugin::name() const
{ {
return "ExamplePlugin"; return "ExamplePlugin";

@ -3,8 +3,14 @@
#include "../../extension_system/iplugin.h" #include "../../extension_system/iplugin.h"
#include "nel/misc/app_context.h"
#include <QtCore/QObject> #include <QtCore/QObject>
namespace NLMISC
{
class CLibraryContext;
}
namespace Plugin namespace Plugin
{ {
@ -17,10 +23,16 @@ public:
bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString); bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext);
QString name() const; QString name() const;
QString version() const; QString version() const;
QString vendor() const; QString vendor() const;
QString description() const; QString description() const;
protected:
NLMISC::CLibraryContext *_LibContext;
private: private:
NLQT::IPluginManager *_plugMan; NLQT::IPluginManager *_plugMan;

Loading…
Cancel
Save