diff --git a/launcher/ui/MacMenuBar.cpp b/launcher/ui/MacMenuBar.cpp index 1c0531e4..fd5d3c92 100644 --- a/launcher/ui/MacMenuBar.cpp +++ b/launcher/ui/MacMenuBar.cpp @@ -194,20 +194,6 @@ namespace return resolved; } - /// Build one menu from its table and hang it off @p bar, if not empty. - void addSpecMenu(QMenuBar* bar, const QMainWindow* window, - const MenuSpec& spec) - { - auto* menu = - new QMenu(QCoreApplication::translate(kContext, spec.title), bar); - - if (appendGroup(menu, resolveEntries(window, spec.entries))) { - bar->addMenu(menu); - } else { - delete menu; - } - } - /// Read the toggle, defaulting to on while settings are still coming up. bool settingEnabled() { @@ -283,25 +269,6 @@ void MacMenuBar::reconcile() if (!platformSupported() || !settingEnabled()) { return; } - - attach(); -} - -void MacMenuBar::attach() -{ - auto* bar = new QMenuBar(m_window); - bar->setObjectName(QStringLiteral("macMenuBar")); - bar->setNativeMenuBar(true); - - for (const MenuSpec& spec : kLeadingMenus) { - addSpecMenu(bar, m_window, spec); - } - attachWindowMenu(bar); - attachAccounts(bar); - addSpecMenu(bar, m_window, kHelpMenu); - - m_bar = bar; - m_window->setMenuBar(bar); } void MacMenuBar::detach() @@ -321,53 +288,6 @@ void MacMenuBar::detach() } } -void MacMenuBar::attachWindowMenu(QMenuBar* bar) -{ - auto* menu = - new QMenu(QCoreApplication::translate(kContext, "&Window"), bar); - - QAction* minimize = - menu->addAction(QCoreApplication::translate(kContext, "Minimize")); - minimize->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M)); - connect(minimize, &QAction::triggered, m_window, &QWidget::showMinimized); - - QAction* zoom = - menu->addAction(QCoreApplication::translate(kContext, "Zoom")); - connect(zoom, &QAction::triggered, this, [this] { - if (m_window->isMaximized()) { - m_window->showNormal(); - } else { - m_window->showMaximized(); - } - }); - - /* Deliberately no Close item. Shutting the main window ends the - * session, and Cmd-W is far too easy to hit by accident for that. */ - - bar->addMenu(menu); -} - -void MacMenuBar::attachAccounts(QMenuBar* bar) -{ - m_accountSource = m_window->findChild( - QString::fromLatin1(kAccountMenuName), Qt::FindDirectChildrenOnly); - if (!m_accountSource) { - return; - } - - /* The window rebuilds that menu from scratch whenever the account list - * moves, so watch it rather than reading it once. Copying is safer than - * sharing the menu outright: the toolbar button owns the original as a - * popup, and the native bar wants a menu of its own. */ - m_accountSource->installEventFilter(this); - - m_accounts = - new QMenu(QCoreApplication::translate(kContext, "&Accounts"), bar); - bar->addMenu(m_accounts.data()); - - syncAccounts(); -} - void MacMenuBar::syncAccounts() { if (!m_accounts) { diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 48118dc5..e72538b7 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -342,12 +342,6 @@ void MainWindow::setupUi() ui->setupUi(this); #ifdef Q_OS_MACOS - /* Reparented before the menu bar goes, because they outlive it: the - * toolbar buttons pop them up and MacMenuBar reuses them. */ - ui->foldersMenu->setParent(this); - ui->helpMenu->setParent(this); - ui->accountMenu->setParent(this); - setMenuBar(nullptr); ui->menuBar = nullptr; #endif