From 80e65faca25c6249648c3dbc1086603eaab70bd2 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 19 Apr 2018 20:31:43 +0800 Subject: [PATCH] small fix --- src/resources/docs/shortcuts_en.md | 4 ++++ src/resources/docs/shortcuts_zh.md | 4 ++++ src/vhelpue.cpp | 2 +- src/vmainwindow.cpp | 24 +++++++++++++++++------- src/vmainwindow.h | 2 ++ src/vuniversalentry.cpp | 4 ++-- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/resources/docs/shortcuts_en.md b/src/resources/docs/shortcuts_en.md index 2ed6bceb..f8239958 100644 --- a/src/resources/docs/shortcuts_en.md +++ b/src/resources/docs/shortcuts_en.md @@ -9,6 +9,8 @@ Toggle expanding the edit area. Create a note in current folder. - `Ctrl+F` Find/Replace in current note. +- `Ctrl+Alt+F` +Advanced find. - `Ctrl+Q` Quit VNote. - `Ctrl+J`/`Ctrl+K` @@ -240,6 +242,8 @@ Apply a snippet in edit mode. Export notes. - `I` Toggle live preview panel. +- `C` +Toggle full-text search. - `Shift+?` Display shortcuts documentation. diff --git a/src/resources/docs/shortcuts_zh.md b/src/resources/docs/shortcuts_zh.md index 5817458c..0c8fd319 100644 --- a/src/resources/docs/shortcuts_zh.md +++ b/src/resources/docs/shortcuts_zh.md @@ -9,6 +9,8 @@ 在当前文件夹下新建笔记。 - `Ctrl+F` 页内查找和替换。 +- `Ctrl+Alt+F` +高级查找。 - `Ctrl+Q` 退出VNote。 - `Ctrl+J`/`Ctrl+K` @@ -241,6 +243,8 @@ RemoveSplit=R 导出笔记。 - `I` 打开或关闭实时预览面板。 +- `C` +打开或关闭全文查找。 - `Shift+?` 显示本快捷键说明。 diff --git a/src/vhelpue.cpp b/src/vhelpue.cpp index afd61e79..4b718f7e 100644 --- a/src/vhelpue.cpp +++ b/src/vhelpue.cpp @@ -68,7 +68,7 @@ bool VHelpUE::initListWidget() m_listWidget->addItem(tr("Ctrl+J: Go to next item")); m_listWidget->addItem(tr("Ctrl+K: Go to previous item")); m_listWidget->addItem(tr("Ctrl+L: Go to current item's parent item")); - m_listWidget->addItem(tr("Ctrl+T: Expand/Collapse current item")); + m_listWidget->addItem(tr("Ctrl+Y: Expand/Collapse current item")); m_listWidget->addItem(tr("Ctrl+S: Sort items")); m_listWidget->addItem(tr("Enter: Activate current item")); m_listWidget->addItem(tr("Ctrl+M: Browse current item folder or the folder containing current item")); diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index 3694c534..f38d30b5 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -438,7 +438,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize) menuBarAct->setChecked(g_config->getMenuBarChecked()); connect(menuBarAct, &QAction::triggered, this, [this](bool p_checked) { - menuBar()->setVisible(p_checked); + setMenuBarVisible(p_checked); g_config->setMenuBarChecked(p_checked); }); @@ -767,7 +767,7 @@ void VMainWindow::initMenuBar() initMarkdownMenu(); initHelpMenu(); - menuBar()->setVisible(g_config->getMenuBarChecked()); + setMenuBarVisible(g_config->getMenuBarChecked()); } void VMainWindow::initHelpMenu() @@ -951,16 +951,16 @@ void VMainWindow::initMarkdownMenu() markdownMenu->addAction(lineNumberAct); lineNumberAct->setChecked(g_config->getEnableCodeBlockLineNumber()); - QAction *previewImageAct = new QAction(tr("Preview Images In Edit Mode"), this); - previewImageAct->setToolTip(tr("Enable image preview in edit mode (re-open current tabs to make it work)")); + QAction *previewImageAct = new QAction(tr("In-Place Preview"), this); + previewImageAct->setToolTip(tr("Enable in-place preview (images, diagrams, and formulas) in edit mode (re-open current tabs to make it work)")); previewImageAct->setCheckable(true); connect(previewImageAct, &QAction::triggered, this, &VMainWindow::enableImagePreview); markdownMenu->addAction(previewImageAct); previewImageAct->setChecked(g_config->getEnablePreviewImages()); - QAction *previewWidthAct = new QAction(tr("Constrain The Width Of Previewed Images"), this); - previewWidthAct->setToolTip(tr("Constrain the width of previewed images to the edit window in edit mode")); + QAction *previewWidthAct = new QAction(tr("Constrain The Width Of In-Place Preview"), this); + previewWidthAct->setToolTip(tr("Constrain the width of in-place preview to the edit window in edit mode")); previewWidthAct->setCheckable(true); connect(previewWidthAct, &QAction::triggered, this, &VMainWindow::enableImagePreviewConstraint); @@ -1424,7 +1424,7 @@ void VMainWindow::aboutMessage() { QString info = tr("v%1").arg(VConfigManager::c_version); info += "

"; - info += tr("VNote is a Vim-inspired note-taking application for Markdown."); + info += tr("VNote is a free Vim-inspired note-taking application that knows programmers and Markdown better."); info += "
"; info += tr("Please visit Github for more information."); QMessageBox::about(this, tr("About VNote"), info); @@ -3259,3 +3259,13 @@ void VMainWindow::checkNotebooks() m_notebookSelector->restoreCurrentNotebook(); } + +void VMainWindow::setMenuBarVisible(bool p_visible) +{ + // Hiding the menubar will disable the shortcut of QActions. + if (p_visible) { + menuBar()->setFixedSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); + } else { + menuBar()->setFixedHeight(0); + } +} diff --git a/src/vmainwindow.h b/src/vmainwindow.h index c355cd19..00f96655 100644 --- a/src/vmainwindow.h +++ b/src/vmainwindow.h @@ -287,6 +287,8 @@ private: void initUniversalEntry(); + void setMenuBarVisible(bool p_visible); + // Captain mode functions. // Popup the attachment list if it is enabled. diff --git a/src/vuniversalentry.cpp b/src/vuniversalentry.cpp index 4ba34503..9e4077b3 100644 --- a/src/vuniversalentry.cpp +++ b/src/vuniversalentry.cpp @@ -364,9 +364,9 @@ void VUniversalEntry::keyPressEvent(QKeyEvent *p_event) break; - case Qt::Key_T: + case Qt::Key_Y: if (VUtils::isControlModifierForVim(modifiers)) { - // Ctrl+T to expand or collapse an item. + // Ctrl+Y to expand or collapse an item. if (m_lastEntry) { m_lastEntry->m_entry->toggleItemExpanded(m_lastEntry->m_id); }