mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-04 21:39:52 +08:00
add Chinese translations (#1615)
* add Chinese translations * remove widgets_zh_CN.ts and update qt_zh_CN.ts * refine
This commit is contained in:
parent
06ee73dcd5
commit
6dce8e65a7
3
.github/workflows/ci-macos.yml
vendored
3
.github/workflows/ci-macos.yml
vendored
@ -108,7 +108,8 @@ jobs:
|
||||
mv ../../src/vnote.app ./
|
||||
ln -s /Applications ./Applications
|
||||
popd
|
||||
hdiutil create -srcfolder ./distrib/vnote -format UDBZ ./vnote-mac-x64_v${{env.VNOTE_VER}}.dmg
|
||||
sleep 1m
|
||||
hdiutil create -srcfolder ./distrib/vnote -format UDBZ vnote-mac-x64_v${{env.VNOTE_VER}}.dmg
|
||||
cp vnote-mac-x64_v${{env.VNOTE_VER}}.dmg vnote-mac-x64.dmg
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
vtextedit \
|
||||
vtitlebar
|
||||
vtextedit
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 50948fae623399c5df4f5435cbcbc5f676087a2a
|
||||
Subproject commit 12a74cb32438b28f002dea51c484133d3058a882
|
@ -1,22 +0,0 @@
|
||||
#include "vtitlebar.h"
|
||||
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
VTitleBar::VTitleBar(QWidget *p_parent)
|
||||
: QWidget(p_parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void VTitleBar::paintEvent(QPaintEvent *p_event)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
|
||||
QWidget::paintEvent(p_event);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#ifndef VTITLEBAR_H
|
||||
#define VTITLEBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace vnotex
|
||||
{
|
||||
class VTitleBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VTitleBar(QWidget *p_parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *p_event) Q_DECL_OVERRIDE;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // VTITLEBAR_H
|
@ -1,16 +0,0 @@
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = vtitlebar
|
||||
|
||||
TEMPLATE = lib
|
||||
|
||||
# CONFIG += warn_off
|
||||
CONFIG += staticlib
|
||||
|
||||
SOURCES += \
|
||||
src/vtitlebar.cpp \
|
||||
src/vtoolbar.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/vtitlebar.h \
|
||||
src/vtoolbar.h
|
@ -1,17 +0,0 @@
|
||||
INCLUDEPATH *= $$PWD/src
|
||||
|
||||
DEPENDPATH *= $$PWD/src
|
||||
|
||||
OUT_FOLDER = $$absolute_path($$relative_path($$PWD, $$_PRO_FILE_PWD_), $$OUT_PWD)
|
||||
win32:CONFIG(release, debug|release) {
|
||||
LIBS += $$OUT_FOLDER/release/vtitlebar.lib
|
||||
# For static library, we need to add this depends to let Qt re-build the target
|
||||
# when there is a change in the library.
|
||||
PRE_TARGETDEPS += $$OUT_FOLDER/release/vtitlebar.lib
|
||||
} else:win32:CONFIG(debug, debug|release) {
|
||||
LIBS += $$OUT_FOLDER/debug/vtitlebar.lib
|
||||
PRE_TARGETDEPS += $$OUT_FOLDER/debug/vtitlebar.lib
|
||||
} else:unix {
|
||||
LIBS += $$OUT_FOLDER/libvtitlebar.a
|
||||
PRE_TARGETDEPS += $$OUT_FOLDER/libvtitlebar.a
|
||||
}
|
@ -24,7 +24,7 @@ QString BundleNotebookFactory::getName() const
|
||||
|
||||
QString BundleNotebookFactory::getDisplayName() const
|
||||
{
|
||||
return QObject::tr("Bundled Notebook");
|
||||
return QObject::tr("Bundle Notebook");
|
||||
}
|
||||
|
||||
QString BundleNotebookFactory::getDescription() const
|
||||
|
@ -76,5 +76,11 @@
|
||||
<file>logo/vnote.png</file>
|
||||
<file>logo/256x256/vnote.png</file>
|
||||
<file>logo/vnote_mono.png</file>
|
||||
<file>translations/qdialogbuttonbox_zh_CN.qm</file>
|
||||
<file>translations/qwebengine_zh_CN.qm</file>
|
||||
<file>translations/qt_zh_CN.qm</file>
|
||||
<file>translations/vnote_zh_CN.qm</file>
|
||||
<file>translations/qtbase_zh_CN.qm</file>
|
||||
<file>translations/vtextedit_zh_CN.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
src/data/core/translations/qdialogbuttonbox_zh_CN.qm
Normal file
BIN
src/data/core/translations/qdialogbuttonbox_zh_CN.qm
Normal file
Binary file not shown.
79
src/data/core/translations/qdialogbuttonbox_zh_CN.ts
Normal file
79
src/data/core/translations/qdialogbuttonbox_zh_CN.ts
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>QPlatformTheme</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save</source>
|
||||
<translation>保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save All</source>
|
||||
<translation>全部保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open</source>
|
||||
<translation>打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Yes</source>
|
||||
<translation>是(&Y)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes to &All</source>
|
||||
<translation>全部选择是(&A)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&No</source>
|
||||
<translation>否(&N)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>N&o to All</source>
|
||||
<translation>全部选择否(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Abort</source>
|
||||
<translation>终止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>重试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ignore</source>
|
||||
<translation>忽略</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close</source>
|
||||
<translation>关闭</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Discard</source>
|
||||
<translation>放弃</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Help</source>
|
||||
<translation>帮助</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Apply</source>
|
||||
<translation>应用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation>重置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restore Defaults</source>
|
||||
<translation>恢复默认</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
BIN
src/data/core/translations/qt_zh_CN.qm
Normal file
BIN
src/data/core/translations/qt_zh_CN.qm
Normal file
Binary file not shown.
7967
src/data/core/translations/qt_zh_CN.ts
Normal file
7967
src/data/core/translations/qt_zh_CN.ts
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/data/core/translations/qtbase_zh_CN.qm
Normal file
BIN
src/data/core/translations/qtbase_zh_CN.qm
Normal file
Binary file not shown.
7554
src/data/core/translations/qtbase_zh_CN.ts
Normal file
7554
src/data/core/translations/qtbase_zh_CN.ts
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/data/core/translations/qwebengine_zh_CN.qm
Normal file
BIN
src/data/core/translations/qwebengine_zh_CN.qm
Normal file
Binary file not shown.
193
src/data/core/translations/qwebengine_zh_CN.ts
Normal file
193
src/data/core/translations/qwebengine_zh_CN.ts
Normal file
@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<!--QWebEngineView uses different sources for its standard context menu.-->
|
||||
<!--https://code.woboq.org/qt5/qtwebengine/src/core/render_view_context_menu_qt.cpp.html-->
|
||||
<!--https://code.woboq.org/qt5/qtwebengine/src/webenginewidgets/api/qwebenginepage.cpp.html-->
|
||||
<context>
|
||||
<name>RenderViewContextMenuQt</name>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation>后退</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forward</source>
|
||||
<translation>前进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reload</source>
|
||||
<translation>重新加载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation>剪切</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy</source>
|
||||
<translation>复制</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Paste</source>
|
||||
<translation>粘贴</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Undo</source>
|
||||
<translation>撤消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Redo</source>
|
||||
<translation>恢复</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Select all</source>
|
||||
<translation>选择全部</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Paste and match style</source>
|
||||
<translation>粘贴并匹配样式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in new window</source>
|
||||
<translation>在新窗口打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in new tab</source>
|
||||
<translation>在新标签页打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy link address</source>
|
||||
<translation>复制链接地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save link</source>
|
||||
<translation>保存链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy image</source>
|
||||
<translation>复制图片</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy image address</source>
|
||||
<translation>复制图片地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save image</source>
|
||||
<translation>保存图片</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy media address</source>
|
||||
<translation>复制媒体地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show controls</source>
|
||||
<translation>显示控件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loop</source>
|
||||
<translation>循环</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save media</source>
|
||||
<translation>保存媒体</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Inspect</source>
|
||||
<translation>查看</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Exit full screen</source>
|
||||
<translation>退出全屏</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save page</source>
|
||||
<translation>保存页面</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>View page source</source>
|
||||
<translation>查看页面源码</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QWebEnginePage</name>
|
||||
<message>
|
||||
<source>Stop</source>
|
||||
<translation>停止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reload and Bypass Cache</source>
|
||||
<translation>忽略缓存重新加载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in this window</source>
|
||||
<translation>在当前窗口打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in new background tab</source>
|
||||
<translation>在后台新标签页打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Toggle Play/Pause</source>
|
||||
<translation>切换播放/暂停</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Toggle Mute</source>
|
||||
<translation>切换静音</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close Page</source>
|
||||
<translation>关闭页面</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unselect</source>
|
||||
<translation>取消选择</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Bold</source>
|
||||
<translation>粗体(&B)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Italic</source>
|
||||
<translation>斜体(&I)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Underline</source>
|
||||
<translation>下划线(&U)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Strikethrough</source>
|
||||
<translation>删除线(&S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Left</source>
|
||||
<translation>左对齐(&L)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Center</source>
|
||||
<translation>居中对齐(&C)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Right</source>
|
||||
<translation>右对齐(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Justified</source>
|
||||
<translation>两端对齐(&J)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Indent</source>
|
||||
<translation>缩进(&I)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Outdent</source>
|
||||
<translation>减小缩进(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insert &Ordered List</source>
|
||||
<translation>插入有序列表(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insert &Unordered List</source>
|
||||
<translation>插入无序列表(&U)</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
BIN
src/data/core/translations/vnote_zh_CN.qm
Normal file
BIN
src/data/core/translations/vnote_zh_CN.qm
Normal file
Binary file not shown.
2410
src/data/core/translations/vnote_zh_CN.ts
Normal file
2410
src/data/core/translations/vnote_zh_CN.ts
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/data/core/translations/vtextedit_zh_CN.qm
Normal file
BIN
src/data/core/translations/vtextedit_zh_CN.qm
Normal file
Binary file not shown.
@ -122,7 +122,7 @@ Here is another sentence within the quote.
|
||||
**Notes**:
|
||||
|
||||
* `lang` is optional to specify the language of the code; if not specified, VNote won't highlight the code;
|
||||
* It is always a good practice to add one empty line before the whole fenced code block.
|
||||
* It is always a good practice to add one empty line before the whole fenced code block;
|
||||
|
||||
### Diagrams
|
||||
VNote supports the following engines to draw diagrams. You should specify particular language of the fenced code block and write the definition of your diagram within it.
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## General
|
||||
- `Ctrl+G E`
|
||||
Toggle expanding the edit area.
|
||||
Toggle expanding the content area.
|
||||
- `Ctrl+Alt+N`
|
||||
Create a note in current folder.
|
||||
- `Ctrl+F`
|
||||
|
7
src/data/extra/docs/zh_CN/about_vnotex.txt
Normal file
7
src/data/extra/docs/zh_CN/about_vnotex.txt
Normal file
@ -0,0 +1,7 @@
|
||||
<p>
|
||||
VNoteX 致力于成为一个舒适的笔记平台。VNoteX 重构自 VNote,后者是一个始于2006年的专注于 Markdown 的开源笔记软件。VNote 3.0 会和 VNoteX 共享大部分源代码,并继续开源。
|
||||
<br/><br/>
|
||||
VNote 源代码可以在 <a href="https://github.com/vnotex/vnote">GitHub</a> 获取。
|
||||
<br/><br/>
|
||||
详情请访问<a href="https://vnotex.github.io/vnote">主页</a>。
|
||||
</p>
|
7
src/data/extra/docs/zh_CN/get_started.txt
Normal file
7
src/data/extra/docs/zh_CN/get_started.txt
Normal file
@ -0,0 +1,7 @@
|
||||
<div style="color: grey; margin-left: 30px;">
|
||||
<h1>快速开始</h1>
|
||||
<ul>
|
||||
<li>创建笔记本并在笔记本中创建文件夹和笔记</li>
|
||||
<li>拖拽文件到此处</li>
|
||||
</ul>
|
||||
</div>
|
250
src/data/extra/docs/zh_CN/markdown_guide.md
Normal file
250
src/data/extra/docs/zh_CN/markdown_guide.md
Normal file
@ -0,0 +1,250 @@
|
||||
# Markdown 指南
|
||||
Markdown 是一种轻量级的易用的书写语法。本文是 Markdown 的一个快速指南[^1]。
|
||||
|
||||
## 什么是 Markdown?
|
||||
Markdown 是一种通过少量简单的标记字符来格式化文本的方法。您可以用纯文本来书写文档,然后在阅读时呈现一个美观的排版。
|
||||
|
||||
其实并没有一个标准的 Markdown 语法,很多编辑器都会添加自己的扩展语法。不同于此,为了兼容性,VNote 仅仅支持那些被广泛使用的基本语法。
|
||||
|
||||
## 如何上手 Markdown?
|
||||
如果刚接触 Markdown,那么比较好的一个方法是逐个学习 Markdown 语法。刚开始,懂得标题和强调语法就能够写出基本的文档;然后,每天可以学习一个新的语法并不断练习。
|
||||
|
||||
## 语法指南
|
||||
下面是 VNote 支持的 Markdown 语法的一个概览。
|
||||
|
||||
### 标题
|
||||
```md
|
||||
# This is a <h1> tag
|
||||
## This is a <h2> tag
|
||||
###### This is a <h6> tag
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
* `#`之后需要至少一个空格;
|
||||
* 一个标题应该占一整行;
|
||||
|
||||
### 强调
|
||||
```md
|
||||
*This text will be italic*
|
||||
_This text will be italic_
|
||||
|
||||
**This text will be bold**
|
||||
__This text will be bold__
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
* VNote 推荐使用`*`;
|
||||
* 如果渲染错误,请尝试在第一个`*`之前以及最后一个`*`之后添加一个空格。如果被标记的文本是以全角符号开始或结尾,一般都需要前后添加一个空格;
|
||||
|
||||
### 列表
|
||||
#### 无序列表
|
||||
```md
|
||||
* Item 1
|
||||
只是一段在Item 1下面的文字。需要注意上面一行结尾有两个空格。
|
||||
* Item 2
|
||||
* Item 2a
|
||||
* Item 2b
|
||||
* Item 3
|
||||
|
||||
使用一个空行来来结束一个列表。
|
||||
```
|
||||
|
||||
#### 有序列表
|
||||
```md
|
||||
1. Item 1
|
||||
1. Item 2
|
||||
注意,列表前面的序号其实是无关紧要的,渲染时Markdown会自动修改该序号。
|
||||
3. Item 3
|
||||
1. Item 3a
|
||||
2. Item 3b
|
||||
4. Item 4
|
||||
```
|
||||
|
||||
### 表格
|
||||
```md
|
||||
| col 1 | col 2 | col 3 |
|
||||
| --- | --- | --- |
|
||||
| cell1 | cell2 | cell3 |
|
||||
| cell4 | cell5 | cell6 |
|
||||
```
|
||||
|
||||
### 图片和链接
|
||||
```md
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
[Link Text](/url/of/the/link)
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
* VNote 不推荐使用参考式的图片链接。VNote 不会预览这些图片。
|
||||
|
||||
### 块引用
|
||||
```md
|
||||
As VNote suggests:
|
||||
|
||||
> VNote is the best Markdown note-taking application
|
||||
> ever.
|
||||
>
|
||||
> THere is two spaces after `ever.` above to insert a
|
||||
> new line.
|
||||
|
||||
It also suggests:
|
||||
|
||||
> VNote is good.
|
||||
Here is another sentence within the quote.
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
* `>`标记后面需要至少一个空格;
|
||||
* 多行连续的引用可以只在第一行添加标记;
|
||||
|
||||
### 代码块
|
||||
```lang
|
||||
This is a fenced code block.
|
||||
```
|
||||
|
||||
~~~
|
||||
This is another fenced code block.
|
||||
~~~
|
||||
|
||||
**注意**:
|
||||
|
||||
* `lang`用于指定代码块的代码语言,可选;如果不指定,VNote 不会尝试高亮代码;
|
||||
* 总是在一个代码块前面添加一个空行是一个不错的实践;
|
||||
|
||||
### 图表
|
||||
VNote 支持使用以下引擎来绘制图表。您需要使用代码块,并标明特定语言,然后在代码块里面定义图表。
|
||||
|
||||
* [Flowchart.js](http://flowchart.js.org/),语言为`flow`或`flowchart`;
|
||||
* [Mermaid](https://mermaidjs.github.io/),语言为`mermaid`;
|
||||
* [WaveDrom](https://wavedrom.com/),数字时序图,语言为`wavedrom`;
|
||||
|
||||
例如,
|
||||
|
||||
```flowchart
|
||||
st=>start: Start:>http://www.google.com[blank]
|
||||
e=>end:>http://www.google.com
|
||||
op1=>operation: My Operation
|
||||
sub1=>subroutine: My Subroutine
|
||||
cond=>condition: Yes
|
||||
or No?:>http://www.google.com
|
||||
io=>inputoutput: catch something...
|
||||
|
||||
st->op1->cond
|
||||
cond(yes)->io->e
|
||||
cond(no)->sub1(right)->op1
|
||||
```
|
||||
|
||||
#### UML
|
||||
VNote 支持 [PlantUML](http://plantuml.com/) 来实现 UML 图表。您需要使用代码块,并标明语言为`puml`,然后在代码块里面定义图表。
|
||||
|
||||
```puml
|
||||
@startuml
|
||||
Bob -> Alice : hello
|
||||
@enduml
|
||||
```
|
||||
|
||||
#### Graphviz
|
||||
VNote支持 [Graphviz](http://www.graphviz.org/) 来绘制图表。您需要使用代码块,并标明语言为`dot`,然后在代码块里面定义图表。
|
||||
|
||||
### 数学公式
|
||||
VNote 通过 [MathJax](https://www.mathjax.org/) 来支持数学公式。默认的**公式块**的分隔符是`$$...$$`,**行内公式**的分隔符是`$...$`。
|
||||
|
||||
* 行内公式不能跨多行;
|
||||
* 形如`3$abc$`/`$abc$4`/`$ abc$`和`$abc $`的不会被解析为公式;
|
||||
* 使用`\`转义`$`;
|
||||
* 开始的`$$`之前以及结束的`$$`之后都只允许出现空格字符;
|
||||
* 在公式块中,使用`\\`来换行;
|
||||
|
||||
VNote也可以使用标明语言`mathjax`的代码块来实现公式块。
|
||||
|
||||
```mathjax
|
||||
$$
|
||||
J(\theta) = \frac 1 2 \sum_{i=1}^m (h_\theta(x^{(i)})-y^{(i)})^2
|
||||
$$
|
||||
```
|
||||
|
||||
公式块支持公式序号:
|
||||
|
||||
$$vnote x markdown = awesome$$ (1.2.1)
|
||||
|
||||
### 行内代码
|
||||
```md
|
||||
Here is a `inline code`.
|
||||
```
|
||||
|
||||
如果想输入一个 `` ` ``,需要使用两个 `` ` `` 来括住它,例如 ``` `` ` `` ```。 要输入两个 `` ` ``,则需要使用三个 `` ` ``。
|
||||
|
||||
### 删除线
|
||||
```md
|
||||
Here is a ~~text~~ with strikethrough.
|
||||
```
|
||||
|
||||
### 任务列表
|
||||
```md
|
||||
* [x] this is a complete item.
|
||||
* [ ] this is an incomplete item.
|
||||
```
|
||||
|
||||
### 脚注
|
||||
```md
|
||||
This is a footnote [^1].
|
||||
|
||||
[^1]: Here is the detail of the footnote.
|
||||
```
|
||||
|
||||
### 上标和下标
|
||||
```md
|
||||
This is the 1^st^ superscript.
|
||||
|
||||
This is the H~2~O subscript.
|
||||
```
|
||||
|
||||
### 警告
|
||||
```md
|
||||
::: alert-info
|
||||
|
||||
这是一个信息文本。
|
||||
|
||||
:::
|
||||
|
||||
::: alert-danger
|
||||
|
||||
这是一个危险文本。
|
||||
|
||||
:::
|
||||
```
|
||||
|
||||
可用的一些警告形式如下:
|
||||
|
||||
```
|
||||
alert-primary
|
||||
alert-secondary
|
||||
alert-success
|
||||
alert-info
|
||||
alert-warning
|
||||
alert-danger
|
||||
alert-light
|
||||
alert-dark
|
||||
```
|
||||
|
||||
### 换行和段落
|
||||
如果需要换行,您应该在当前行末尾添加两个空格,然后换行。VNote提供快捷键`Shift+Enter`来辅助用户输入两个空格并换行。
|
||||
|
||||
如果需要一个新的段落,您应该先插入一个空行然后才输入新的段落的文本。
|
||||
|
||||
一般来说,您应该在一个块元素(例如代码块、列表和块引用)后面插入一个空行来显式结束该元素。
|
||||
|
||||
[^1]: 该指南参考了 [Mastering Markdown](https://guides.github.com/features/mastering-markdown/).
|
122
src/data/extra/docs/zh_CN/shortcuts.md
Normal file
122
src/data/extra/docs/zh_CN/shortcuts.md
Normal file
@ -0,0 +1,122 @@
|
||||
# 快捷键
|
||||
1. 以下按键除特别说明外,都不区分大小写;
|
||||
2. 在 macOS 下,`Ctrl`对应于`Command`,在 Vi 模式下除外。
|
||||
|
||||
## 通用
|
||||
- `Ctrl+G E`
|
||||
是否扩展内容区。
|
||||
- `Ctrl+Alt+N`
|
||||
在当前文件夹下新建笔记。
|
||||
- `Ctrl+F`
|
||||
页内查找和替换。
|
||||
- `Ctrl+Alt+F`
|
||||
高级查找。
|
||||
- `Ctrl+J`/`Ctrl+K`
|
||||
VNote 的很多部件均支持`Ctrl+J`和`Ctrl+K`导航。
|
||||
- `Ctrl+Left Mouse`
|
||||
任意滚动。
|
||||
- `Ctrl+Shift+T`
|
||||
恢复上一个关闭的文件。
|
||||
- `Ctrl+Alt+L`
|
||||
打开灵犀页。
|
||||
- `Ctrl+Alt+I`
|
||||
打开快速访问。
|
||||
- `Ctrl+G 1`
|
||||
跳转到导航停靠窗口。
|
||||
- `Ctrl+G 2`
|
||||
跳转到大纲停靠窗口。
|
||||
- `Ctrl+G X`
|
||||
关闭当前标签页。
|
||||
- `Ctrl+G D`
|
||||
定位到当前笔记所在文件夹。
|
||||
- `Ctrl+G O`
|
||||
打开大纲弹出窗口。
|
||||
|
||||
## 文本编辑器
|
||||
- `Ctrl+S`
|
||||
保存当前更改。
|
||||
- `Ctrl+Wheel`
|
||||
鼠标滚轮实现放大/缩小页面。
|
||||
- `Ctrl+J/K`
|
||||
向下/向上滚动页面,不会改变光标。
|
||||
- `Ctrl+N/P`
|
||||
激活自动补全。
|
||||
- `Ctrl+N/P`
|
||||
浏览补全列表并插入当前补全。
|
||||
- `Ctrl+E`
|
||||
取消补全。
|
||||
- `Enter`
|
||||
插入补全。
|
||||
- `Ctrl+[` or `Escape`
|
||||
结束补全。
|
||||
|
||||
### 文本编辑
|
||||
- `Shift+Left`, `Shift+Right`, `Shift+Up`, `Shift+Down`
|
||||
扩展选定左右一个字符,或上下一行。
|
||||
- `Ctrl+Shift+Left`, `Ctrl+Shift+Right`
|
||||
扩展选定到单词开始或结尾。
|
||||
- `Ctrl+Shift+Up`, `Ctrl+Sfhit+Down`
|
||||
扩展选定到段尾或段首。
|
||||
- `Shift+Home`, `Shift+End`
|
||||
扩展选定到行首和行尾。
|
||||
- `Ctrl+Shift+Home`, `Ctrl+Shift+End`
|
||||
扩展选定到笔记开始或结尾处。
|
||||
|
||||
## Markdown 编辑器
|
||||
### 阅读模式
|
||||
- `H`/`J`/`K`/`L`
|
||||
导航,对应于左/下/上/右方向键。
|
||||
- `Ctrl+U`
|
||||
向上滚动半屏。
|
||||
- `Ctrl+D`
|
||||
向下滚动半屏。
|
||||
- `gg`/`G`
|
||||
跳转到笔记的开始或结尾。(区分大小写)。
|
||||
- `Ctrl + +/-`
|
||||
放大/缩小页面。
|
||||
- `Ctrl+Wheel`
|
||||
鼠标滚轮实现放大/缩小页面。
|
||||
- `Ctrl+0`
|
||||
恢复页面大小为100%。
|
||||
- 标题跳转
|
||||
- `<N>[[`:跳转到上`N`个标题;
|
||||
- `<N>]]`: 跳转到下`N`个标题;
|
||||
- `<N>[]`:跳转到上`N`个同层级的标题;
|
||||
- `<N>][`:跳转到下`N`个同层级的标题;
|
||||
- `<N>[{`:跳转到上`N`个高一层级的标题;
|
||||
- `<N>]}`:跳转到下`N`个高一层级的标题;
|
||||
|
||||
### 编辑模式
|
||||
和文本编辑器共享一样的快捷键。
|
||||
|
||||
- `Ctrl+T`
|
||||
编辑当前笔记或者保存更改并退出编辑模式。
|
||||
- `Ctrl+G Q`
|
||||
放弃当前更改并退出编辑模式。
|
||||
|
||||
#### 文本编辑
|
||||
- `Ctrl+B`
|
||||
插入粗体;再次按`Ctrl+B`退出。如果已经选择文本,则将当前选择文本加粗。
|
||||
- `Ctrl+I`
|
||||
插入斜体;再次按`Ctrl+I`退出。如果已经选择文本,则将当前选择文本改为斜体。
|
||||
- `Ctrl+;`
|
||||
插入行内代码;再次按`Ctrl+;`退出。如果已经选择文本,则将当前选择文本改为行内代码。
|
||||
- `Ctrl+'`
|
||||
插入代码块;再次按`Ctrl+'`退出。如果已经选择文本,则将当前选择文本嵌入到代码块中。
|
||||
- `Ctrl+,`
|
||||
插入公式;再次按`Ctrl+,`退出。如果已经选择文本,则将当前选择文本改为公式。
|
||||
- `Ctrl+.`
|
||||
插入公式块;再次按`Ctrl+.`退出。如果已经选择文本,则将当前选择文本改为公式块。
|
||||
- `Ctrl+/`
|
||||
插入表格。
|
||||
- `Ctrl+<Num>`
|
||||
插入级别为`<Num>`的标题。`<Num>`应该是1到6的一个数字。如果已经选择文本,则将当前选择文本改为标题。
|
||||
- `Ctrl+7`
|
||||
删除当前行或所选择文本的标题标记。
|
||||
- `Tab`/`Shift+Tab`
|
||||
增加或减小缩进。如果已经选择文本,则对所有选择的行进行缩进操作。
|
||||
- `Shift+Enter`
|
||||
插入两个空格然后换行,在 Markdown 中类似于软换行的概念。
|
||||
|
||||
## 展览模式
|
||||
`Ctrl+G W` 会使 VNote 进入**展览模式** 。该模式中,VNote会在一些主要部件中显示最多两个字母,按下这些字母可以跳转到对应的部件。
|
@ -9,6 +9,10 @@
|
||||
<file>docs/en/about_vnotex.txt</file>
|
||||
<file>docs/en/shortcuts.md</file>
|
||||
<file>docs/en/markdown_guide.md</file>
|
||||
<file>docs/zh_CN/get_started.txt</file>
|
||||
<file>docs/zh_CN/about_vnotex.txt</file>
|
||||
<file>docs/zh_CN/shortcuts.md</file>
|
||||
<file>docs/zh_CN/markdown_guide.md</file>
|
||||
<file>web/markdownviewertemplate.html</file>
|
||||
<file>web/css/globalstyles.css</file>
|
||||
<file>web/css/markdownit.css</file>
|
||||
|
@ -34,6 +34,7 @@ class CrossCopy {
|
||||
this.adapter.setCrossCopyTargets(targets);
|
||||
}
|
||||
|
||||
// ATTENTION: please add one entry in MarkdownViewerAdapter's getCrossCopyTargetDisplayName() for translations.
|
||||
addTarget(p_name, p_callback) {
|
||||
this.targets[p_name] = p_callback;
|
||||
}
|
||||
|
34
src/main.cpp
34
src/main.cpp
@ -86,9 +86,9 @@ int main(int argc, char *argv[])
|
||||
app.setApplicationVersion(ConfigMgr::getInst().getConfig().getVersion());
|
||||
} catch (Exception &e) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Critical,
|
||||
QApplication::tr("%1 failed to start.").arg(ConfigMgr::c_appName),
|
||||
QApplication::tr("Failed to initialize configuration manager. "
|
||||
"Please check if all the files are intact or reinstall the application."),
|
||||
MainWindow::tr("%1 failed to start.").arg(ConfigMgr::c_appName),
|
||||
MainWindow::tr("Failed to initialize configuration manager. "
|
||||
"Please check if all the files are intact or reinstall the application."),
|
||||
e.what());
|
||||
return -1;
|
||||
}
|
||||
@ -110,6 +110,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// TODO: parse command line options.
|
||||
|
||||
// Should set the correct locale before VNoteX::getInst().
|
||||
loadTranslators(app);
|
||||
|
||||
if (app.styleSheet().isEmpty()) {
|
||||
auto style = VNoteX::getInst().getThemeMgr().fetchQtStyleSheet();
|
||||
if (!style.isEmpty()) {
|
||||
@ -117,8 +120,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
loadTranslators(app);
|
||||
|
||||
MainWindow window;
|
||||
|
||||
window.show();
|
||||
@ -150,15 +151,16 @@ void loadTranslators(QApplication &p_app)
|
||||
QLocale locale;
|
||||
qInfo() << "locale:" << locale.name();
|
||||
|
||||
const QString resourceTranslationFolder(QStringLiteral(":/translations"));
|
||||
const QString resourceTranslationFolder(QStringLiteral(":/vnotex/data/core/translations"));
|
||||
const QString envTranslationFolder(QStringLiteral("translations"));
|
||||
|
||||
// Load missing translation for Qt (QTextEdit/QPlainTextEdit/QTextBrowser).
|
||||
QScopedPointer<QTranslator> widgetsTranslator(new QTranslator(&p_app));
|
||||
if (widgetsTranslator->load(locale, "widgets", "_", resourceTranslationFolder)) {
|
||||
p_app.installTranslator(widgetsTranslator.take());
|
||||
// For QTextEdit/QTextBrowser and other basic widgets.
|
||||
QScopedPointer<QTranslator> qtbaseTranslator(new QTranslator(&p_app));
|
||||
if (qtbaseTranslator->load(locale, "qtbase", "_", resourceTranslationFolder)) {
|
||||
p_app.installTranslator(qtbaseTranslator.take());
|
||||
}
|
||||
|
||||
// qt_zh_CN.ts does not cover the real QDialogButtonBox which uses QPlatformTheme.
|
||||
QScopedPointer<QTranslator> dialogButtonBoxTranslator(new QTranslator(&p_app));
|
||||
if (dialogButtonBoxTranslator->load(locale, "qdialogbuttonbox", "_", resourceTranslationFolder)) {
|
||||
p_app.installTranslator(dialogButtonBoxTranslator.take());
|
||||
@ -180,6 +182,18 @@ void loadTranslators(QApplication &p_app)
|
||||
if (qtEnvTranslator->load(locale, "qt", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(qtEnvTranslator.take());
|
||||
}
|
||||
|
||||
// Load translation for vnote from resource.
|
||||
QScopedPointer<QTranslator> vnoteTranslator(new QTranslator(&p_app));
|
||||
if (vnoteTranslator->load(locale, "vnote", "_", resourceTranslationFolder)) {
|
||||
p_app.installTranslator(vnoteTranslator.take());
|
||||
}
|
||||
|
||||
// Load translation for vtextedit from resource.
|
||||
QScopedPointer<QTranslator> vtexteditTranslator(new QTranslator(&p_app));
|
||||
if (vtexteditTranslator->load(locale, "vtextedit", "_", resourceTranslationFolder)) {
|
||||
p_app.installTranslator(vtexteditTranslator.take());
|
||||
}
|
||||
}
|
||||
|
||||
void initWebEngineSettings()
|
||||
|
@ -24,6 +24,8 @@ win32:CONFIG(release, debug|release) {
|
||||
RC_ICONS = data/core/icons/vnote.ico
|
||||
ICON = data/core/icons/vnote.icns
|
||||
|
||||
TRANSLATIONS += data/core/translations/vnote_zh_CN.ts
|
||||
|
||||
SOURCES += \
|
||||
main.cpp
|
||||
|
||||
@ -31,8 +33,6 @@ INCLUDEPATH *= $$PWD
|
||||
|
||||
LIBS_FOLDER = $$PWD/../libs
|
||||
|
||||
include($$LIBS_FOLDER/vtitlebar/vtitlebar_export.pri)
|
||||
|
||||
include($$LIBS_FOLDER/vtextedit/src/editor/editor_export.pri)
|
||||
|
||||
include($$LIBS_FOLDER/vtextedit/src/libs/syntax-highlighting/syntax-highlighting_export.pri)
|
||||
|
@ -19,10 +19,6 @@
|
||||
#define __has_cpp_attribute(x) 0 // Compatibility with non-supporting compilers.
|
||||
#endif
|
||||
|
||||
#if !defined(V_TR)
|
||||
#define V_TR(ctx, src) QCoreApplication::translate((ctx), (src))
|
||||
#endif
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace vnotex
|
||||
|
@ -35,7 +35,7 @@ bool AttachmentDragDropAreaIndicator::handleDropEvent(QDropEvent *p_event)
|
||||
auto files = buffer->addAttachment(QString(), p_files);
|
||||
if (!files.isEmpty()) {
|
||||
VNoteX::getInst().showStatusMessageShort(
|
||||
m_viewWindow->tr("Attached %n file(s)", "", files.size()));
|
||||
ViewWindow::tr("Attached %n file(s)", "", files.size()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
#define TR(x) QCoreApplication::translate("ImportFolderUtils", (x))
|
||||
|
||||
void ImportFolderUtils::importFolderContents(Notebook *p_notebook,
|
||||
Node *p_node,
|
||||
const QStringList &p_suffixes,
|
||||
@ -27,7 +25,7 @@ void ImportFolderUtils::importFolderContents(Notebook *p_notebook,
|
||||
try {
|
||||
node = p_notebook->addAsNode(p_node, Node::Type::Folder, child.fileName(), NodeParameters());
|
||||
} catch (Exception &p_e) {
|
||||
Utils::appendMsg(p_errMsg, TR("Failed to add folder (%1) as node (%2).").arg(child.fileName(), p_e.what()));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("Failed to add folder (%1) as node (%2).").arg(child.fileName(), p_e.what()));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -37,7 +35,7 @@ void ImportFolderUtils::importFolderContents(Notebook *p_notebook,
|
||||
try {
|
||||
p_notebook->addAsNode(p_node, Node::Type::File, child.fileName(), NodeParameters());
|
||||
} catch (Exception &p_e) {
|
||||
Utils::appendMsg(p_errMsg, TR("Failed to add file (%1) as node (%2).").arg(child.filePath(), p_e.what()));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("Failed to add file (%1) as node (%2).").arg(child.filePath(), p_e.what()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,12 +56,12 @@ void ImportFolderUtils::importFolderContentsByLegacyConfig(Notebook *p_notebook,
|
||||
// Folders.
|
||||
LegacyNotebookUtils::forEachFolder(config, [&rootDir, p_notebook, p_node, &p_errMsg](const QString &name) {
|
||||
if (!rootDir.exists(name)) {
|
||||
Utils::appendMsg(p_errMsg, TR("Folder (%1) does not exist.").arg(name));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("Folder (%1) does not exist.").arg(name));
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_notebook->isBuiltInFolder(p_node, name)) {
|
||||
Utils::appendMsg(p_errMsg, TR("Folder (%1) conflicts with built-in folder.").arg(name));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("Folder (%1) conflicts with built-in folder.").arg(name));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +71,7 @@ void ImportFolderUtils::importFolderContentsByLegacyConfig(Notebook *p_notebook,
|
||||
paras.m_createdTimeUtc = LegacyNotebookUtils::getCreatedTimeUtcOfFolder(rootDir.filePath(name));
|
||||
node = p_notebook->addAsNode(p_node, Node::Type::Folder, name, paras);
|
||||
} catch (Exception &p_e) {
|
||||
Utils::appendMsg(p_errMsg, TR("Failed to add folder (%1) as node (%2).").arg(name, p_e.what()));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("Failed to add folder (%1) as node (%2).").arg(name, p_e.what()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,12 +81,12 @@ void ImportFolderUtils::importFolderContentsByLegacyConfig(Notebook *p_notebook,
|
||||
// Files.
|
||||
LegacyNotebookUtils::forEachFile(config, [&rootDir, p_notebook, p_node, &p_errMsg](const LegacyNotebookUtils::FileInfo &info) {
|
||||
if (!rootDir.exists(info.m_name)) {
|
||||
Utils::appendMsg(p_errMsg, TR("File (%1) does not exist.").arg(info.m_name));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("File (%1) does not exist.").arg(info.m_name));
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_notebook->isBuiltInFile(p_node, info.m_name)) {
|
||||
Utils::appendMsg(p_errMsg, TR("File (%1) conflicts with built-in file.").arg(info.m_name));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("File (%1) conflicts with built-in file.").arg(info.m_name));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -101,7 +99,7 @@ void ImportFolderUtils::importFolderContentsByLegacyConfig(Notebook *p_notebook,
|
||||
paras.m_tags = info.m_tags;
|
||||
node = p_notebook->addAsNode(p_node, Node::Type::File, info.m_name, paras);
|
||||
} catch (Exception &p_e) {
|
||||
Utils::appendMsg(p_errMsg, TR("Failed to add file (%1) as node (%2).").arg(info.m_name, p_e.what()));
|
||||
Utils::appendMsg(p_errMsg, ImportFolderUtilsTranslate::tr("Failed to add file (%1) as node (%2).").arg(info.m_name, p_e.what()));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef IMPORTFOLDERUTILS_H
|
||||
#define IMPORTFOLDERUTILS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
namespace vnotex
|
||||
@ -8,6 +10,12 @@ namespace vnotex
|
||||
class Notebook;
|
||||
class Node;
|
||||
|
||||
// A dummy class used to do translations.
|
||||
class ImportFolderUtilsTranslate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
};
|
||||
|
||||
class ImportFolderUtils
|
||||
{
|
||||
public:
|
||||
|
@ -124,7 +124,7 @@ bool ImportNotebookDialog::createNotebookToImport(QString &p_msg)
|
||||
rootFolderPath,
|
||||
backend);
|
||||
} catch (Exception &p_e) {
|
||||
Utils::appendMsg(p_msg, tr("Fail to create notebook from root folder (%1) (%2).").arg(rootFolderPath, p_e.what()));
|
||||
Utils::appendMsg(p_msg, tr("Failed to create notebook from root folder (%1) (%2).").arg(rootFolderPath, p_e.what()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ bool ImportNotebookDialog::createNotebookToImport(QString &p_msg)
|
||||
bool ImportNotebookDialog::importNotebook()
|
||||
{
|
||||
if (!m_notebookToImport) {
|
||||
QString msg = tr("Fail to import notebook.");
|
||||
QString msg = tr("Failed to import notebook.");
|
||||
qCritical() << msg;
|
||||
setInformationText(msg, ScrollDialog::InformationLevel::Error);
|
||||
return false;
|
||||
@ -145,7 +145,7 @@ bool ImportNotebookDialog::importNotebook()
|
||||
auto ¬ebookMgr = VNoteX::getInst().getNotebookMgr();
|
||||
notebookMgr.importNotebook(m_notebookToImport);
|
||||
} catch (Exception &p_e) {
|
||||
QString msg = tr("Fail to import notebook (%1).").arg(p_e.what());
|
||||
QString msg = tr("Failed to import notebook (%1).").arg(p_e.what());
|
||||
qCritical() << msg;
|
||||
setInformationText(msg, ScrollDialog::InformationLevel::Error);
|
||||
return false;
|
||||
|
@ -232,7 +232,7 @@ void ManageNotebooksDialog::closeNotebook(const Notebook *p_notebook)
|
||||
VNoteX::getInst().getNotebookMgr().closeNotebook(p_notebook->getId());
|
||||
} catch (Exception &p_e) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Warning,
|
||||
tr("Fail to close notebook (%1)").arg(p_e.what()),
|
||||
tr("Failed to close notebook (%1)").arg(p_e.what()),
|
||||
this);
|
||||
loadNotebooks(nullptr);
|
||||
return;
|
||||
@ -258,7 +258,7 @@ void ManageNotebooksDialog::removeNotebook(const Notebook *p_notebook)
|
||||
VNoteX::getInst().getNotebookMgr().removeNotebook(p_notebook->getId());
|
||||
} catch (Exception &p_e) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Warning,
|
||||
tr("Fail to delete notebook (%1)").arg(p_e.what()),
|
||||
tr("Failed to delete notebook (%1)").arg(p_e.what()),
|
||||
this);
|
||||
loadNotebooks(nullptr);
|
||||
return;
|
||||
|
@ -83,9 +83,9 @@ bool NewFolderDialog::newFolder()
|
||||
try {
|
||||
m_newNode = notebook->newNode(parentNode, Node::Type::Folder, m_infoWidget->getName());
|
||||
} catch (Exception &p_e) {
|
||||
QString msg = tr("Fail to create folder under %1 in %2 (%3).").arg(parentNode->getName(),
|
||||
notebook->getName(),
|
||||
p_e.what());
|
||||
QString msg = tr("Failed to create folder under (%1) in (%2) (%3).").arg(parentNode->getName(),
|
||||
notebook->getName(),
|
||||
p_e.what());
|
||||
qCritical() << msg;
|
||||
setInformationText(msg, ScrollDialog::InformationLevel::Error);
|
||||
return false;
|
||||
|
@ -136,7 +136,7 @@ bool NewNotebookDialog::newNotebook()
|
||||
try {
|
||||
notebookMgr.newNotebook(paras);
|
||||
} catch (Exception &p_e) {
|
||||
QString msg = tr("Fail to create notebook in %1 (%2).")
|
||||
QString msg = tr("Failed to create notebook in (%1) (%2).")
|
||||
.arg(m_infoWidget->getRootFolderPath(), p_e.what());
|
||||
qCritical() << msg;
|
||||
setInformationText(msg, ScrollDialog::InformationLevel::Error);
|
||||
|
@ -87,9 +87,9 @@ bool NewNoteDialog::newNote()
|
||||
try {
|
||||
m_newNode = notebook->newNode(parentNode, Node::Type::File, m_infoWidget->getName());
|
||||
} catch (Exception &p_e) {
|
||||
QString msg = tr("Fail to create note under %1 in %2 (%3).").arg(parentNode->getName(),
|
||||
notebook->getName(),
|
||||
p_e.what());
|
||||
QString msg = tr("Failed to create note under (%1) in (%2) (%3).").arg(parentNode->getName(),
|
||||
notebook->getName(),
|
||||
p_e.what());
|
||||
qCritical() << msg;
|
||||
setInformationText(msg, ScrollDialog::InformationLevel::Error);
|
||||
return false;
|
||||
|
@ -98,7 +98,7 @@ QLayout *NotebookInfoWidget::setupNotebookRootFolderPath(QWidget *p_parent)
|
||||
{
|
||||
m_rootFolderPathLineEdit = WidgetsFactory::createLineEdit(p_parent);
|
||||
m_rootFolderPathLineEdit->setPlaceholderText(tr("Path of notebook root folder"));
|
||||
auto whatsThis = tr("<b>Notebook Root Folder</b> is the folder containing all data of one notebook in VNoteX.");
|
||||
auto whatsThis = tr("<b>Notebook Root Folder</b> is the folder containing all data of one notebook in %1.").arg(ConfigMgr::c_appName);
|
||||
m_rootFolderPathLineEdit->setWhatsThis(whatsThis);
|
||||
connect(m_rootFolderPathLineEdit, &QLineEdit::textChanged,
|
||||
this, [this]() {
|
||||
@ -295,7 +295,7 @@ void NotebookInfoWidget::setStateAccordingToMode()
|
||||
break;
|
||||
|
||||
case CreateFromLegacy:
|
||||
// Support bundled notebook only.
|
||||
// Support bundle notebook only.
|
||||
m_typeComboBox->setEnabled(false);
|
||||
break;
|
||||
|
||||
|
@ -61,7 +61,7 @@ void GeneralPage::setupUI()
|
||||
{
|
||||
const QString label(tr("Minimize to system tray"));
|
||||
m_systemTrayCheckBox = WidgetsFactory::createCheckBox(label, this);
|
||||
m_systemTrayCheckBox->setToolTip(tr("Minimize to system tray when closing"));
|
||||
m_systemTrayCheckBox->setToolTip(tr("Minimize to system tray when closed"));
|
||||
mainLayout->addRow(m_systemTrayCheckBox);
|
||||
addSearchItem(label, m_systemTrayCheckBox->toolTip(), m_systemTrayCheckBox);
|
||||
connect(m_systemTrayCheckBox, &QCheckBox::stateChanged,
|
||||
|
@ -608,7 +608,7 @@ bool MarkdownEditor::processUrlFromMimeData(const QMimeData *p_source)
|
||||
linkUrl = url.toString(QUrl::EncodeSpaces);
|
||||
}
|
||||
|
||||
LinkInsertDialog linkDialog(QObject::tr("Insert Link"), linkText, linkUrl, false, this);
|
||||
LinkInsertDialog linkDialog(tr("Insert Link"), linkText, linkUrl, false, this);
|
||||
if (linkDialog.exec() == QDialog::Accepted) {
|
||||
linkText = linkDialog.getLinkText();
|
||||
linkUrl = linkDialog.getLinkUrl();
|
||||
@ -889,8 +889,8 @@ void MarkdownEditor::setupShortcuts()
|
||||
auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::Shortcut::RichPaste),
|
||||
this);
|
||||
if (shortcut) {
|
||||
QObject::connect(shortcut, &QShortcut::activated,
|
||||
this, &MarkdownEditor::richPaste);
|
||||
connect(shortcut, &QShortcut::activated,
|
||||
this, &MarkdownEditor::richPaste);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,21 +297,20 @@ void MarkdownViewer::hideUnusedActions(QMenu *p_menu)
|
||||
}
|
||||
}
|
||||
|
||||
// SavePage.
|
||||
QAction *act = pageAction(QWebEnginePage::SavePage);
|
||||
unusedActions.append(act);
|
||||
QVector<QWebEnginePage::WebAction> pageActions = { QWebEnginePage::SavePage,
|
||||
QWebEnginePage::ViewSource,
|
||||
QWebEnginePage::DownloadImageToDisk,
|
||||
QWebEnginePage::DownloadLinkToDisk,
|
||||
QWebEnginePage::OpenLinkInThisWindow,
|
||||
QWebEnginePage::OpenLinkInNewBackgroundTab,
|
||||
QWebEnginePage::OpenLinkInNewTab,
|
||||
QWebEnginePage::OpenLinkInNewWindow
|
||||
};
|
||||
|
||||
// ViewSource.
|
||||
act = pageAction(QWebEnginePage::ViewSource);
|
||||
unusedActions.append(act);
|
||||
|
||||
// DownloadImageToDisk.
|
||||
act = pageAction(QWebEnginePage::DownloadImageToDisk);
|
||||
unusedActions.append(act);
|
||||
|
||||
// DownloadLinkToDisk.
|
||||
act = pageAction(QWebEnginePage::DownloadLinkToDisk);
|
||||
unusedActions.append(act);
|
||||
for (auto pageAct : pageActions) {
|
||||
auto act = pageAction(pageAct);
|
||||
unusedActions.append(act);
|
||||
}
|
||||
|
||||
for (auto it : unusedActions) {
|
||||
if (it) {
|
||||
@ -392,7 +391,7 @@ void MarkdownViewer::setupCrossCopyMenu(QMenu *p_menu, QAction *p_copyAct)
|
||||
auto subMenu = WidgetsFactory::createMenu(tr("Cross Copy"), p_menu);
|
||||
|
||||
for (const auto &target : targets) {
|
||||
auto act = subMenu->addAction(target);
|
||||
auto act = subMenu->addAction(m_adapter->getCrossCopyTargetDisplayName(target));
|
||||
act->setData(target);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "markdownvieweradapter.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMap>
|
||||
|
||||
#include "../outlineprovider.h"
|
||||
|
||||
@ -274,6 +275,26 @@ const QStringList &MarkdownViewerAdapter::getCrossCopyTargets() const
|
||||
return m_crossCopyTargets;
|
||||
}
|
||||
|
||||
QString MarkdownViewerAdapter::getCrossCopyTargetDisplayName(const QString &p_target) const
|
||||
{
|
||||
static QMap<QString, QString> maps;
|
||||
if (maps.isEmpty()) {
|
||||
maps.insert("No Background", tr("No Background"));
|
||||
maps.insert("Evernote", tr("Evernote"));
|
||||
maps.insert("OneNote", tr("OneNote"));
|
||||
maps.insert("Microsoft Word", tr("Microsoft Word"));
|
||||
maps.insert("WeChat Public Account Editor", tr("WeChat Public Account Editor"));
|
||||
maps.insert("Raw HTML", tr("Raw HTML"));
|
||||
}
|
||||
|
||||
auto it = maps.find(p_target);
|
||||
if (it != maps.end()) {
|
||||
return *it;
|
||||
}
|
||||
qWarning() << "missing cross copy target" << p_target;
|
||||
return p_target;
|
||||
}
|
||||
|
||||
void MarkdownViewerAdapter::setCrossCopyResult(quint64 p_id, quint64 p_timeStamp, const QString &p_html)
|
||||
{
|
||||
emit crossCopyReady(p_id, p_timeStamp, p_html);
|
||||
|
@ -115,6 +115,8 @@ namespace vnotex
|
||||
|
||||
const QStringList &getCrossCopyTargets() const;
|
||||
|
||||
QString getCrossCopyTargetDisplayName(const QString &p_target) const;
|
||||
|
||||
void findText(const QString &p_text, FindOptions p_options);
|
||||
|
||||
// Functions to be called from web side.
|
||||
|
@ -36,8 +36,7 @@
|
||||
#include "navigationmodemgr.h"
|
||||
#include "messageboxhelper.h"
|
||||
#include "systemtrayhelper.h"
|
||||
|
||||
#include <vtoolbar.h>
|
||||
#include "titletoolbar.h"
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
@ -447,7 +446,7 @@ void MainWindow::setupToolBar()
|
||||
winFlags &= ~framelessFlags;
|
||||
setWindowFlags(winFlags);
|
||||
|
||||
auto toolBar = new VToolBar(tr("Global"), this);
|
||||
auto toolBar = new TitleToolBar(tr("Global"), this);
|
||||
toolBar->setIconSize(iconSize);
|
||||
m_toolBarHelper.setupToolBars(this, toolBar);
|
||||
toolBar->addTitleBarIcons(ToolBarHelper::generateIcon(QStringLiteral("minimize.svg")),
|
||||
|
@ -225,7 +225,7 @@ void NotebookExplorer::importFile()
|
||||
node = m_currentNotebook->getRootNode().data();
|
||||
} else if (m_currentNotebook->isNodeInRecycleBin(node)) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Information,
|
||||
tr("Could not create file within Recycle Bin."),
|
||||
tr("Could not create note within Recycle Bin."),
|
||||
VNoteX::getInst().getMainWindow());
|
||||
return;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ void NotebookNodeExplorer::generateNodeTree()
|
||||
|
||||
loadRootNode(rootNode.data());
|
||||
} catch (Exception &p_e) {
|
||||
QString msg = tr("Fail to load nodes of notebook (%1) (%2).")
|
||||
QString msg = tr("Failed to load nodes of notebook (%1) (%2).")
|
||||
.arg(m_notebook->getName(), p_e.what());
|
||||
qCritical() << msg;
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Critical, msg, VNoteX::getInst().getMainWindow());
|
||||
@ -890,7 +890,7 @@ QAction *NotebookNodeExplorer::createAction(Action p_act, QObject *p_parent)
|
||||
m_notebook->emptyNode(rbNode, true);
|
||||
} catch (Exception &p_e) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Critical,
|
||||
tr("Fail to empty recycle bin (%1) (%2).")
|
||||
tr("Failed to empty recycle bin (%1) (%2).")
|
||||
.arg(rbNodePath, p_e.what()),
|
||||
VNoteX::getInst().getMainWindow());
|
||||
}
|
||||
@ -1007,7 +1007,7 @@ static QSharedPointer<Node> getNodeFromClipboardDataItem(const NodeClipboardData
|
||||
auto notebook = VNoteX::getInst().getNotebookMgr().findNotebookById(p_item->m_notebookId);
|
||||
if (!notebook) {
|
||||
Exception::throwOne(Exception::Type::InvalidArgument,
|
||||
QString("fail to find notebook by ID (%1)").arg(p_item->m_notebookId));
|
||||
QString("failed to find notebook by ID (%1)").arg(p_item->m_notebookId));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1081,7 +1081,7 @@ void NotebookNodeExplorer::pasteNodesFromClipboard()
|
||||
pastedNodes.push_back(pastedNode.data());
|
||||
} catch (Exception &p_e) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Critical,
|
||||
tr("Fail to copy source (%1) to destination (%2) (%3).")
|
||||
tr("Failed to copy source (%1) to destination (%2) (%3).")
|
||||
.arg(srcPath, destNode->fetchAbsolutePath(), p_e.what()),
|
||||
VNoteX::getInst().getMainWindow());
|
||||
}
|
||||
@ -1216,7 +1216,7 @@ void NotebookNodeExplorer::removeNodes(QVector<Node *> p_nodes,
|
||||
++nrDeleted;
|
||||
} catch (Exception &p_e) {
|
||||
MessageBoxHelper::notify(MessageBoxHelper::Critical,
|
||||
tr("Fail to delete/remove item %1 (%2) (%3).")
|
||||
tr("Failed to delete/remove item (%1) (%2) (%3).")
|
||||
.arg(srcName, srcPath, p_e.what()),
|
||||
VNoteX::getInst().getMainWindow());
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "vtoolbar.h"
|
||||
#include "titletoolbar.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
VToolBar::VToolBar(QWidget *p_parent)
|
||||
TitleToolBar::TitleToolBar(QWidget *p_parent)
|
||||
: QToolBar(p_parent),
|
||||
m_window(p_parent)
|
||||
{
|
||||
@ -15,7 +15,7 @@ VToolBar::VToolBar(QWidget *p_parent)
|
||||
m_window->installEventFilter(this);
|
||||
}
|
||||
|
||||
VToolBar::VToolBar(const QString &p_title, QWidget *p_parent)
|
||||
TitleToolBar::TitleToolBar(const QString &p_title, QWidget *p_parent)
|
||||
: QToolBar(p_title, p_parent),
|
||||
m_window(p_parent)
|
||||
{
|
||||
@ -23,29 +23,29 @@ VToolBar::VToolBar(const QString &p_title, QWidget *p_parent)
|
||||
m_window->installEventFilter(this);
|
||||
}
|
||||
|
||||
void VToolBar::setupUI()
|
||||
void TitleToolBar::setupUI()
|
||||
{
|
||||
}
|
||||
|
||||
void VToolBar::mousePressEvent(QMouseEvent *p_event)
|
||||
void TitleToolBar::mousePressEvent(QMouseEvent *p_event)
|
||||
{
|
||||
QToolBar::mousePressEvent(p_event);
|
||||
m_lastPos = p_event->pos();
|
||||
}
|
||||
|
||||
void VToolBar::mouseDoubleClickEvent(QMouseEvent *p_event)
|
||||
void TitleToolBar::mouseDoubleClickEvent(QMouseEvent *p_event)
|
||||
{
|
||||
QToolBar::mouseDoubleClickEvent(p_event);
|
||||
m_ignoreNextMove = true;
|
||||
maximizeRestoreWindow();
|
||||
}
|
||||
|
||||
void VToolBar::maximizeRestoreWindow()
|
||||
void TitleToolBar::maximizeRestoreWindow()
|
||||
{
|
||||
m_window->isMaximized() ? m_window->showNormal() : m_window->showMaximized();
|
||||
}
|
||||
|
||||
void VToolBar::mouseMoveEvent(QMouseEvent *p_event)
|
||||
void TitleToolBar::mouseMoveEvent(QMouseEvent *p_event)
|
||||
{
|
||||
auto delta = p_event->pos() - m_lastPos;
|
||||
if (!m_ignoreNextMove && !m_lastPos.isNull() && (qAbs(delta.x()) > 10 || qAbs(delta.y()) > 10)) {
|
||||
@ -58,17 +58,17 @@ void VToolBar::mouseMoveEvent(QMouseEvent *p_event)
|
||||
QToolBar::mouseMoveEvent(p_event);
|
||||
}
|
||||
|
||||
void VToolBar::mouseReleaseEvent(QMouseEvent *p_event)
|
||||
void TitleToolBar::mouseReleaseEvent(QMouseEvent *p_event)
|
||||
{
|
||||
QToolBar::mouseReleaseEvent(p_event);
|
||||
m_ignoreNextMove = false;
|
||||
m_lastPos = QPoint();
|
||||
}
|
||||
|
||||
void VToolBar::addTitleBarIcons(const QIcon &p_minimizeIcon,
|
||||
const QIcon &p_maximizeIcon,
|
||||
const QIcon &p_restoreIcon,
|
||||
const QIcon &p_closeIcon)
|
||||
void TitleToolBar::addTitleBarIcons(const QIcon &p_minimizeIcon,
|
||||
const QIcon &p_maximizeIcon,
|
||||
const QIcon &p_restoreIcon,
|
||||
const QIcon &p_closeIcon)
|
||||
{
|
||||
addSeparator();
|
||||
|
||||
@ -96,7 +96,7 @@ void VToolBar::addTitleBarIcons(const QIcon &p_minimizeIcon,
|
||||
updateMaximizeAct();
|
||||
}
|
||||
|
||||
bool VToolBar::eventFilter(QObject *p_obj, QEvent *p_event)
|
||||
bool TitleToolBar::eventFilter(QObject *p_obj, QEvent *p_event)
|
||||
{
|
||||
if (p_obj == m_window) {
|
||||
if (p_event->type() == QEvent::WindowStateChange) {
|
||||
@ -106,7 +106,7 @@ bool VToolBar::eventFilter(QObject *p_obj, QEvent *p_event)
|
||||
return QToolBar::eventFilter(p_obj, p_event);
|
||||
}
|
||||
|
||||
void VToolBar::updateMaximizeAct()
|
||||
void TitleToolBar::updateMaximizeAct()
|
||||
{
|
||||
if (m_window->isMaximized()) {
|
||||
m_maximizeAct->setIcon(m_restoreIcon);
|
@ -1,18 +1,18 @@
|
||||
#ifndef VTOOLBAR_H
|
||||
#define VTOOLBAR_H
|
||||
#ifndef TITLETOOLBAR_H
|
||||
#define TITLETOOLBAR_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QIcon>
|
||||
|
||||
namespace vnotex
|
||||
{
|
||||
class VToolBar : public QToolBar
|
||||
class TitleToolBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VToolBar(QWidget *p_parent = nullptr);
|
||||
explicit TitleToolBar(QWidget *p_parent = nullptr);
|
||||
|
||||
VToolBar(const QString &p_title, QWidget *p_parent = nullptr);
|
||||
TitleToolBar(const QString &p_title, QWidget *p_parent = nullptr);
|
||||
|
||||
void addTitleBarIcons(const QIcon &p_minimizeIcon,
|
||||
const QIcon &p_maximizeIcon,
|
@ -547,7 +547,7 @@ void ViewWindow::discardChangesAndRead()
|
||||
if (buffer->isModified()) {
|
||||
// Ask to save changes.
|
||||
int ret = MessageBoxHelper::questionSaveDiscardCancel(MessageBoxHelper::Question,
|
||||
tr("Discard changes to note %(1)?").arg(buffer->getName()),
|
||||
tr("Discard changes to note (%1)?").arg(buffer->getName()),
|
||||
tr("Note path (%1).").arg(buffer->getPath()),
|
||||
"",
|
||||
this);
|
||||
@ -642,7 +642,7 @@ DragDropAreaIndicator *ViewWindow::getAttachmentDragDropArea()
|
||||
if (!m_attachmentDragDropIndicator) {
|
||||
m_attachmentDragDropIndicatorInterface.reset(new AttachmentDragDropAreaIndicator(this));
|
||||
m_attachmentDragDropIndicator = new DragDropAreaIndicator(m_attachmentDragDropIndicatorInterface.data(),
|
||||
tr("Drag&Drop Files To Attach"),
|
||||
tr("Drag And Drop Files To Attach"),
|
||||
this);
|
||||
|
||||
m_attachmentDragDropIndicator->hide();
|
||||
|
@ -19,15 +19,12 @@
|
||||
#include "attachmentpopup.h"
|
||||
#include "propertydefs.h"
|
||||
#include "outlinepopup.h"
|
||||
#include "viewwindow.h"
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
typedef EditorConfig::Shortcut Shortcut;
|
||||
|
||||
static const char *s_context = "ViewWindowToolBarHelper";
|
||||
|
||||
#define TR(x) QCoreApplication::translate(s_context, (x))
|
||||
|
||||
// To get the right shortcut context, we use a separate QShrotcut for the action shortcut.
|
||||
// @p_parentAction: the parent action of @p_action which is in a menu of @p_parentAction.
|
||||
void ViewWindowToolBarHelper::addActionShortcut(QAction *p_action,
|
||||
@ -87,18 +84,18 @@ QAction *ViewWindowToolBarHelper::addAction(QToolBar *p_tb, Action p_action)
|
||||
switch (p_action) {
|
||||
case Action::Save:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("save_editor.svg"),
|
||||
TR("Save"));
|
||||
ViewWindow::tr("Save"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::Save), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::EditReadDiscard:
|
||||
{
|
||||
auto erdAct = new EditReadDiscardAction(ToolBarHelper::generateIcon("edit_editor.svg"),
|
||||
TR("Edit"),
|
||||
ViewWindow::tr("Edit"),
|
||||
ToolBarHelper::generateIcon("read_editor.svg"),
|
||||
TR("Read"),
|
||||
ViewWindow::tr("Read"),
|
||||
ToolBarHelper::generateIcon("discard_editor.svg"),
|
||||
TR("Discard"),
|
||||
ViewWindow::tr("Discard"),
|
||||
p_tb);
|
||||
act = erdAct;
|
||||
addActionShortcut(erdAct, editorConfig.getShortcut(Shortcut::EditRead), viewWindow);
|
||||
@ -117,7 +114,7 @@ QAction *ViewWindowToolBarHelper::addAction(QToolBar *p_tb, Action p_action)
|
||||
case Action::TypeHeading:
|
||||
{
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_heading_editor.svg"),
|
||||
TR("Heading"));
|
||||
ViewWindow::tr("Heading"));
|
||||
|
||||
auto toolBtn = dynamic_cast<QToolButton *>(p_tb->widgetForAction(act));
|
||||
Q_ASSERT(toolBtn);
|
||||
@ -126,49 +123,49 @@ QAction *ViewWindowToolBarHelper::addAction(QToolBar *p_tb, Action p_action)
|
||||
|
||||
auto menu = WidgetsFactory::createMenu(p_tb);
|
||||
|
||||
auto act1 = menu->addAction(TR("Heading 1"));
|
||||
auto act1 = menu->addAction(ViewWindow::tr("Heading 1"));
|
||||
addActionShortcut(act1,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeading1),
|
||||
viewWindow,
|
||||
act);
|
||||
act1->setData(1);
|
||||
|
||||
auto act2 = menu->addAction(TR("Heading 2"));
|
||||
auto act2 = menu->addAction(ViewWindow::tr("Heading 2"));
|
||||
addActionShortcut(act2,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeading2),
|
||||
viewWindow,
|
||||
act);
|
||||
act2->setData(2);
|
||||
|
||||
auto act3 = menu->addAction(TR("Heading 3"));
|
||||
auto act3 = menu->addAction(ViewWindow::tr("Heading 3"));
|
||||
addActionShortcut(act3,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeading3),
|
||||
viewWindow,
|
||||
act);
|
||||
act3->setData(3);
|
||||
|
||||
auto act4 = menu->addAction(TR("Heading 4"));
|
||||
auto act4 = menu->addAction(ViewWindow::tr("Heading 4"));
|
||||
addActionShortcut(act4,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeading4),
|
||||
viewWindow,
|
||||
act);
|
||||
act4->setData(4);
|
||||
|
||||
auto act5 = menu->addAction(TR("Heading 5"));
|
||||
auto act5 = menu->addAction(ViewWindow::tr("Heading 5"));
|
||||
addActionShortcut(act5,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeading5),
|
||||
viewWindow,
|
||||
act);
|
||||
act5->setData(5);
|
||||
|
||||
auto act6 = menu->addAction(TR("Heading 6"));
|
||||
auto act6 = menu->addAction(ViewWindow::tr("Heading 6"));
|
||||
addActionShortcut(act6,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeading6),
|
||||
viewWindow,
|
||||
act);
|
||||
act6->setData(6);
|
||||
|
||||
auto act7 = menu->addAction(TR("Clear"));
|
||||
auto act7 = menu->addAction(ViewWindow::tr("Clear"));
|
||||
addActionShortcut(act7,
|
||||
editorConfig.getShortcut(EditorConfig::Shortcut::TypeHeadingNone),
|
||||
viewWindow,
|
||||
@ -181,98 +178,98 @@ QAction *ViewWindowToolBarHelper::addAction(QToolBar *p_tb, Action p_action)
|
||||
|
||||
case Action::TypeBold:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_bold_editor.svg"),
|
||||
TR("Bold"));
|
||||
ViewWindow::tr("Bold"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeBold), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeItalic:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_italic_editor.svg"),
|
||||
TR("Italic"));
|
||||
ViewWindow::tr("Italic"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeItalic), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeStrikethrough:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_strikethrough_editor.svg"),
|
||||
TR("Strikethrough"));
|
||||
ViewWindow::tr("Strikethrough"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeStrikethrough), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeUnorderedList:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_unordered_list_editor.svg"),
|
||||
TR("Unordered List"));
|
||||
ViewWindow::tr("Unordered List"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeUnorderedList), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeOrderedList:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_ordered_list_editor.svg"),
|
||||
TR("Ordered List"));
|
||||
ViewWindow::tr("Ordered List"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeOrderedList), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeTodoList:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_todo_list_editor.svg"),
|
||||
TR("Todo List"));
|
||||
ViewWindow::tr("Todo List"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeTodoList), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeCheckedTodoList:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_checked_todo_list_editor.svg"),
|
||||
TR("Checked Todo List"));
|
||||
ViewWindow::tr("Checked Todo List"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeCheckedTodoList), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeCode:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_code_editor.svg"),
|
||||
TR("Code"));
|
||||
ViewWindow::tr("Code"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeCode), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeCodeBlock:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_code_block_editor.svg"),
|
||||
TR("Code Block"));
|
||||
ViewWindow::tr("Code Block"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeCodeBlock), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeMath:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_math_editor.svg"),
|
||||
TR("Math"));
|
||||
ViewWindow::tr("Math"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeMath), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeMathBlock:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_math_block_editor.svg"),
|
||||
TR("Math Block"));
|
||||
ViewWindow::tr("Math Block"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeMathBlock), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeQuote:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_quote_editor.svg"),
|
||||
TR("Quote"));
|
||||
ViewWindow::tr("Quote"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeQuote), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeLink:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_link_editor.svg"),
|
||||
TR("Link"));
|
||||
ViewWindow::tr("Link"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeLink), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeImage:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_image_editor.svg"),
|
||||
TR("Image"));
|
||||
ViewWindow::tr("Image"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeImage), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::TypeTable:
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("type_table_editor.svg"),
|
||||
TR("Table"));
|
||||
ViewWindow::tr("Table"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::TypeTable), viewWindow);
|
||||
break;
|
||||
|
||||
case Action::Attachment:
|
||||
{
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("attachment_editor.svg"),
|
||||
TR("Attachments"));
|
||||
ViewWindow::tr("Attachments"));
|
||||
|
||||
auto toolBtn = dynamic_cast<QToolButton *>(p_tb->widgetForAction(act));
|
||||
Q_ASSERT(toolBtn);
|
||||
@ -287,7 +284,7 @@ QAction *ViewWindowToolBarHelper::addAction(QToolBar *p_tb, Action p_action)
|
||||
case Action::Outline:
|
||||
{
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("outline_editor.svg"),
|
||||
TR("Outline"));
|
||||
ViewWindow::tr("Outline"));
|
||||
|
||||
auto toolBtn = dynamic_cast<QToolButton *>(p_tb->widgetForAction(act));
|
||||
Q_ASSERT(toolBtn);
|
||||
@ -304,7 +301,7 @@ QAction *ViewWindowToolBarHelper::addAction(QToolBar *p_tb, Action p_action)
|
||||
case Action::FindAndReplace:
|
||||
{
|
||||
act = p_tb->addAction(ToolBarHelper::generateIcon("find_replace_editor.svg"),
|
||||
TR("Find And Replace"));
|
||||
ViewWindow::tr("Find And Replace"));
|
||||
addActionShortcut(act, editorConfig.getShortcut(Shortcut::FindAndReplace), viewWindow);
|
||||
break;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ SOURCES += \
|
||||
$$PWD/statusbarhelper.cpp \
|
||||
$$PWD/dialogs/deleteconfirmdialog.cpp \
|
||||
$$PWD/dialogs/importfolderutils.cpp \
|
||||
$$PWD/titletoolbar.cpp \
|
||||
$$PWD/viewarea.cpp
|
||||
|
||||
HEADERS += \
|
||||
@ -155,4 +156,5 @@ HEADERS += \
|
||||
$$PWD/dialogs/nodeinfowidget.h \
|
||||
$$PWD/statusbarhelper.h \
|
||||
$$PWD/dialogs/deleteconfirmdialog.h \
|
||||
$$PWD/titletoolbar.h \
|
||||
$$PWD/viewarea.h
|
||||
|
@ -10,8 +10,6 @@ INCLUDEPATH *= $$SRC_FOLDER
|
||||
|
||||
LIBS_FOLDER = $$PWD/../../../libs
|
||||
|
||||
include($$LIBS_FOLDER/vtitlebar/vtitlebar_export.pri)
|
||||
|
||||
include($$LIBS_FOLDER/vtextedit/src/editor/editor_export.pri)
|
||||
|
||||
include($$LIBS_FOLDER/vtextedit/src/libs/syntax-highlighting/syntax-highlighting_export.pri)
|
||||
|
Loading…
x
Reference in New Issue
Block a user