Linux multi-monitor fullscreen support
[ryzomcore.git] / studio / src / plugins / translation_manager / translation_manager_plugin.cpp
blob1e4db0c18bc3a0705ee3e37f7f71cb828c5fa581
1 // Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2011 Emanuel COSTEA <cemycc@gmail.com>
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010 Winch Gate Property Limited
6 // Copyright (C) 2011 Dzmitry KAMIAHIN (dnk-88) <dnk-88@tut.by>
7 // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
8 //
9 // This program is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU Affero General Public License as
11 // published by the Free Software Foundation, either version 3 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU Affero General Public License for more details.
19 // You should have received a copy of the GNU Affero General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 // Project includes
23 #include "translation_manager_plugin.h"
24 #include "translation_manager_settings_page.h"
25 #include "translation_manager_main_window.h"
27 // Core includes
28 #include "../core/icore.h"
29 #include "../core/core_constants.h"
30 #include "../core/menu_manager.h"
31 #include "../../extension_system/iplugin_spec.h"
33 // NeL includes
34 #include "nel/misc/debug.h"
36 // Qt includes
37 #include <QtCore/QObject>
38 #include <QtGui/QMessageBox>
39 #include <QtGui/QErrorMessage>
40 #include <QtGui/QMainWindow>
41 #include <QtGui/QMenu>
42 #include <QtGui/QAction>
43 #include <QtGui/QMenuBar>
45 namespace TranslationManager
47 TranslationManagerPlugin::~TranslationManagerPlugin()
49 Q_FOREACH(QObject *obj, _autoReleaseObjects)
51 _plugMan->removeObject(obj);
53 qDeleteAll(_autoReleaseObjects);
54 _autoReleaseObjects.clear();
56 delete _LibContext;
57 _LibContext = NULL;
60 bool TranslationManagerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
62 Q_UNUSED(errorString);
63 _plugMan = pluginManager;
64 // create the mainwindow
65 CMainWindow *mainWindow = new CMainWindow();
67 addAutoReleasedObject(new CTranslationManagerSettingsPage(this));
68 addAutoReleasedObject(new CTranslationManagerContext(mainWindow, this));
69 addAutoReleasedObject(new CCoreListener(mainWindow, this));
71 return true;
74 void TranslationManagerPlugin::extensionsInitialized()
78 void TranslationManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
80 #ifdef NL_OS_WINDOWS
81 // Ensure that a context doesn't exist yet.
82 // This only applies to platforms without PIC, e.g. Windows.
83 nlassert(!NLMISC::INelContext::isContextInitialised());
84 #endif // NL_OS_WINDOWS
85 _LibContext = new NLMISC::CLibraryContext(*nelContext);
88 void TranslationManagerPlugin::addAutoReleasedObject(QObject *obj)
90 _plugMan->addObject(obj);
91 _autoReleaseObjects.prepend(obj);
96 Q_EXPORT_PLUGIN(TranslationManager::TranslationManagerPlugin)