diff --git a/src/resources/docs/welcome_en.md b/src/resources/docs/welcome_en.md new file mode 100644 index 00000000..87f025a6 --- /dev/null +++ b/src/resources/docs/welcome_en.md @@ -0,0 +1,21 @@ +# Welcome to VNote +![VNote](qrc:/resources/icons/vnote.svg =128x) + +[VNote](https://tamlok.github.io/vnote) is a Vim-inspired note-taking application that knows programmers and Markdown better. VNote provides fancy Markdown experience as well as powerful notes management. + +VNote is **open source** and currently mainly developed and maintained by one single person in spare time. Hence, please don't hesitate to give VNote a hand if she does improve your productivity. + +## Troubleshooting Guide +1. Go through the context menu, menu bar, tool bar, settings, and help menu to check if you miss something; +2. Changes to configuration may need re-opening current tabs or restarting VNote; +3. There is a Markdown guide and shortcuts guide in the help menu, which might be helpful; +4. Do a quick search in [Github Issues](https://github.com/tamlok/vnote/issues) and VNote's [Documentation](https://vnote.readthedocs.io/en/latest/); +5. Post an issue *in detail* on Github to ask for help. + +One More Thing: If you do not know what is Vim, please do not turn on Vim mode in the settings dialog. 😁 By the way, Vim is really a magic tool to improve edit efficiency. Highly recommend Vim mode and VNote's shortcuts. You won't regret it. + +Now, how about pressing `Ctrl+G` and start today's work from **Universal Entry**? + +Have fun! + +Fork me on GitHub \ No newline at end of file diff --git a/src/resources/docs/welcome_zh.md b/src/resources/docs/welcome_zh.md new file mode 100644 index 00000000..fc5ba104 --- /dev/null +++ b/src/resources/docs/welcome_zh.md @@ -0,0 +1,21 @@ +# 欢迎使用VNote +![VNote](qrc:/resources/icons/vnote.svg =128x) + +[VNote](https://tamlok.github.io/vnote) 是一个受Vim启发的、更懂程序员和Markdown的笔记软件。VNote提供了美妙的Markdown体验以及强大的笔记管理。 + +VNote是**开源**的,当前主要由个人在业余时间进行开发和维护。因此,如果VNote给您的效率带来了提升,请考虑帮助VNote成长。 + +## 问题解决指南 +1. 浏览上下文菜单、菜单栏、工具栏、设置以及帮助菜单; +2. 更改配置可能需要重新打开当前标签页或重启VNote; +3. 帮助菜单中包含了一份Markdown语法指南和一份快捷键指南; +4. 在[Github Issues](https://github.com/tamlok/vnote/issues)和VNote[文档](https://vnote.readthedocs.io/zh_CN/latest)中搜索您的问题; +5. 在Github上提交一个*详细*的Issue寻求帮助。 + +顺带一提: 如果您不了解Vim,请不要在设置对话框中开启Vim模式。😁Vim的确是一个提升编辑效率的神器。强烈推荐熟悉一下Vim模式以及VNote的快捷键。 + +现在,不妨按下`Ctrl+G`,让一天的工作从**通用入口**开始吧! + +Markdown愉快! + +Fork me on GitHub \ No newline at end of file diff --git a/src/resources/welcome.html b/src/resources/welcome.html deleted file mode 100644 index ea85947f..00000000 --- a/src/resources/welcome.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Welcome VNote - - -

Welcome to VNote

-

A Vim-Like Note for Markdown

-

Under development by Le Tan. -Please contact tamlokveer@gmail.com if you have any questions. -

