New lua versions
[ryzomcore.git] / studio / src / plugins / object_viewer / object_viewer_plugin.cpp
bloba4c9481402531ba67575c5140c88805a19c28958
1 // Project includes
2 #include "object_viewer_plugin.h"
3 #include "graphics_settings_page.h"
4 #include "sound_settings_page.h"
5 #include "vegetable_settings_page.h"
6 #include "modules.h"
7 #include "../core/core_constants.h"
9 // NeL includes
10 #include "nel/misc/debug.h"
11 #include "nel/3d/init_3d.h"
13 // Qt includes
14 #include <QtCore/QObject>
16 namespace NLQT
18 ObjectViewerPlugin::~ObjectViewerPlugin()
20 Q_FOREACH(QObject *obj, _autoReleaseObjects)
22 _plugMan->removeObject(obj);
24 qDeleteAll(_autoReleaseObjects);
25 _autoReleaseObjects.clear();
26 Modules::release();
28 delete _LibContext;
29 _LibContext = NULL;
32 bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
34 Q_UNUSED(errorString);
35 _plugMan = pluginManager;
37 NL3D::init3d();
38 Modules::init();
39 addAutoReleasedObject(new CObjectViewerContext());
40 addAutoReleasedObject(new GraphicsSettingsPage());
41 addAutoReleasedObject(new SoundSettingsPage());
42 addAutoReleasedObject(new VegetableSettingsPage());
43 return true;
46 void ObjectViewerPlugin::extensionsInitialized()
50 void ObjectViewerPlugin::shutdown()
52 // Modules::release();
55 void ObjectViewerPlugin::setNelContext(NLMISC::INelContext *nelContext)
57 #ifdef NL_OS_WINDOWS
58 // Ensure that a context doesn't exist yet.
59 // This only applies to platforms without PIC, e.g. Windows.
60 nlassert(!NLMISC::INelContext::isContextInitialised());
61 #endif // NL_OS_WINDOWS
62 _LibContext = new NLMISC::CLibraryContext(*nelContext);
65 void ObjectViewerPlugin::addAutoReleasedObject(QObject *obj)
67 _plugMan->addObject(obj);
68 _autoReleaseObjects.prepend(obj);
71 void CObjectViewerContext::open()
73 Modules::mainWin().open();
76 QUndoStack *CObjectViewerContext::undoStack()
78 return Modules::mainWin().getUndoStack();
81 QWidget *CObjectViewerContext::widget()
83 return &Modules::mainWin();
88 Q_EXPORT_PLUGIN(NLQT::ObjectViewerPlugin)