diff --git a/src/resources/icons/menubar.svg b/src/resources/icons/menubar.svg
new file mode 100644
index 00000000..e20aea38
--- /dev/null
+++ b/src/resources/icons/menubar.svg
@@ -0,0 +1,14 @@
+
+
+
+
diff --git a/src/resources/vnote.ini b/src/resources/vnote.ini
index 96237926..ec37a745 100644
--- a/src/resources/vnote.ini
+++ b/src/resources/vnote.ini
@@ -149,6 +149,9 @@ enable_compact_mode=true
; Whether enable tools dock widget
tools_dock_checked=true
+; Whether show menu bar
+menu_bar_checked=true
+
; Pages to open on startup
; 0 - none; 1 - Continue where you left off; 2 - specific pages
startup_page_type=0
diff --git a/src/vconfigmanager.h b/src/vconfigmanager.h
index 5c928d88..ae09b84a 100644
--- a/src/vconfigmanager.h
+++ b/src/vconfigmanager.h
@@ -435,6 +435,9 @@ public:
// Return [web]/copy_targets.
QStringList getCopyTargets() const;
+ bool getMenuBarChecked() const;
+ void setMenuBarChecked(bool p_checked);
+
private:
// Look up a config from user and default settings.
QVariant getConfigFromSettings(const QString §ion, const QString &key) const;
@@ -2022,4 +2025,15 @@ inline QString VConfigManager::getStyleOfSpanForMark() const
return getConfigFromSettings("web",
"style_of_span_for_mark").toString();
}
+
+inline bool VConfigManager::getMenuBarChecked() const
+{
+ return getConfigFromSettings("global",
+ "menu_bar_checked").toBool();
+}
+
+inline void VConfigManager::setMenuBarChecked(bool p_checked)
+{
+ setConfigToSettings("global", "menu_bar_checked", p_checked);
+}
#endif // VCONFIGMANAGER_H
diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp
index 1854f6a6..95896195 100644
--- a/src/vmainwindow.cpp
+++ b/src/vmainwindow.cpp
@@ -429,18 +429,35 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
viewToolBar->addAction(expandViewAct);
- m_fullScreenAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/fullscreen.svg"),
- tr("Full Screen"),
- this);
+ QAction *menuBarAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/menubar.svg"),
+ tr("Menu Bar"),
+ this);
+ menuBarAct->setStatusTip(tr("Toggle menu bar"));
+ menuBarAct->setCheckable(true);
+ menuBarAct->setChecked(g_config->getMenuBarChecked());
+ connect(menuBarAct, &QAction::triggered,
+ this, [this](bool p_checked) {
+ menuBar()->setVisible(p_checked);
+ g_config->setMenuBarChecked(p_checked);
+ });
+
+ QMenu *screenMenu = new QMenu(this);
+ screenMenu->setToolTipsVisible(true);
+ screenMenu->addAction(menuBarAct);
+
+ QAction *fullScreenAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/fullscreen.svg"),
+ tr("Full Screen"),
+ this);
QString keySeq = g_config->getShortcutKeySequence("FullScreen");
QKeySequence seq(keySeq);
if (!seq.isEmpty()) {
- m_fullScreenAct->setText(tr("Full Screen\t%1").arg(VUtils::getShortcutText(keySeq)));
- m_fullScreenAct->setShortcut(seq);
+ fullScreenAct->setText(tr("Full Screen\t%1").arg(VUtils::getShortcutText(keySeq)));
+ fullScreenAct->setShortcut(seq);
}
- m_fullScreenAct->setStatusTip(tr("Toggle full screen"));
- connect(m_fullScreenAct, &QAction::triggered,
+ fullScreenAct->setStatusTip(tr("Toggle full screen"));
+ fullScreenAct->setMenu(screenMenu);
+ connect(fullScreenAct, &QAction::triggered,
this, [this]() {
if (windowState() & Qt::WindowFullScreen) {
if (m_windowOldState & Qt::WindowMaximized) {
@@ -453,7 +470,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
}
});
- viewToolBar->addAction(m_fullScreenAct);
+ viewToolBar->addAction(fullScreenAct);
}
// Enable/disable all actions of @p_widget.
@@ -764,6 +781,8 @@ void VMainWindow::initMenuBar()
initViewMenu();
initMarkdownMenu();
initHelpMenu();
+
+ menuBar()->setVisible(g_config->getMenuBarChecked());
}
void VMainWindow::initHelpMenu()
@@ -1877,12 +1896,12 @@ void VMainWindow::handleAreaTabStatusUpdated(const VEditTabInfo &p_info)
}
// Disconnect the trigger signal from edit tab.
- disconnect(m_curTab, 0, m_vimCmd, 0);
+ disconnect((VEditTab *)m_curTab, 0, m_vimCmd, 0);
}
m_curTab = p_info.m_editTab;
if (m_curTab) {
- connect(m_curTab, &VEditTab::triggerVimCmd,
+ connect((VEditTab *)m_curTab, &VEditTab::triggerVimCmd,
m_vimCmd, &VVimCmdLineEdit::reset);
}
diff --git a/src/vmainwindow.h b/src/vmainwindow.h
index 75220b01..8a34affa 100644
--- a/src/vmainwindow.h
+++ b/src/vmainwindow.h
@@ -337,8 +337,6 @@ private:
QAction *expandViewAct;
- QAction *m_fullScreenAct;
-
QAction *m_importNoteAct;
QAction *m_printAct;
diff --git a/src/vnote.qrc b/src/vnote.qrc
index 49921d1d..6004799c 100644
--- a/src/vnote.qrc
+++ b/src/vnote.qrc
@@ -238,5 +238,6 @@
resources/icons/cart.svg
resources/icons/delete_cart_item.svg
resources/icons/fullscreen.svg
+ resources/icons/menubar.svg