Browse Source

support N to view current note's information in Captain mode

Le Tan 6 years ago
parent
commit
93d2001519

+ 8 - 0
src/resources/docs/shortcuts_en.md

@@ -274,6 +274,8 @@ Expand/restore live preview panel.
 Toggle full-text search.
 - `P`  
 Parse HTML as Markdown text in clipboard and paste.
+- `N`  
+View and edit current note's information.
 - `Shift+?`   
 Display shortcuts documentation.
 
@@ -283,6 +285,12 @@ Within the Captain Mode, `W` will turn VNote into **Navigation Mode**. In this m
 # Vim Mode
 VNote supports a simple but useful Vim mode, including **Normal**, **Insert**, **Visual**, and **VisualLine** modes.
 
+::: alert-info
+
+Open `Settings` dialog via the `File` menu, then jump to `Read/Edit` tab and you could enable Vim via the combo box in `Key mode`. Restart VNote to take effect.
+
+:::
+
 VNote supports following features of Vim:
 
 - `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, and `O`;

+ 8 - 0
src/resources/docs/shortcuts_ja.md

@@ -265,6 +265,8 @@ RemoveSplit=R
 全文検索を切り替えます。
 - `P`
 クリップボードのHTMLをMarksownテキストとして貼り付けます。
+- `N`  
+View and edit current note's information.
 - `Shift+?` 
 ショートカットのドキュメントを表示します。
 
@@ -274,6 +276,12 @@ RemoveSplit=R
 # Vimモード
 VNoteは、**Normal**、**Insert**、**Visual**、および**VisualLine**の各モードを含む、単純で有用なVimモードをサポートしています。
 
+::: alert-info
+
+Open `Settings` dialog via the `File` menu, then jump to `Read/Edit` tab and you could enable Vim via the combo box in `Key mode`. Restart VNote to take effect.
+
+:::
+
 VNoteはVimの次の機能をサポートしています:
 
 - `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, and `O`;

+ 8 - 0
src/resources/docs/shortcuts_zh.md

@@ -275,6 +275,8 @@ RemoveSplit=R
 打开或关闭全文查找。
 - `P`  
 解析剪切板中的HTML为Markdown文本并粘贴。
+- `N`  
+查看和编辑当前笔记信息。
 - `Shift+?`   
 显示本快捷键说明。
 
@@ -284,6 +286,12 @@ RemoveSplit=R
 # Vim Mode
 VNote支持一个简单但有用的Vim模式,包括 **正常**, **插入**, **可视**, **可视行** 模式。
 
+::: alert-info
+
+在`文件`菜单中选择`设置`打开对话框,跳转到`阅读/编辑`标签页,在`按键模式`下拉框中选择开启Vim即可。需要重启VNote以生效。
+
+:::
+
 VNote支持以下几个Vim的特性:
 
 - `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, `O`;

+ 2 - 0
src/resources/vnote.ini

@@ -541,6 +541,8 @@ ExpandLivePreview=U
 FocusEditArea=Y
 ; Parse HTML and paste
 ParseAndPaste=P
+; View note info of current edit tab
+CurrentNoteInfo=N
 
 [external_editors]
 ; Define external editors which could be called to edit notes

+ 18 - 1
src/vmainwindow.cpp

@@ -197,6 +197,10 @@ void VMainWindow::registerCaptainAndNavigationTargets()
                                      g_config->getCaptainShortcutKeySequence("ExpandMode"),
                                      this,
                                      toggleExpandModeByCaptain);
+    m_captain->registerCaptainTarget(tr("CurrentNoteInfo"),
+                                     g_config->getCaptainShortcutKeySequence("CurrentNoteInfo"),
+                                     this,
+                                     currentNoteInfoByCaptain);
     m_captain->registerCaptainTarget(tr("DiscardAndRead"),
                                      g_config->getCaptainShortcutKeySequence("DiscardAndRead"),
                                      this,
@@ -731,7 +735,9 @@ QToolBar *VMainWindow::initFileToolBar(QSize p_iconSize)
             m_fileList, &VFileList::newFile);
 
     noteInfoAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/note_info_tb.svg"),
-                              tr("Note Info"), this);
+                              tr("Note Info"),
+                              this);
+    VUtils::fixTextWithCaptainShortcut(noteInfoAct, "CurrentNoteInfo");
     noteInfoAct->setStatusTip(tr("View and edit current note's information"));
     connect(noteInfoAct, &QAction::triggered,
             this, &VMainWindow::curEditFileInfo);
@@ -2858,6 +2864,17 @@ bool VMainWindow::toggleExpandModeByCaptain(void *p_target, void *p_data)
     return true;
 }
 
+bool VMainWindow::currentNoteInfoByCaptain(void *p_target, void *p_data)
+{
+    Q_UNUSED(p_data);
+    VMainWindow *obj = static_cast<VMainWindow *>(p_target);
+    if (obj->noteInfoAct->isEnabled()) {
+        obj->curEditFileInfo();
+    }
+
+    return true;
+}
+
 bool VMainWindow::discardAndReadByCaptain(void *p_target, void *p_data)
 {
     Q_UNUSED(p_data);

+ 2 - 0
src/vmainwindow.h

@@ -340,6 +340,8 @@ private:
 
     static bool toggleExpandModeByCaptain(void *p_target, void *p_data);
 
+    static bool currentNoteInfoByCaptain(void *p_target, void *p_data);
+
     static bool discardAndReadByCaptain(void *p_target, void *p_data);
 
     static bool toggleToolBarByCaptain(void *p_target, void *p_data);