From 65782a7de0cce5fc11f842bc6affe24a44445be3 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 29 Nov 2010 17:18:07 +0200 Subject: [PATCH] Added: #1206 Added ovqt plugin system. --- code/nel/tools/3d/object_viewer_qt/COPYING | 1 - code/nel/tools/3d/object_viewer_qt/README | 1 - .../3d/object_viewer_qt/src/CMakeLists.txt | 9 +- .../src/extension_system/iplugin.h | 50 ++++ .../src/extension_system/iplugin_manager.h | 58 +++++ .../src/extension_system/plugin_manager.cpp | 193 +++++++++++++++ .../src/extension_system/plugin_manager.h | 70 ++++++ .../src/extension_system/plugin_spec.cpp | 223 ++++++++++++++++++ .../src/extension_system/plugin_spec.h | 100 ++++++++ .../tools/3d/object_viewer_qt/src/main.cpp | 10 +- .../tools/3d/object_viewer_qt/src/modules.cpp | 4 + .../tools/3d/object_viewer_qt/src/modules.h | 7 + 12 files changed, 721 insertions(+), 5 deletions(-) delete mode 100644 code/nel/tools/3d/object_viewer_qt/COPYING delete mode 100644 code/nel/tools/3d/object_viewer_qt/README create mode 100644 code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h diff --git a/code/nel/tools/3d/object_viewer_qt/COPYING b/code/nel/tools/3d/object_viewer_qt/COPYING deleted file mode 100644 index 69ec4c052..000000000 --- a/code/nel/tools/3d/object_viewer_qt/COPYING +++ /dev/null @@ -1 +0,0 @@ -Put your license here! \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/README b/code/nel/tools/3d/object_viewer_qt/README deleted file mode 100644 index 7a4a570a1..000000000 --- a/code/nel/tools/3d/object_viewer_qt/README +++ /dev/null @@ -1 +0,0 @@ -Talk about how to use Hello World or who wrote it, that sort of stuff. \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt index 406121a14..251fa6a7d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt @@ -2,7 +2,10 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LI INCLUDE( ${QT_USE_FILE} ) FILE(GLOB OBJECT_VIEWER_SRC configuration.h entity.h object_viewer.h particle_editor.h modules.h sound_system.h - particle_node.h ps_initial_pos.h dup_ps.h vegetable_editor.h vegetable_node.h *.cpp) + particle_node.h ps_initial_pos.h dup_ps.h vegetable_editor.h vegetable_node.h + extension_system/plugin_spec.h + extension_system/*.cpp *.cpp) + SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h animation_set_dialog.h settings_dialog.h setup_fog_dialog.h slot_manager_dialog.h particle_control_dialog.h particle_workspace_dialog.h @@ -18,7 +21,9 @@ SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h skeleton_scale_dialog.h skeleton_tree_model.h particle_link_skeleton_dialog.h vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h - vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h) + vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h + extension_system/iplugin_manager.h extension_system/plugin_manager.h) + SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui setup_fog_form.ui slot_form.ui particle_control_form.ui particle_workspace_form.ui edit_range_float_form.ui edit_range_uint_form.ui particle_system_form.ui workspace_form.ui 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 new file mode 100644 index 000000000..237ad0aca --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h @@ -0,0 +1,50 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#ifndef IPLUGIN_H +#define IPLUGIN_H + +#include +#include + +#include "iplugin_manager.h" + +namespace NLQT +{ + +class IPlugin +{ +public: + virtual ~IPlugin(); + + virtual bool initialize(IPluginManager *pluginManager, QString *errorString) = 0; + virtual void extensionsInitialized() = 0; + virtual void shutdown() { } + + virtual QString name() const = 0; + virtual QString version() const = 0; + virtual QString vendor() const = 0; + virtual QString description() const = 0; +}; + +}; //namespace NLQT + +Q_DECLARE_INTERFACE(NLQT::IPlugin, "com.ryzom.dev.ObjectViewerQt.IPlugin/0.7") + +#endif // IPLUGIN_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h new file mode 100644 index 000000000..64be11403 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h @@ -0,0 +1,58 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#ifndef IPLUGINMANAGER_H +#define IPLUGINMANAGER_H + +#include +#include +#include + +namespace NLQT +{ +class CPluginSpec; + +class IPluginManager: public QObject +{ + Q_OBJECT + +public: + IPluginManager(QObject *parent = 0): QObject(parent) {} + + // Object pool operations + virtual void addObject(QObject *obj) = 0; + virtual void removeObject(QObject *obj) = 0; + virtual QList allObjects() const = 0; + + // Plugin operations + virtual void loadPlugins() = 0; + virtual QStringList getPluginPaths() const = 0; + virtual void setPluginPaths(const QStringList &paths) = 0; + virtual QList plugins() const = 0; + +Q_SIGNALS: + void objectAdded(QObject *obj); + void aboutToRemoveObject(QObject *obj); + + void pluginsChanged(); +}; + +}; // namespace NLQT + +#endif // IPLUGINMANAGER_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp new file mode 100644 index 000000000..187cc4051 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp @@ -0,0 +1,193 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#include "plugin_manager.h" + +#include + +#include + +#include "plugin_spec.h" + +namespace NLQT +{ + +CPluginManager::CPluginManager(QObject *parent): + IPluginManager(parent) +{ +} + +CPluginManager::~CPluginManager() +{ + stopAll(); + qDeleteAll(_pluginSpecs); +} + +void CPluginManager::addObject(QObject *obj) +{ + QWriteLocker lock(&_lock); + if (obj == 0) + { + nlwarning("trying to add null object"); + return; + } + if (_allObjects.contains(obj)) + { + nlwarning("trying to add duplicate object"); + return; + } + nlinfo(QString("addObject:" + obj->objectName()).toStdString().c_str()); + + _allObjects.append(obj); + + Q_EMIT objectAdded(obj); +} + +void CPluginManager::removeObject(QObject *obj) +{ + if (obj == 0) + { + nlwarning("trying to remove null object"); + return; + } + + if (!_allObjects.contains(obj)) + { + nlinfo(QString("object not in list:" + obj->objectName()).toStdString().c_str()); + return; + } + nlinfo(QString("removeObject:" + obj->objectName()).toStdString().c_str()); + + Q_EMIT aboutToRemoveObject(obj); + QWriteLocker lock(&_lock); + _allObjects.removeAll(obj); +} + +QList CPluginManager::allObjects() const +{ + return _allObjects; +} + +void CPluginManager::loadPlugins() +{ + Q_FOREACH (CPluginSpec *spec, _pluginSpecs) + setPluginState(spec, State::Loaded); + + Q_FOREACH (CPluginSpec *spec, _pluginSpecs) + setPluginState(spec, State::Initialized); + + Q_FOREACH (CPluginSpec *spec, _pluginSpecs) + setPluginState(spec, State::Running); + + Q_EMIT pluginsChanged(); +} + +QStringList CPluginManager::getPluginPaths() const +{ + return _pluginPaths; +} + +void CPluginManager::setPluginPaths(const QStringList &paths) +{ + _pluginPaths = paths; + readPluginPaths(); +} + +QList CPluginManager::plugins() const +{ + return _pluginSpecs; +} + +void CPluginManager::readPluginPaths() +{ + qDeleteAll(_pluginSpecs); + _pluginSpecs.clear(); + + QStringList pluginsList; + QStringList searchPaths = _pluginPaths; + while (!searchPaths.isEmpty()) + { + const QDir dir(searchPaths.takeFirst()); +#ifdef Q_OS_WIN + const QFileInfoList files = dir.entryInfoList(QStringList() << QString("*.dll"), QDir::Files); +#elif defined(Q_OS_MAC) + const QFileInfoList files = dir.entryInfoList(QStringList() << QString("*.dylib"), QDir::Files); +#else + const QFileInfoList files = dir.entryInfoList(QStringList() << QString("*.so"), QDir::Files); +#endif + Q_FOREACH (const QFileInfo &file, files) + pluginsList << file.absoluteFilePath(); + const QFileInfoList dirs = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot); + Q_FOREACH (const QFileInfo &subdir, dirs) + searchPaths << subdir.absoluteFilePath(); + } + + Q_FOREACH (const QString &pluginFile, pluginsList) + { + CPluginSpec *spec = new CPluginSpec; + if (spec->setFileName(pluginFile)) + _pluginSpecs.append(spec); + else + delete spec; + } + + Q_EMIT pluginsChanged(); +} + +CPluginSpec *CPluginManager::pluginByName(const QString &name) const +{ + Q_FOREACH (CPluginSpec *spec, _pluginSpecs) + if (spec->name() == name) + return spec; + return 0; +} + +void CPluginManager::setPluginState(CPluginSpec *spec, int destState) +{ + if (spec->hasError()) + return; + if (destState == State::Running) + { + spec->initializeExtensions(); + return; + } + else if (destState == State::Deleted) + { + spec->kill(); + return; + } + + if (destState == State::Loaded) + spec->loadLibrary(); + else if (destState == State::Initialized) + spec->initializePlugin(); + else if (destState == State::Stopped) + spec->stop(); +} + +void CPluginManager::stopAll() +{ + Q_FOREACH (CPluginSpec *spec, _pluginSpecs) + setPluginState(spec, State::Stopped); + + Q_FOREACH (CPluginSpec *spec, _pluginSpecs) + setPluginState(spec, State::Deleted); +} + +}; // namespace NLQT \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h new file mode 100644 index 000000000..7c5ae30b0 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h @@ -0,0 +1,70 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#ifndef PLUGINMANAGER_H +#define PLUGINMANAGER_H + +// Qt Include +#include + +// Project include +#include "iplugin_manager.h" + +namespace NLQT +{ + +class IPlugin; + +class CPluginManager : public IPluginManager +{ + Q_OBJECT + +public: + CPluginManager(QObject *parent = 0); + ~CPluginManager(); + + // Object pool operations + virtual void addObject(QObject *obj); + virtual void removeObject(QObject *obj); + virtual QList allObjects() const; + + // Plugin operations + virtual void loadPlugins(); + virtual QStringList getPluginPaths() const; + virtual void setPluginPaths(const QStringList &paths); + virtual QList plugins() const; + + CPluginSpec *pluginByName(const QString &name) const; + +private: + void setPluginState(CPluginSpec *spec, int destState); + void readPluginPaths(); + void stopAll(); + + mutable QReadWriteLock _lock; + + QList _pluginSpecs; + QStringList _pluginPaths; + QList _allObjects; + +}; // class CPluginManager + +} // namespace NLQT + +#endif // PLUGINMANAGER_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 new file mode 100644 index 000000000..b96d7c0c0 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp @@ -0,0 +1,223 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#include "plugin_spec.h" + +#include +#include +#include +#include + +#include "iplugin.h" +#include "iplugin_manager.h" + +namespace NLQT +{ + +CPluginSpec::CPluginSpec(): + _state(State::Invalid), + _hasError(false), + _plugin(NULL) +{ +} + +CPluginSpec::~CPluginSpec() +{ +} + +QString CPluginSpec::name() const +{ + return _name; +} + +QString CPluginSpec::version() const +{ + return _version; +} + +QString CPluginSpec::vendor() const +{ + return _vendor; +} + +QString CPluginSpec::description() const +{ + return _description; +} + +QString CPluginSpec::location() const +{ + return _location; +} + +QString CPluginSpec::filePath() const +{ + return _filePath; +} + +QString CPluginSpec::fileName() const +{ + return _fileName; +} + +IPlugin* CPluginSpec::plugin() const +{ + return _plugin; +} + +int CPluginSpec::getState() const +{ + return _state; +} + +bool CPluginSpec::hasError() const +{ + return _hasError; +} + +QString CPluginSpec::errorString() const +{ + return _errorString; +} + +bool CPluginSpec::setFileName(const QString &fileName) +{ + _name + = _version + = _vendor + = _description + = _location + = _filePath + = _fileName + = ""; + _state = State::Invalid; + _hasError = false; + _errorString = ""; + QFile file(fileName); + if (!file.exists()) + return reportError(QCoreApplication::translate("CPluginSpec", "File does not exist: %1").arg(file.fileName())); + if (!file.open(QIODevice::ReadOnly)) + return reportError(QCoreApplication::translate("CPluginSpec", "Could not open file for read: %1").arg(file.fileName())); + + QFileInfo fileInfo(file); + _location = fileInfo.absolutePath(); + _filePath = fileInfo.absoluteFilePath(); + _fileName = fileInfo.fileName(); + + _state = State::Read; + return true; +} + +bool CPluginSpec::loadLibrary() +{ + if (_hasError) + return false; + if (_state != State::Read) + { + if (_state == State::Loaded) + return true; + return reportError(QCoreApplication::translate("CPluginSpec", "Loading the library failed because state != Resolved")); + } + QString libName = QString("%1/%2").arg(_location).arg(_fileName); + + QPluginLoader loader(libName); + if (!loader.load()) + return reportError(libName + QString::fromLatin1(": ") + loader.errorString()); + + IPlugin *pluginObject = qobject_cast(loader.instance()); + if (!pluginObject) + { + loader.unload(); + return reportError(QCoreApplication::translate("CPluginSpec", "Plugin is not valid (does not derive from IPlugin)")); + } + + _name = pluginObject->name(); + _version = pluginObject->version(); + _vendor = pluginObject->vendor(); + _description = pluginObject->description(); + + _state = State::Loaded; + _plugin = pluginObject; + return true; +} + +bool CPluginSpec::initializePlugin() +{ + if (_hasError) + return false; + if (_state != State::Loaded) + { + if (_state == State::Initialized) + return true; + return reportError(QCoreApplication::translate("CPluginSpec", "Initializing the plugin failed because state != Loaded)")); + } + if (!_plugin) + return reportError(QCoreApplication::translate("CPluginSpec", "Internal error: have no plugin instance to initialize")); + + QString err; + if (!_plugin->initialize(_pluginManager, &err)) + return reportError(QCoreApplication::translate("CPluginSpec", "Plugin initialization failed: %1").arg(err)); + + _state = State::Initialized; + return true; +} + +bool CPluginSpec::initializeExtensions() +{ + if (_hasError) + return false; + if (_state != State::Initialized) + { + if (_state == State::Running) + return true; + return reportError(QCoreApplication::translate("CPluginSpec", "Cannot perform extensionsInitialized because state != Initialized")); + } + if (!_plugin) + return reportError(QCoreApplication::translate("CPluginSpec", "Internal error: have no plugin instance to perform extensionsInitialized")); + + _plugin->extensionsInitialized(); + _state = State::Running; + return true; +} + +void CPluginSpec::stop() +{ + if (!_plugin) + return; + _plugin->shutdown(); + _state = State::Stopped; +} + +void CPluginSpec::kill() +{ + if (!_plugin) + return; + delete _plugin; + _plugin = NULL; + _state = State::Deleted; +} + +bool CPluginSpec::reportError(const QString &err) +{ + _errorString = err; + _hasError = true; + return false; +} + +} // namespace NLQT \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h new file mode 100644 index 000000000..1ae79e447 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h @@ -0,0 +1,100 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#ifndef PLUGINSPEC_H +#define PLUGINSPEC_H + +#include +#include + +namespace NLQT +{ +class IPlugin; +class IPluginManager; + +struct State +{ + enum List + { + Invalid = 1, + Read, + Loaded, + Initialized, + Running, + Stopped, + Deleted + }; +}; + +class CPluginSpec +{ +public: + ~CPluginSpec(); + + QString name() const; + QString version() const; + QString vendor() const; + QString description() const; + + QString location() const; + QString filePath() const; + QString fileName() const; + + IPlugin *plugin() const; + + // state + int getState() const; + bool hasError() const; + QString errorString() const; + +private: + CPluginSpec(); + + bool setFileName(const QString &fileName); + bool loadLibrary(); + bool initializePlugin(); + bool initializeExtensions(); + void stop(); + void kill(); + + bool reportError(const QString &err); + + QString _location; + QString _filePath; + QString _fileName; + + QString _name; + QString _version; + QString _vendor; + QString _description; + + int _state; + bool _hasError; + QString _errorString; + + IPlugin *_plugin; + IPluginManager *_pluginManager; + + friend class CPluginManager; +}; + +} // namespace NLQT + +#endif // PLUGINSPEC_H + diff --git a/code/nel/tools/3d/object_viewer_qt/src/main.cpp b/code/nel/tools/3d/object_viewer_qt/src/main.cpp index ac1912b43..415463f7a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main.cpp @@ -12,7 +12,7 @@ #include #include #include - +#include "extension_system/plugin_spec.h" // Project includes #include "modules.h" @@ -96,6 +96,14 @@ sint main(int argc, char **argv) Modules::config().configSearchPaths(); Modules::mainWin().showMaximized(); + + Modules::plugMan().setPluginPaths(QStringList() << QString("./plugins")); + Modules::plugMan().loadPlugins(); + + QList listPlug = Modules::plugMan().plugins(); + Q_FOREACH (NLQT::CPluginSpec *plugSpec, listPlug) + nlinfo(plugSpec->errorString().toStdString().c_str()); + splash->finish(&Modules::mainWin()); int result = app.exec(); Modules::release(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/modules.cpp b/code/nel/tools/3d/object_viewer_qt/src/modules.cpp index 76504eb27..949af984f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/modules.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/modules.cpp @@ -26,6 +26,7 @@ NLQT::CMainWindow *Modules::_mainWindow = NULL; NLQT::CParticleEditor *Modules::_particleEditor = NULL; NLQT::CSoundSystem *Modules::_soundSystem = NULL; NLQT::CVegetableEditor *Modules::_vegetableEditor = NULL; +NLQT::CPluginManager *Modules::_pluginManager = NULL; void Modules::init() { @@ -37,10 +38,13 @@ void Modules::init() if (_particleEditor == NULL) _particleEditor = new NLQT::CParticleEditor; if (_vegetableEditor == NULL) _vegetableEditor = new NLQT::CVegetableEditor; if (_mainWindow == NULL) _mainWindow = new NLQT::CMainWindow; + if (_pluginManager == NULL) _pluginManager = new NLQT::CPluginManager; } void Modules::release() { + delete _pluginManager; + _pluginManager = NULL; delete _mainWindow; _mainWindow = NULL; delete _particleEditor; diff --git a/code/nel/tools/3d/object_viewer_qt/src/modules.h b/code/nel/tools/3d/object_viewer_qt/src/modules.h index ac5fcc223..02d8f01c5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/modules.h +++ b/code/nel/tools/3d/object_viewer_qt/src/modules.h @@ -26,6 +26,7 @@ #include "main_window.h" #include "sound_system.h" #include "vegetable_editor.h" +#include "extension_system/plugin_manager.h" /** @class Modules @@ -61,6 +62,11 @@ public: { return *_vegetableEditor; } + static NLQT::CPluginManager &plugMan() + { + return *_pluginManager; + } + private: static NLQT::CConfiguration *_configuration; static NLQT::CObjectViewer *_objectViewer; @@ -68,6 +74,7 @@ private: static NLQT::CParticleEditor *_particleEditor; static NLQT::CSoundSystem *_soundSystem; static NLQT::CVegetableEditor *_vegetableEditor; + static NLQT::CPluginManager *_pluginManager; }; #endif // MODULES_H