diff --git a/src/libs/core/settings.cpp b/src/libs/core/settings.cpp index 38873388..abb8aae2 100644 --- a/src/libs/core/settings.cpp +++ b/src/libs/core/settings.cpp @@ -114,6 +114,8 @@ void Settings::load() minimizeToSystray = settings->value(QStringLiteral("minimize_to_systray"), false).toBool(); hideOnClose = settings->value(QStringLiteral("hide_on_close"), false).toBool(); + hideMenuBar = settings->value(QStringLiteral("hide_menu_bar"), false).toBool(); + settings->beginGroup(GroupGlobalShortcuts); showShortcut = settings->value(QStringLiteral("show")).value(); settings->endGroup(); @@ -246,6 +248,8 @@ void Settings::save() settings->setValue(QStringLiteral("minimize_to_systray"), minimizeToSystray); settings->setValue(QStringLiteral("hide_on_close"), hideOnClose); + settings->setValue(QStringLiteral("hide_menu_bar"), hideMenuBar); + settings->beginGroup(GroupGlobalShortcuts); settings->setValue(QStringLiteral("show"), showShortcut); settings->endGroup(); diff --git a/src/libs/core/settings.h b/src/libs/core/settings.h index be755d47..19cd7a6d 100644 --- a/src/libs/core/settings.h +++ b/src/libs/core/settings.h @@ -58,6 +58,9 @@ class Settings final : public QObject // Tabs Behavior bool openNewTabAfterActive; + // Appearance + bool hideMenuBar; + // Search bool isFuzzySearchEnabled; diff --git a/src/libs/ui/mainwindow.cpp b/src/libs/ui/mainwindow.cpp index 440aaf67..9269e85e 100644 --- a/src/libs/ui/mainwindow.cpp +++ b/src/libs/ui/mainwindow.cpp @@ -154,6 +154,19 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) dialog->exec(); }); + // View Menu + ui->actionHideMenu->setShortcut(QStringLiteral("Ctrl+m")); + connect(ui->actionHideMenu, &QAction::triggered, this, [this]() { + if (ui->menuBar->isVisible()) { + m_settings->hideMenuBar = true; + } + else { + m_settings->hideMenuBar = false; + } + applySettings(); + }); + addAction(ui->actionHideMenu); + // Help Menu connect(ui->actionSubmitFeedback, &QAction::triggered, []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/zealdocs/zeal/issues"))); @@ -533,6 +546,13 @@ void MainWindow::applySettings() m_globalShortcut->setShortcut(m_settings->showShortcut); } + if (m_settings->hideMenuBar){ + ui->menuBar->hide(); + } + else { + ui->menuBar->show(); + } + if (m_settings->showSystrayIcon) createTrayIcon(); else diff --git a/src/libs/ui/mainwindow.ui b/src/libs/ui/mainwindow.ui index ed423fbe..87fe8ee8 100644 --- a/src/libs/ui/mainwindow.ui +++ b/src/libs/ui/mainwindow.ui @@ -94,6 +94,12 @@ + + + &View + + + &Tools @@ -102,6 +108,7 @@ + @@ -175,6 +182,11 @@ &Find + + + &Hide menubar + + &Docsets…