mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 22:08:43 +00:00
Changed: #1206 correct fix is to load the plugins
This commit is contained in:
parent
911c749ac3
commit
c4b32bd3fe
4 changed files with 35 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <QtCore/QPluginLoader>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
#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();
|
||||
|
|
|
@ -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<NLMISC::CLibraryContext *>(nelContext);
|
||||
}
|
||||
|
||||
QString MyPlugin::name() const
|
||||
{
|
||||
return "ExamplePlugin";
|
||||
|
|
|
@ -3,8 +3,14 @@
|
|||
|
||||
#include "../../extension_system/iplugin.h"
|
||||
|
||||
#include "nel/misc/app_context.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue