浏览代码

add welcome page

Le Tan 4 年之前
父节点
当前提交
3d7cd68707

+ 1 - 1
README_zh_CN.md

@@ -5,7 +5,7 @@
 
 一个舒适的笔记平台!
 
-更多信息,请访问 [VNote 主页](https://tamlok.gitee.io/vnote) 或者 [Gitee 托管主页](https://tamlok.gitee.io/vnote) 。
+更多信息,请访问 [VNote 主页](https://tamlok.gitee.io/vnote) 或者[由 Gitee 托管主页](https://tamlok.gitee.io/vnote) 。
 
 ![VNote](pics/vnote.png)
 

+ 1 - 0
src/core/mainconfig.cpp

@@ -118,4 +118,5 @@ void MainConfig::doVersionSpecificOverride()
 {
     // In a new version, we may want to change one value by force.
     m_coreConfig->m_shortcuts[CoreConfig::Shortcut::LocationListDock] = "Ctrl+G, C";
+    m_coreConfig->m_shortcuts[CoreConfig::Shortcut::NewWorkspace] = "";
 }

+ 1 - 1
src/core/versioncontroller/dummyversioncontrollerfactory.cpp

@@ -17,7 +17,7 @@ QString DummyVersionControllerFactory::getName() const
 
 QString DummyVersionControllerFactory::getDisplayName() const
 {
-    return QObject::tr("Dummy Version Control");
+    return QObject::tr("No Version Control");
 }
 
 QString DummyVersionControllerFactory::getDescription() const

+ 1 - 1
src/data/core/vnotex.json

@@ -28,7 +28,7 @@
             "MaximizeSplit" : "Ctrl+G, Shift+\\",
             "DistributeSplits" : "Ctrl+G, =",
             "RemoveSplitAndWorkspace" : "Ctrl+G, R",
-            "NewWorkspace" : "Ctrl+G, M",
+            "NewWorkspace" : "",
             "Export" : "Ctrl+G, T",
             "Quit" : "Ctrl+Q",
             "FlashPage" : "Ctrl+Alt+L",

+ 10 - 0
src/data/extra/docs/en/welcome.md

@@ -0,0 +1,10 @@
+# Welcome To VNote
+A pleasant note-taking platform.
+
+For more information, please visit [**VNote's Home Page**](https://vnotex.github.io/vnote) or [Home Page on Gitee](https://tamlok.gitee.io/vnote).
+
+## FAQs
+* If VNote crashes after update, please delete the `vnotex.json` file under user configuration folder.
+* VNote has a series of powerful shortcuts. Please view the user configuration file `vnotex.json` for a complete list of shortcuts.
+* Feedbacks are appreciated! Please [post an issue](https://github.com/vnotex/vnote/issues) on GitHub if there is any.
+

+ 10 - 0
src/data/extra/docs/zh_CN/welcome.md

@@ -0,0 +1,10 @@
+# 欢迎使用 VNote
+一个舒适的笔记平台。
+
+更多信息,请访问 [VNote 主页](https://tamlok.gitee.io/vnote) 或者[由 Gitee 托管的主页](https://tamlok.gitee.io/vnote) 。
+
+## 常见问题
+* 如果更新后 VNote 崩溃,请删除用户配置文件夹中的 `vnotex.json` 文件。
+* VNote 有着一系列强大的快捷键。请查看用户配置文件 `vnotex.json` 以获取一个完整的快捷键列表。
+* 使用中有任何问题,欢迎[反馈](https://github.com/vnotex/vnote/issues) 。
+

+ 2 - 0
src/data/extra/extra.qrc

@@ -5,11 +5,13 @@
         <file>docs/en/shortcuts.md</file>
         <file>docs/en/markdown_guide.md</file>
         <file>docs/en/external_programs.md</file>
+        <file>docs/en/welcome.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>docs/zh_CN/external_programs.md</file>
+        <file>docs/zh_CN/welcome.md</file>
         <file>web/markdown-viewer-template.html</file>
         <file>web/markdown-export-template.html</file>
         <file>web/css/globalstyles.css</file>

+ 11 - 0
src/widgets/mainwindow.cpp

@@ -28,6 +28,7 @@
 #include <core/configmgr.h>
 #include <core/sessionconfig.h>
 #include <core/coreconfig.h>
+#include <core/mainconfig.h>
 #include <core/widgetconfig.h>
 #include <core/events.h>
 #include <core/fileopenparameters.h>
@@ -45,6 +46,7 @@
 #include <notebook/notebook.h>
 #include "searchinfoprovider.h"
 #include <vtextedit/spellchecker.h>
+#include <utils/docsutils.h>
 
 using namespace vnotex;
 
@@ -95,6 +97,15 @@ void MainWindow::kickOffOnStart(const QStringList &p_paths)
         demoWidget();
 
         openFiles(p_paths);
+
+        if (MainConfig::isVersionChanged()) {
+            const auto file = DocsUtils::getDocFile(QStringLiteral("welcome.md"));
+            if (!file.isEmpty()) {
+                auto paras = QSharedPointer<FileOpenParameters>::create();
+                paras->m_readOnly = true;
+                emit VNoteX::getInst().openFileRequested(file, paras);
+            }
+        }
     });
 }
 

+ 2 - 0
src/widgets/notebookexplorer.cpp

@@ -74,6 +74,8 @@ void NotebookExplorer::setupUI()
                 auto id = static_cast<ID>(m_selector->itemData(p_idx).toULongLong());
                 emit notebookActivated(id);
             });
+    connect(m_selector, &NotebookSelector::newNotebookRequested,
+            this, &NotebookExplorer::newNotebook);
     mainLayout->addWidget(m_selector);
 
     const auto &widgetConfig = ConfigMgr::getInst().getWidgetConfig();

+ 10 - 0
src/widgets/notebookselector.cpp

@@ -176,3 +176,13 @@ void NotebookSelector::clearNavigation()
 
     NavigationMode::clearNavigation();
 }
+
+void NotebookSelector::mousePressEvent(QMouseEvent *p_event)
+{
+    if (count() == 0) {
+        emit newNotebookRequested();
+        return;
+    }
+
+    QComboBox::mousePressEvent(p_event);
+}

+ 5 - 0
src/widgets/notebookselector.h

@@ -23,6 +23,9 @@ namespace vnotex
 
         void setCurrentNotebook(ID p_id);
 
+    signals:
+        void newNotebookRequested();
+
     // NavigationMode.
     protected:
         QVector<void *> getVisibleNavigationItems() Q_DECL_OVERRIDE;
@@ -36,6 +39,8 @@ namespace vnotex
     protected:
         bool eventFilter(QObject *p_obj, QEvent *p_event) Q_DECL_OVERRIDE;
 
+        void mousePressEvent(QMouseEvent *p_event) Q_DECL_OVERRIDE;
+
     private:
         void addNotebookItem(const QSharedPointer<Notebook> &p_notebook);