small fix

This commit is contained in:
Le Tan 2018-04-19 20:31:43 +08:00
parent beee7a3cb8
commit 80e65faca2
6 changed files with 30 additions and 10 deletions

View File

@ -9,6 +9,8 @@ Toggle expanding the edit area.
Create a note in current folder. Create a note in current folder.
- `Ctrl+F` - `Ctrl+F`
Find/Replace in current note. Find/Replace in current note.
- `Ctrl+Alt+F`
Advanced find.
- `Ctrl+Q` - `Ctrl+Q`
Quit VNote. Quit VNote.
- `Ctrl+J`/`Ctrl+K` - `Ctrl+J`/`Ctrl+K`
@ -240,6 +242,8 @@ Apply a snippet in edit mode.
Export notes. Export notes.
- `I` - `I`
Toggle live preview panel. Toggle live preview panel.
- `C`
Toggle full-text search.
- `Shift+?` - `Shift+?`
Display shortcuts documentation. Display shortcuts documentation.

View File

@ -9,6 +9,8 @@
在当前文件夹下新建笔记。 在当前文件夹下新建笔记。
- `Ctrl+F` - `Ctrl+F`
页内查找和替换。 页内查找和替换。
- `Ctrl+Alt+F`
高级查找。
- `Ctrl+Q` - `Ctrl+Q`
退出VNote。 退出VNote。
- `Ctrl+J`/`Ctrl+K` - `Ctrl+J`/`Ctrl+K`
@ -241,6 +243,8 @@ RemoveSplit=R
导出笔记。 导出笔记。
- `I` - `I`
打开或关闭实时预览面板。 打开或关闭实时预览面板。
- `C`
打开或关闭全文查找。
- `Shift+?` - `Shift+?`
显示本快捷键说明。 显示本快捷键说明。

View File

@ -68,7 +68,7 @@ bool VHelpUE::initListWidget()
m_listWidget->addItem(tr("Ctrl+J: Go to next item")); 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+K: Go to previous item"));
m_listWidget->addItem(tr("Ctrl+L: Go to current item's parent 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("Ctrl+S: Sort items"));
m_listWidget->addItem(tr("Enter: Activate current item")); m_listWidget->addItem(tr("Enter: Activate current item"));
m_listWidget->addItem(tr("Ctrl+M: Browse current item folder or the folder containing current item")); m_listWidget->addItem(tr("Ctrl+M: Browse current item folder or the folder containing current item"));

View File

@ -438,7 +438,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
menuBarAct->setChecked(g_config->getMenuBarChecked()); menuBarAct->setChecked(g_config->getMenuBarChecked());
connect(menuBarAct, &QAction::triggered, connect(menuBarAct, &QAction::triggered,
this, [this](bool p_checked) { this, [this](bool p_checked) {
menuBar()->setVisible(p_checked); setMenuBarVisible(p_checked);
g_config->setMenuBarChecked(p_checked); g_config->setMenuBarChecked(p_checked);
}); });
@ -767,7 +767,7 @@ void VMainWindow::initMenuBar()
initMarkdownMenu(); initMarkdownMenu();
initHelpMenu(); initHelpMenu();
menuBar()->setVisible(g_config->getMenuBarChecked()); setMenuBarVisible(g_config->getMenuBarChecked());
} }
void VMainWindow::initHelpMenu() void VMainWindow::initHelpMenu()
@ -951,16 +951,16 @@ void VMainWindow::initMarkdownMenu()
markdownMenu->addAction(lineNumberAct); markdownMenu->addAction(lineNumberAct);
lineNumberAct->setChecked(g_config->getEnableCodeBlockLineNumber()); lineNumberAct->setChecked(g_config->getEnableCodeBlockLineNumber());
QAction *previewImageAct = new QAction(tr("Preview Images In Edit Mode"), this); QAction *previewImageAct = new QAction(tr("In-Place Preview"), this);
previewImageAct->setToolTip(tr("Enable image preview in edit mode (re-open current tabs to make it work)")); 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); previewImageAct->setCheckable(true);
connect(previewImageAct, &QAction::triggered, connect(previewImageAct, &QAction::triggered,
this, &VMainWindow::enableImagePreview); this, &VMainWindow::enableImagePreview);
markdownMenu->addAction(previewImageAct); markdownMenu->addAction(previewImageAct);
previewImageAct->setChecked(g_config->getEnablePreviewImages()); previewImageAct->setChecked(g_config->getEnablePreviewImages());
QAction *previewWidthAct = new QAction(tr("Constrain The Width Of Previewed Images"), this); QAction *previewWidthAct = new QAction(tr("Constrain The Width Of In-Place Preview"), this);
previewWidthAct->setToolTip(tr("Constrain the width of previewed images to the edit window in edit mode")); previewWidthAct->setToolTip(tr("Constrain the width of in-place preview to the edit window in edit mode"));
previewWidthAct->setCheckable(true); previewWidthAct->setCheckable(true);
connect(previewWidthAct, &QAction::triggered, connect(previewWidthAct, &QAction::triggered,
this, &VMainWindow::enableImagePreviewConstraint); this, &VMainWindow::enableImagePreviewConstraint);
@ -1424,7 +1424,7 @@ void VMainWindow::aboutMessage()
{ {
QString info = tr("<span style=\"font-weight: bold;\">v%1</span>").arg(VConfigManager::c_version); QString info = tr("<span style=\"font-weight: bold;\">v%1</span>").arg(VConfigManager::c_version);
info += "<br/><br/>"; info += "<br/><br/>";
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 += "<br/>"; info += "<br/>";
info += tr("Please visit <a href=\"https://github.com/tamlok/vnote.git\">Github</a> for more information."); info += tr("Please visit <a href=\"https://github.com/tamlok/vnote.git\">Github</a> for more information.");
QMessageBox::about(this, tr("About VNote"), info); QMessageBox::about(this, tr("About VNote"), info);
@ -3259,3 +3259,13 @@ void VMainWindow::checkNotebooks()
m_notebookSelector->restoreCurrentNotebook(); 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);
}
}

View File

@ -287,6 +287,8 @@ private:
void initUniversalEntry(); void initUniversalEntry();
void setMenuBarVisible(bool p_visible);
// Captain mode functions. // Captain mode functions.
// Popup the attachment list if it is enabled. // Popup the attachment list if it is enabled.

View File

@ -364,9 +364,9 @@ void VUniversalEntry::keyPressEvent(QKeyEvent *p_event)
break; break;
case Qt::Key_T: case Qt::Key_Y:
if (VUtils::isControlModifierForVim(modifiers)) { if (VUtils::isControlModifierForVim(modifiers)) {
// Ctrl+T to expand or collapse an item. // Ctrl+Y to expand or collapse an item.
if (m_lastEntry) { if (m_lastEntry) {
m_lastEntry->m_entry->toggleItemExpanded(m_lastEntry->m_id); m_lastEntry->m_entry->toggleItemExpanded(m_lastEntry->m_id);
} }