2 #include "object_viewer_plugin.h"
3 #include "graphics_settings_page.h"
4 #include "sound_settings_page.h"
5 #include "vegetable_settings_page.h"
7 #include "../core/core_constants.h"
10 #include "nel/misc/debug.h"
11 #include "nel/3d/init_3d.h"
14 #include <QtCore/QObject>
18 ObjectViewerPlugin::~ObjectViewerPlugin()
20 Q_FOREACH(QObject
*obj
, _autoReleaseObjects
)
22 _plugMan
->removeObject(obj
);
24 qDeleteAll(_autoReleaseObjects
);
25 _autoReleaseObjects
.clear();
32 bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager
*pluginManager
, QString
*errorString
)
34 Q_UNUSED(errorString
);
35 _plugMan
= pluginManager
;
39 addAutoReleasedObject(new CObjectViewerContext());
40 addAutoReleasedObject(new GraphicsSettingsPage());
41 addAutoReleasedObject(new SoundSettingsPage());
42 addAutoReleasedObject(new VegetableSettingsPage());
46 void ObjectViewerPlugin::extensionsInitialized()
50 void ObjectViewerPlugin::shutdown()
52 // Modules::release();
55 void ObjectViewerPlugin::setNelContext(NLMISC::INelContext
*nelContext
)
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
)