2 #include "mission_compiler_plugin.h"
3 #include "../core/icore.h"
4 #include "../core/core_constants.h"
5 #include "../core/menu_manager.h"
6 #include "../../extension_system/iplugin_spec.h"
9 #include <nel/misc/debug.h>
10 #include <nel/misc/path.h>
13 #include <QtCore/QObject>
14 #include <QtGui/QMessageBox>
15 #include <QtGui/QMainWindow>
16 #include <QtGui/QMenu>
17 #include <QtGui/QAction>
18 #include <QtGui/QMenuBar>
20 #include "mission_compiler_settings_page.h"
22 namespace MissionCompiler
25 MissionCompilerPlugin::~MissionCompilerPlugin()
27 Q_FOREACH(QObject
*obj
, m_autoReleaseObjects
)
29 m_plugMan
->removeObject(obj
);
31 qDeleteAll(m_autoReleaseObjects
);
32 m_autoReleaseObjects
.clear();
38 bool MissionCompilerPlugin::initialize(ExtensionSystem::IPluginManager
*pluginManager
, QString
*errorString
)
40 Q_UNUSED(errorString
);
41 m_plugMan
= pluginManager
;
43 addAutoReleasedObject(new MissionCompilerSettingsPage(this));
44 addAutoReleasedObject(new CMissionCompilerContext(this));
45 //addAutoReleasedObject(new CCoreListener(this));
49 void MissionCompilerPlugin::extensionsInitialized()
51 Core::ICore
*core
= Core::ICore::instance();
52 QSettings
*settings
= Core::ICore::instance()->settings();
53 Core::MenuManager
*menuManager
= core
->menuManager();
56 //settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
57 //QString ligoConfigFile = settings->value(Core::Constants::DATA_PATH_SECTION).toString();
58 //settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
61 void MissionCompilerPlugin::setNelContext(NLMISC::INelContext
*nelContext
)
64 // Ensure that a context doesn't exist yet.
65 // This only applies to platforms without PIC, e.g. Windows.
66 nlassert(!NLMISC::INelContext::isContextInitialised());
67 #endif // NL_OS_WINDOWS
68 m_LibContext
= new NLMISC::CLibraryContext(*nelContext
);
71 void MissionCompilerPlugin::addAutoReleasedObject(QObject
*obj
)
73 m_plugMan
->addObject(obj
);
74 m_autoReleaseObjects
.prepend(obj
);
79 Q_EXPORT_PLUGIN(MissionCompiler::MissionCompilerPlugin
)