From a6d52a6e28afbadaaacb270b0037e574f8e777a0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 4 Mar 2020 10:44:07 +0100 Subject: [PATCH] Move some actions to a "View" menu A "View" menu seems to be what many users are looking for when they want to show or hide panes/views, so move corresponding actions there. Window management / split actions stay in the "Window" menu. Fixes: QTCREATORBUG-23610 Change-Id: Id683addc681de99abb35697a735fdbc9dc0d00cd Reviewed-by: hjk --- .../touchbar/touchbar_appdelegate_mac.mm | 8 +++++++ .../touchbar/touchbar_appdelegate_mac_p.h | 1 + src/plugins/coreplugin/coreconstants.h | 14 +++++++---- src/plugins/coreplugin/mainwindow.cpp | 23 +++++++++++-------- src/plugins/coreplugin/outputpanemanager.cpp | 6 ++--- src/plugins/debugger/debuggermainwindow.cpp | 8 +++---- src/plugins/designer/formeditorw.cpp | 2 +- src/plugins/qmldesigner/designmodewidget.cpp | 4 ++-- src/plugins/qmldesigner/shortcutmanager.cpp | 2 +- 9 files changed, 43 insertions(+), 25 deletions(-) diff --git a/src/libs/utils/touchbar/touchbar_appdelegate_mac.mm b/src/libs/utils/touchbar/touchbar_appdelegate_mac.mm index e921695fdc6..128679dfb7d 100644 --- a/src/libs/utils/touchbar/touchbar_appdelegate_mac.mm +++ b/src/libs/utils/touchbar/touchbar_appdelegate_mac.mm @@ -29,6 +29,7 @@ #include #import +#import Q_GLOBAL_STATIC(Utils::Internal::ApplicationDelegate, staticApplicationDelegate); @@ -148,4 +149,11 @@ using namespace Utils::Internal; [anInvocation invokeWithTarget:self.qtDelegate]; } +// Work around QTBUG-61707 +- (void)applicationWillFinishLaunching:(NSNotification*)notify +{ + Q_UNUSED(notify) + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"]; + NSWindow.allowsAutomaticWindowTabbing = NO; +} @end diff --git a/src/libs/utils/touchbar/touchbar_appdelegate_mac_p.h b/src/libs/utils/touchbar/touchbar_appdelegate_mac_p.h index da2f8e4e079..e97e49691d3 100644 --- a/src/libs/utils/touchbar/touchbar_appdelegate_mac_p.h +++ b/src/libs/utils/touchbar/touchbar_appdelegate_mac_p.h @@ -37,6 +37,7 @@ - (void)setApplicationTouchBar:(Utils::Internal::TouchBarPrivate *)bar; - (void)pushTouchBar:(Utils::Internal::TouchBarPrivate *)bar; - (void)popTouchBar; +- (void)applicationWillFinishLaunching:(NSNotification*)notify; @end diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index fd817379579..d34886632fe 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -49,12 +49,13 @@ const char M_FILE[] = "QtCreator.Menu.File"; const char M_FILE_RECENTFILES[] = "QtCreator.Menu.File.RecentFiles"; const char M_EDIT[] = "QtCreator.Menu.Edit"; const char M_EDIT_ADVANCED[] = "QtCreator.Menu.Edit.Advanced"; +const char M_VIEW[] = "QtCreator.Menu.View"; +const char M_VIEW_MODESTYLES[] = "QtCreator.Menu.View.ModeStyles"; +const char M_VIEW_VIEWS[] = "QtCreator.Menu.View.Views"; +const char M_VIEW_PANES[] = "QtCreator.Menu.View.Panes"; const char M_TOOLS[] = "QtCreator.Menu.Tools"; const char M_TOOLS_EXTERNAL[] = "QtCreator.Menu.Tools.External"; const char M_WINDOW[] = "QtCreator.Menu.Window"; -const char M_WINDOW_PANES[] = "QtCreator.Menu.Window.Panes"; -const char M_WINDOW_MODESTYLES[] = "QtCreator.Menu.Window.ModeStyles"; -const char M_WINDOW_VIEWS[] = "QtCreator.Menu.Window.Views"; const char M_HELP[] = "QtCreator.Menu.Help"; // Contexts @@ -174,12 +175,15 @@ const char G_EDIT_BLOCKS[] = "QtCreator.Group.Edit.Blocks"; const char G_EDIT_FONT[] = "QtCreator.Group.Edit.Font"; const char G_EDIT_EDITOR[] = "QtCreator.Group.Edit.Editor"; +// View menu groups +const char G_VIEW_VIEWS[] = "QtCreator.Group.View.Views"; +const char G_VIEW_PANES[] = "QtCreator.Group.View.Panes"; + +// Tools menu groups const char G_TOOLS_OPTIONS[] = "QtCreator.Group.Tools.Options"; // Window menu groups const char G_WINDOW_SIZE[] = "QtCreator.Group.Window.Size"; -const char G_WINDOW_PANES[] = "QtCreator.Group.Window.Panes"; -const char G_WINDOW_VIEWS[] = "QtCreator.Group.Window.Views"; const char G_WINDOW_SPLIT[] = "QtCreator.Group.Window.Split"; const char G_WINDOW_NAVIGATE[] = "QtCreator.Group.Window.Navigate"; const char G_WINDOW_LIST[] = "QtCreator.Group.Window.List"; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 4af57a6fd91..67a3e80635f 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -424,6 +424,12 @@ void MainWindow::registerDefaultContainers() medit->appendGroup(Constants::G_EDIT_FIND); medit->appendGroup(Constants::G_EDIT_OTHER); + ActionContainer *mview = ActionManager::createMenu(Constants::M_VIEW); + menubar->addMenu(mview, Constants::G_VIEW); + mview->menu()->setTitle(tr("&View")); + mview->appendGroup(Constants::G_VIEW_VIEWS); + mview->appendGroup(Constants::G_VIEW_PANES); + // Tools Menu ActionContainer *ac = ActionManager::createMenu(Constants::M_TOOLS); menubar->addMenu(ac, Constants::G_TOOLS); @@ -434,8 +440,6 @@ void MainWindow::registerDefaultContainers() menubar->addMenu(mwindow, Constants::G_WINDOW); mwindow->menu()->setTitle(tr("&Window")); mwindow->appendGroup(Constants::G_WINDOW_SIZE); - mwindow->appendGroup(Constants::G_WINDOW_VIEWS); - mwindow->appendGroup(Constants::G_WINDOW_PANES); mwindow->appendGroup(Constants::G_WINDOW_SPLIT); mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE); mwindow->appendGroup(Constants::G_WINDOW_LIST); @@ -465,6 +469,7 @@ void MainWindow::registerDefaultActions() { ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE); ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT); + ActionContainer *mview = ActionManager::actionContainer(Constants::M_VIEW); ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS); ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); ActionContainer *mhelp = ActionManager::actionContainer(Constants::M_HELP); @@ -714,7 +719,7 @@ void MainWindow::registerDefaultActions() ProxyAction *toggleLeftSideBarProxyAction = ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::TOGGLE_LEFT_SIDEBAR_TOOLBAR.icon()); m_toggleLeftSideBarButton->setDefaultAction(toggleLeftSideBarProxyAction); - mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS); + mview->addAction(cmd, Constants::G_VIEW_VIEWS); m_toggleLeftSideBarAction->setEnabled(false); // Show Right Sidebar Action @@ -730,14 +735,14 @@ void MainWindow::registerDefaultActions() ProxyAction *toggleRightSideBarProxyAction = ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::TOGGLE_RIGHT_SIDEBAR_TOOLBAR.icon()); m_toggleRightSideBarButton->setDefaultAction(toggleRightSideBarProxyAction); - mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS); + mview->addAction(cmd, Constants::G_VIEW_VIEWS); m_toggleRightSideBarButton->setEnabled(false); registerModeSelectorStyleActions(); // Window->Views - ActionContainer *mviews = ActionManager::createMenu(Constants::M_WINDOW_VIEWS); - mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS); + ActionContainer *mviews = ActionManager::createMenu(Constants::M_VIEW_VIEWS); + mview->addMenu(mviews, Constants::G_VIEW_VIEWS); mviews->menu()->setTitle(tr("&Views")); // "Help" separators @@ -781,7 +786,7 @@ void MainWindow::registerDefaultActions() void MainWindow::registerModeSelectorStyleActions() { - ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); + ActionContainer *mview = ActionManager::actionContainer(Constants::M_VIEW); // Cycle Mode Selector Styles m_cycleModeSelectorStyleAction = new QAction(tr("Cycle Mode Selector Styles"), this); @@ -792,8 +797,8 @@ void MainWindow::registerModeSelectorStyleActions() }); // Mode Selector Styles - ActionContainer *mmodeLayouts = ActionManager::createMenu(Constants::M_WINDOW_MODESTYLES); - mwindow->addMenu(mmodeLayouts, Constants::G_WINDOW_VIEWS); + ActionContainer *mmodeLayouts = ActionManager::createMenu(Constants::M_VIEW_MODESTYLES); + mview->addMenu(mmodeLayouts, Constants::G_VIEW_VIEWS); QMenu *styleMenu = mmodeLayouts->menu(); styleMenu->setTitle(tr("Mode Selector Style")); auto *stylesGroup = new QActionGroup(styleMenu); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 0d33610eb58..fccdd67e47c 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -391,11 +391,11 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : StatusBarManager::addStatusBarWidget(m_buttonsWidget, StatusBarManager::Second); - ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); + ActionContainer *mview = ActionManager::actionContainer(Constants::M_VIEW); // Window->Output Panes - ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES); - mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); + ActionContainer *mpanes = ActionManager::createMenu(Constants::M_VIEW_PANES); + mview->addMenu(mpanes, Constants::G_VIEW_PANES); mpanes->menu()->setTitle(tr("Output &Panes")); mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup"); mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup"); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index bdba4afb867..e4d88ca38a1 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -253,7 +253,7 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent) q->addDockWidget(Qt::BottomDockWidgetArea, m_toolBarDock); connect(viewButton, &QAbstractButton::clicked, this, [this, viewButton] { - ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS); + ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS); viewsMenu->menu()->exec(viewButton->mapToGlobal(QPoint())); }); @@ -279,7 +279,7 @@ DebuggerMainWindow::DebuggerMainWindow() Context debugcontext(Debugger::Constants::C_DEBUGMODE); - ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS); + ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS); Command *cmd = ActionManager::registerAction(showCentralWidgetAction(), "Debugger.Views.ShowCentralWidget", debugcontext); cmd->setAttribute(Command::CA_Hide); @@ -312,7 +312,7 @@ DebuggerMainWindow::~DebuggerMainWindow() void DebuggerMainWindow::contextMenuEvent(QContextMenuEvent *ev) { - ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS); + ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS); viewsMenu->menu()->exec(ev->globalPos()); } @@ -893,7 +893,7 @@ void Perspective::addWindow(QWidget *widget, Command *cmd = ActionManager::registerAction(op.toggleViewAction, op.commandId, d->context()); cmd->setAttribute(Command::CA_Hide); - ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS)->addAction(cmd); + ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS)->addAction(cmd); } d->m_dockOperations.append(op); diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index d7df1c8e859..ad5cb8c97bc 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -313,7 +313,7 @@ void FormEditorData::addDockViewAction(ActionContainer *viewMenu, void FormEditorData::setupViewActions() { // Populate "View" menu of form editor menu - ActionContainer *viewMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS); + ActionContainer *viewMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS); QTC_ASSERT(viewMenu, return); addDockViewAction(viewMenu, WidgetBoxSubWindow, m_contexts, diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index a434d5d866c..424c008231e 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -244,11 +244,11 @@ void DesignModeWidget::setup() // Setup Actions and Menus Core::ActionContainer *mwindow = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW); // Window > Views - Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_WINDOW_VIEWS); + Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_VIEW_VIEWS); mviews->menu()->addSeparator(); // Window > Workspaces Core::ActionContainer *mworkspaces = Core::ActionManager::createMenu(QmlDesigner::Constants::M_WINDOW_WORKSPACES); - mwindow->addMenu(mworkspaces, Core::Constants::G_WINDOW_VIEWS); + mwindow->addMenu(mworkspaces, Core::Constants::G_VIEW_VIEWS); mworkspaces->menu()->setTitle(tr("&Workspaces")); mworkspaces->setOnAllDisabledBehavior(Core::ActionContainer::Show); // TODO what does it exactly do?! diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp index d4dac41cf4a..8fee83dd8a1 100644 --- a/src/plugins/qmldesigner/shortcutmanager.cpp +++ b/src/plugins/qmldesigner/shortcutmanager.cpp @@ -189,7 +189,7 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex command->setDefaultKeySequence(QKeySequence::SelectAll); editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL); - Core::ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS); + Core::ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS); command = Core::ActionManager::registerAction(&m_collapseExpandStatesAction, Constants::TOGGLE_STATES_EDITOR, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide);