From e9fe1b362ece5bedb308b5446202f391a7ecf749 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 23 May 2014 02:26:31 +0200 Subject: [PATCH] Moved plugin menu items to their own sub-menu into the menubar. --- code/studio/src/plugins/core/main_window.cpp | 6 +-- .../plugins/gui_editor/gui_editor_window.cpp | 6 +-- .../src/plugins/object_viewer/main_window.cpp | 47 +++++++++---------- .../translation_manager_main_window.cpp | 7 ++- 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/code/studio/src/plugins/core/main_window.cpp b/code/studio/src/plugins/core/main_window.cpp index fcde24fbf..4ccd32564 100644 --- a/code/studio/src/plugins/core/main_window.cpp +++ b/code/studio/src/plugins/core/main_window.cpp @@ -438,9 +438,6 @@ void MainWindow::createMenus() m_toolsMenu = m_menuBar->addMenu(tr("&Tools")); menuManager()->registerMenu(m_toolsMenu, Constants::M_TOOLS); - m_sheetMenu = m_toolsMenu->addMenu(tr("&Sheet")); - menuManager()->registerMenu(m_sheetMenu, Constants::M_SHEET); - // m_toolsMenu->addSeparator(); m_toolsMenu->addAction(m_settingsAction); @@ -452,6 +449,9 @@ void MainWindow::createMenus() m_helpMenu->addAction(m_aboutAction); m_helpMenu->addAction(m_aboutQtAction); m_helpMenu->addAction(m_pluginViewAction); + + m_sheetMenu = m_menuBar->addMenu(tr("&Sheet")); + menuManager()->registerMenu(m_sheetMenu, Constants::M_SHEET); } void MainWindow::createStatusBar() diff --git a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp index 341338d8d..24ecc5cfc 100644 --- a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp @@ -360,11 +360,9 @@ namespace GUIEditor connect( delAction, SIGNAL( triggered( bool ) ), messageProcessor, SLOT( onDelete() ) ); } - QMenu *menu = mm->menu( Core::Constants::M_TOOLS ); - if( menu != NULL ) + QMenu *m = mm->menuBar()->addMenu( "GUI Editor" ); + if( m != NULL ) { - QMenu *m = menu->addMenu( "GUI Editor" ); - QAction *a = new QAction( "Widget Properties", this ); connect( a, SIGNAL( triggered( bool ) ), widgetProps, SLOT( show() ) ); m->addAction( a ); diff --git a/code/studio/src/plugins/object_viewer/main_window.cpp b/code/studio/src/plugins/object_viewer/main_window.cpp index bccf7a6b1..91f832ac0 100644 --- a/code/studio/src/plugins/object_viewer/main_window.cpp +++ b/code/studio/src/plugins/object_viewer/main_window.cpp @@ -270,55 +270,51 @@ void CMainWindow::createMenus() 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); - viewMenu->addAction(_SetupFog->toggleViewAction()); - viewMenu->addAction(_resetSceneAction); - viewMenu->addAction(_reloadTexturesAction); - viewMenu->addAction(_saveScreenshotAction); - - // add actions in tools menu - QMenu *toolsMenu = menuManager->menu(Core::Constants::M_TOOLS); - QAction *settingsAction = menuManager->action(Core::Constants::SETTINGS); - QMenu *ovMenu = new QMenu("Object Viewer", this); + QMenu *ovMenu = menuManager->menuBar()->addMenu( "Object Viewer" ); menuManager->registerMenu(ovMenu, "ObjectViewerQt.ObjectViewer"); - toolsMenu->insertMenu(settingsAction, ovMenu); - ovMenu->insertAction(settingsAction ,_AnimationDialog->toggleViewAction()); + ovMenu->addAction(_setBackColorAction); + ovMenu->addAction(_SetupFog->toggleViewAction()); + ovMenu->addAction(_resetSceneAction); + ovMenu->addAction(_reloadTexturesAction); + ovMenu->addAction(_saveScreenshotAction); + + ovMenu->addSeparator(); + + ovMenu->addAction(_AnimationDialog->toggleViewAction() ); _AnimationDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_ANIM)); - ovMenu->insertAction(settingsAction ,_AnimationSetDialog->toggleViewAction()); + ovMenu->addAction(_AnimationSetDialog->toggleViewAction()); _AnimationSetDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_ANIMSET)); - ovMenu->insertAction(settingsAction ,_SlotManagerDialog->toggleViewAction()); + ovMenu->addAction(_SlotManagerDialog->toggleViewAction()); _SlotManagerDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_MIXER)); - ovMenu->insertAction(settingsAction ,_ParticleControlDialog->toggleViewAction()); + ovMenu->addAction(_ParticleControlDialog->toggleViewAction()); _ParticleControlDialog->toggleViewAction()->setIcon(QIcon(":/images/pqrticles.png")); - ovMenu->insertAction(settingsAction ,_DayNightDialog->toggleViewAction()); + ovMenu->addAction(_DayNightDialog->toggleViewAction()); _DayNightDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_DAYNIGHT)); - ovMenu->insertAction(settingsAction ,_WaterPoolDialog->toggleViewAction()); + ovMenu->addAction(_WaterPoolDialog->toggleViewAction()); _WaterPoolDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_WATER)); _WaterPoolDialog->toggleViewAction()->setEnabled(false); - ovMenu->insertAction(settingsAction ,_VegetableDialog->toggleViewAction()); + ovMenu->addAction(_VegetableDialog->toggleViewAction()); _VegetableDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_VEGET)); - ovMenu->insertAction(settingsAction ,_GlobalWindDialog->toggleViewAction()); + ovMenu->addAction(_GlobalWindDialog->toggleViewAction()); _GlobalWindDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_WIND)); - ovMenu->insertAction(settingsAction ,_SkeletonScaleDialog->toggleViewAction()); + ovMenu->addAction(_SkeletonScaleDialog->toggleViewAction()); _SkeletonScaleDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_SKELSCALE)); - ovMenu->insertAction(settingsAction ,_TuneTimerDialog->toggleViewAction()); + ovMenu->addAction(_TuneTimerDialog->toggleViewAction()); _TuneTimerDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_FRAMEDELAY)); - ovMenu->insertAction(settingsAction ,_SunColorDialog->toggleViewAction()); + ovMenu->addAction(_SunColorDialog->toggleViewAction()); - ovMenu->insertAction(settingsAction ,_TuneMRMDialog->toggleViewAction()); + ovMenu->addAction(_TuneMRMDialog->toggleViewAction()); _TuneMRMDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_MRM_MESH)); connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)), @@ -327,7 +323,6 @@ void CMainWindow::createMenus() connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)), _ParticleWorkspaceDialog->_PropertyDialog, SLOT(setVisible(bool))); - toolsMenu->insertSeparator(settingsAction); } void CMainWindow::createToolBars() diff --git a/code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp b/code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp index 9fcb9626a..d80ffe3f5 100644 --- a/code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp +++ b/code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp @@ -129,7 +129,12 @@ void CMainWindow::createToolbar() // Windows menu Core::ICore *core = Core::ICore::instance(); Core::MenuManager *menuManager = core->menuManager(); - windowMenu = menuManager->menuBar()->addMenu("Window"); + QMenu *m = menuManager->menuBar()->addMenu( "Translation Manager" ); + if( m != NULL ) + { + windowMenu = m->addMenu("Window"); + } + updateWindowsList(); connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));