- - diff --git a/src/vconfigmanager.h b/src/vconfigmanager.h index 6b076745..627489a3 100644 --- a/src/vconfigmanager.h +++ b/src/vconfigmanager.h @@ -582,6 +582,8 @@ public: bool getParsePasteLocalImage() const; + bool versionChanged() const; + private: // Look up a config from user and default settings. QVariant getConfigFromSettings(const QString §ion, const QString &key) const; @@ -2707,4 +2709,9 @@ inline bool VConfigManager::getParsePasteLocalImage() const { return m_parsePasteLocalImage; } + +inline bool VConfigManager::versionChanged() const +{ + return m_versionChanged; +} #endif // VCONFIGMANAGER_H diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index 7aca8390..26cd254d 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -808,7 +808,7 @@ void VMainWindow::initHelpMenu() connect(mdGuideAct, &QAction::triggered, this, [this](){ QString docFile = VUtils::getDocFile(VNote::c_markdownGuideDocFile); - VFile *file = vnote->getOrphanFile(docFile, false, true); + VFile *file = vnote->getFile(docFile, true); m_editArea->openFile(file, OpenFileMode::Read); }); @@ -2458,7 +2458,7 @@ void VMainWindow::enableImageCaption(bool p_checked) void VMainWindow::shortcutsHelp() { QString docFile = VUtils::getDocFile(VNote::c_shortcutsDocFile); - VFile *file = vnote->getOrphanFile(docFile, false, true); + VFile *file = vnote->getFile(docFile, true); m_editArea->openFile(file, OpenFileMode::Read); } @@ -2577,14 +2577,7 @@ QVector VMainWindow::openFiles(const QStringList &p_files, continue; } - VFile *file = NULL; - if (!p_forceOrphan) { - file = vnote->getInternalFile(p_files[i]); - } - - if (!file) { - file = vnote->getOrphanFile(p_files[i], true); - } + VFile *file = vnote->getFile(p_files[i], p_forceOrphan); m_editArea->openFile(file, p_mode, p_forceMode); vfiles.append(file); @@ -3340,6 +3333,11 @@ void VMainWindow::kickOffStartUpTimer(const QStringList &p_files) QCoreApplication::sendPostedEvents(); openStartupPages(); openFiles(p_files, false, g_config->getNoteOpenMode(), false, true); + if (g_config->versionChanged()) { + QString docFile = VUtils::getDocFile("welcome.md"); + VFile *file = vnote->getFile(docFile, true); + m_editArea->openFile(file, OpenFileMode::Read); + } }); } diff --git a/src/vnote.cpp b/src/vnote.cpp index 2f1f9ff1..bd1688e8 100644 --- a/src/vnote.cpp +++ b/src/vnote.cpp @@ -323,9 +323,13 @@ VNoteFile *VNote::getInternalFile(const QString &p_path) return file; } -VFile *VNote::getFile(const QString &p_path) +VFile *VNote::getFile(const QString &p_path, bool p_forceOrphan) { - VFile *file = getInternalFile(p_path); + VFile *file = NULL; + if (!p_forceOrphan) { + file = getInternalFile(p_path); + } + if (!file) { QFileInfo fi(p_path); if (fi.isNativePath()) { diff --git a/src/vnote.h b/src/vnote.h index 3d75a4f8..f8f6e9c0 100644 --- a/src/vnote.h +++ b/src/vnote.h @@ -90,12 +90,7 @@ public: // Given the path of a file, first try to open it as note file, // then try to open it as orphan file. - VFile *getFile(const QString &p_path); - - // Given the path of an external file, create a VOrphanFile struct. - VOrphanFile *getOrphanFile(const QString &p_path, - bool p_modifiable, - bool p_systemFile = false); + VFile *getFile(const QString &p_path, bool p_forceOrphan = false); // Given the path of a file, try to find it in all notebooks. // Returns a VNoteFile struct if it is a note in one notebook. @@ -132,6 +127,11 @@ public slots: private: const QString &getMonospacedFont() const; + // Given the path of an external file, create a VOrphanFile struct. + VOrphanFile *getOrphanFile(const QString &p_path, + bool p_modifiable, + bool p_systemFile = false); + // Maintain all the notebooks. Other holder should use QPointer. QVector m_notebooks; diff --git a/src/vnote.qrc b/src/vnote.qrc index ffb09bf5..ead95908 100644 --- a/src/vnote.qrc +++ b/src/vnote.qrc @@ -1,6 +1,5 @@ - resources/welcome.html resources/qwebchannel.js utils/marked/marked.min.js utils/highlightjs/highlight.pack.js @@ -275,5 +274,7 @@ resources/export/outline.js resources/icons/add.svg resources/icons/delete.svg + resources/docs/welcome_en.md + resources/docs/welcome_zh.md