From a58624791be6eb0cf55bb1916ad08a511d266da3 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Fri, 4 Mar 2011 23:56:37 +0200 Subject: [PATCH] Changed: #1193 moved OV actions in a separatly menu. --- .../src/extension_system/iplugin.h | 64 +++++++++---------- .../src/extension_system/plugin_manager.cpp | 32 +++++----- .../src/extension_system/plugin_spec.cpp | 32 +++++----- .../src/plugins/example/plugin1.cpp | 6 +- .../src/plugins/object_viewer/main_window.cpp | 54 ++++++++-------- 5 files changed, 96 insertions(+), 92 deletions(-) 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 index b5b07a0ab..8b85d58a7 100644 --- 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 @@ -46,36 +46,36 @@ class IPlugin public: virtual ~IPlugin() {} - /** - @brief Called after the plugin has been loaded and the IPlugin instance has been created. - - @details The initialize methods of plugins that depend - on this plugin are called after the initialize method of this plugin - has been called. Plugins should initialize their internal state in this - method. Returns if initialization of successful. If it wasn't successful, - the \a errorString should be set to a user-readable message - describing the reason. + /** + @brief Called after the plugin has been loaded and the IPlugin instance has been created. + + @details The initialize methods of plugins that depend + on this plugin are called after the initialize method of this plugin + has been called. Plugins should initialize their internal state in this + method. Returns if initialization of successful. If it wasn't successful, + the \a errorString should be set to a user-readable message + describing the reason. */ virtual bool initialize(IPluginManager *pluginManager, QString *errorString) = 0; - - /** - @brief Called after the IPlugin::initialize() method has been called, - and after both the IPlugin::initialize() and IPlugin::extensionsInitialized() - methods of plugins that depend on this plugin have been called. - - @details In this method, the plugin can assume that plugins that depend on - this plugin are fully 'up and running'. It is a good place to - look in the plugin manager's object pool for objects that have - been provided by dependent plugins. + + /** + @brief Called after the IPlugin::initialize() method has been called, + and after both the IPlugin::initialize() and IPlugin::extensionsInitialized() + methods of plugins that depend on this plugin have been called. + + @details In this method, the plugin can assume that plugins that depend on + this plugin are fully 'up and running'. It is a good place to + look in the plugin manager's object pool for objects that have + been provided by dependent plugins. */ virtual void extensionsInitialized() = 0; /** - @\brief Called during a shutdown sequence in the same order as initialization - before the plugins get deleted in reverse order. - - @details This method should be used to disconnect from other plugins, - hide all UI, and optimize shutdown in general. + @\brief Called during a shutdown sequence in the same order as initialization + before the plugins get deleted in reverse order. + + @details This method should be used to disconnect from other plugins, + hide all UI, and optimize shutdown in general. */ virtual void shutdown() { } @@ -83,14 +83,14 @@ public: @\brief This method should be implemented to work properly NeL singletons. Called immediately after loading the plugin. @code - void Plugin::setNelContext(NLMISC::INelContext *nelContext) - { - #ifdef NL_OS_WINDOWS - // Ensure that a context doesn't exist yet. - // This only applies to platforms without PIC, e.g. Windows. - nlassert(!NLMISC::INelContext::isContextInitialised()); - #endif // NL_OS_WINDOWS - _LibContext = new NLMISC::CLibraryContext(*nelContext); + void Plugin::setNelContext(NLMISC::INelContext *nelContext) + { + #ifdef NL_OS_WINDOWS + // Ensure that a context doesn't exist yet. + // This only applies to platforms without PIC, e.g. Windows. + nlassert(!NLMISC::INelContext::isContextInitialised()); + #endif // NL_OS_WINDOWS + _LibContext = new NLMISC::CLibraryContext(*nelContext); } @endcode */ 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 index 701f2e9ea..49dcec785 100644 --- 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 @@ -1,19 +1,19 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "plugin_manager.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 index f1e19dc45..173299813 100644 --- 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 @@ -1,19 +1,19 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "plugin_spec.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp index 6cf3f09a8..cde1ca199 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp @@ -88,9 +88,9 @@ QString MyPlugin::description() const QStringList MyPlugin::dependencies() const { - QStringList list; - list.append(Core::Constants::OVQT_CORE_PLUGIN); - list.append("ObjectViewer"); + QStringList list; + list.append(Core::Constants::OVQT_CORE_PLUGIN); + list.append("ObjectViewer"); return list; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp index 8a1ae7764..f3328aeb7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp @@ -241,14 +241,14 @@ void CMainWindow::settings() void CMainWindow::updateStatusBar() { -/* if (_isGraphicsInitialized) - { - _statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg( - Modules::objView().getDriver()->getVideocardInformation()).arg( - _numTri).arg( - _texMem, 0,'f',4).arg( - _fps, 0,'f',2)); - }*/ + /* if (_isGraphicsInitialized) + { + _statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg( + Modules::objView().getDriver()->getVideocardInformation()).arg( + _numTri).arg( + _texMem, 0,'f',4).arg( + _fps, 0,'f',2)); + }*/ } void CMainWindow::createActions() @@ -285,10 +285,10 @@ void CMainWindow::createActions() void CMainWindow::createMenus() { Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); - + // register actions for file menu menuManager->registerAction(_openAction, "ObjectViewer.File.Open"); - + // add actions in file menu QMenu *fileMenu = menuManager->menu(Core::Constants::M_FILE); QAction *exitAction = menuManager->action(Core::Constants::EXIT); @@ -301,7 +301,7 @@ void CMainWindow::createMenus() menuManager->registerAction(_resetSceneAction, "ObjectViewer.View.ResetScene"); menuManager->registerAction(_reloadTexturesAction, "ObjectViewer.View.ReloadTextures"); menuManager->registerAction(_saveScreenshotAction, "ObjectViewer.View.SaveScreenshot"); - + // add actions in view menu QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); viewMenu->addAction(_setBackColorAction); @@ -313,40 +313,44 @@ void CMainWindow::createMenus() // add actions in tools menu QMenu *toolsMenu = menuManager->menu(Core::Constants::M_TOOLS); QAction *settingsAction = menuManager->action(Core::Constants::SETTINGS); - toolsMenu->insertAction(settingsAction ,_AnimationDialog->toggleViewAction()); + QMenu *ovMenu = new QMenu("Object Viewer", this); + menuManager->registerMenu(ovMenu, "ObjectViewerQt.ObjectViewer"); + toolsMenu->insertMenu(settingsAction, ovMenu); + + ovMenu->insertAction(settingsAction ,_AnimationDialog->toggleViewAction()); _AnimationDialog->toggleViewAction()->setIcon(QIcon(":/images/anim.png")); - toolsMenu->insertAction(settingsAction ,_AnimationSetDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_AnimationSetDialog->toggleViewAction()); _AnimationSetDialog->toggleViewAction()->setIcon(QIcon(":/images/animset.png")); - toolsMenu->insertAction(settingsAction ,_SlotManagerDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_SlotManagerDialog->toggleViewAction()); _SlotManagerDialog->toggleViewAction()->setIcon(QIcon(":/images/mixer.png")); - toolsMenu->insertAction(settingsAction ,_ParticleControlDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_ParticleControlDialog->toggleViewAction()); _ParticleControlDialog->toggleViewAction()->setIcon(QIcon(":/images/pqrticles.png")); - toolsMenu->insertAction(settingsAction ,_DayNightDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_DayNightDialog->toggleViewAction()); _DayNightDialog->toggleViewAction()->setIcon(QIcon(":/images/dqynight.png")); - toolsMenu->insertAction(settingsAction ,_WaterPoolDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_WaterPoolDialog->toggleViewAction()); _WaterPoolDialog->toggleViewAction()->setIcon(QIcon(":/images/water.png")); _WaterPoolDialog->toggleViewAction()->setEnabled(false); - toolsMenu->insertAction(settingsAction ,_VegetableDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_VegetableDialog->toggleViewAction()); _VegetableDialog->toggleViewAction()->setIcon(QIcon(":/images/veget.png")); - toolsMenu->insertAction(settingsAction ,_GlobalWindDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_GlobalWindDialog->toggleViewAction()); _GlobalWindDialog->toggleViewAction()->setIcon(QIcon(":/images/wind.png")); - toolsMenu->insertAction(settingsAction ,_SkeletonScaleDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_SkeletonScaleDialog->toggleViewAction()); _SkeletonScaleDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_skelscale.png")); - toolsMenu->insertAction(settingsAction ,_TuneTimerDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_TuneTimerDialog->toggleViewAction()); _TuneTimerDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_framedelay.png")); - toolsMenu->insertAction(settingsAction ,_SunColorDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_SunColorDialog->toggleViewAction()); - toolsMenu->insertAction(settingsAction ,_TuneMRMDialog->toggleViewAction()); + ovMenu->insertAction(settingsAction ,_TuneMRMDialog->toggleViewAction()); _TuneMRMDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_mrm_mesh.png")); connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)), @@ -355,7 +359,7 @@ void CMainWindow::createMenus() connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)), _ParticleWorkspaceDialog->_PropertyDialog, SLOT(setVisible(bool))); - toolsMenu->insertAction(settingsAction ,_settingsAction); + ovMenu->insertAction(settingsAction ,_settingsAction); toolsMenu->insertSeparator(settingsAction); } @@ -367,7 +371,7 @@ void CMainWindow::createToolBars() //_viewToolBar = addToolBar(tr("&Edit")); _toolsBar = addToolBar(tr("&Tools")); - + _toolsBar->addAction(_setBackColorAction); _toolsBar->addSeparator();