mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
add config global/sync_note_list_to_current_tab to auto locate to current tab in note list
This commit is contained in:
parent
78a6602ad4
commit
8871f56368
@ -114,7 +114,7 @@ foreground: 56b6c2
|
|||||||
|
|
||||||
CODE
|
CODE
|
||||||
foreground: 98c379
|
foreground: 98c379
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
EMPH
|
EMPH
|
||||||
foreground: e0e0e0
|
foreground: e0e0e0
|
||||||
@ -138,11 +138,11 @@ foreground: 9e9e9e
|
|||||||
|
|
||||||
VERBATIM
|
VERBATIM
|
||||||
foreground: 98c379
|
foreground: 98c379
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
FENCEDCODEBLOCK
|
FENCEDCODEBLOCK
|
||||||
foreground: 98c379
|
foreground: 98c379
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
||||||
# The last occurence of the same attribute takes effect
|
# The last occurence of the same attribute takes effect
|
||||||
# Could specify multiple attribute in one line
|
# Could specify multiple attribute in one line
|
||||||
@ -195,18 +195,18 @@ foreground: af8787
|
|||||||
|
|
||||||
INLINEEQUATION
|
INLINEEQUATION
|
||||||
foreground: 93d3cc
|
foreground: 93d3cc
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
DISPLAYFORMULA
|
DISPLAYFORMULA
|
||||||
foreground: 93d3cc
|
foreground: 93d3cc
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
MARK
|
MARK
|
||||||
foreground: dadada
|
foreground: dadada
|
||||||
background: 802090
|
background: 802090
|
||||||
|
|
||||||
TABLE
|
TABLE
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
TABLEBORDER
|
TABLEBORDER
|
||||||
foreground: e37c84
|
foreground: e37c84
|
||||||
|
@ -114,7 +114,7 @@ foreground: 56b6c2
|
|||||||
|
|
||||||
CODE
|
CODE
|
||||||
foreground: 98c379
|
foreground: 98c379
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
EMPH
|
EMPH
|
||||||
font-style: italic
|
font-style: italic
|
||||||
@ -136,11 +136,11 @@ foreground: 6e7686
|
|||||||
|
|
||||||
VERBATIM
|
VERBATIM
|
||||||
foreground: 98c379
|
foreground: 98c379
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
FENCEDCODEBLOCK
|
FENCEDCODEBLOCK
|
||||||
foreground: 98c379
|
foreground: 98c379
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
||||||
# The last occurence of the same attribute takes effect
|
# The last occurence of the same attribute takes effect
|
||||||
# Could specify multiple attribute in one line
|
# Could specify multiple attribute in one line
|
||||||
@ -194,18 +194,18 @@ foreground: 6e7686
|
|||||||
|
|
||||||
INLINEEQUATION
|
INLINEEQUATION
|
||||||
foreground: 4db6ac
|
foreground: 4db6ac
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
DISPLAYFORMULA
|
DISPLAYFORMULA
|
||||||
foreground: 4db6ac
|
foreground: 4db6ac
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
MARK
|
MARK
|
||||||
foreground: abb2bf
|
foreground: abb2bf
|
||||||
background: 551560
|
background: 551560
|
||||||
|
|
||||||
TABLE
|
TABLE
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
TABLEBORDER
|
TABLEBORDER
|
||||||
foreground: e06c75
|
foreground: e06c75
|
||||||
|
@ -111,7 +111,7 @@ foreground: 826200
|
|||||||
|
|
||||||
CODE
|
CODE
|
||||||
foreground: 8e24aa
|
foreground: 8e24aa
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
EMPH
|
EMPH
|
||||||
font-style: italic
|
font-style: italic
|
||||||
@ -133,11 +133,11 @@ foreground: 93a1a1
|
|||||||
|
|
||||||
VERBATIM
|
VERBATIM
|
||||||
foreground: 673ab7
|
foreground: 673ab7
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
FENCEDCODEBLOCK
|
FENCEDCODEBLOCK
|
||||||
foreground: 673ab7
|
foreground: 673ab7
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
||||||
# The last occurence of the same attribute takes effect
|
# The last occurence of the same attribute takes effect
|
||||||
hljs-comment: 6c6c6c
|
hljs-comment: 6c6c6c
|
||||||
@ -190,18 +190,18 @@ foreground: 6c6c6c
|
|||||||
|
|
||||||
INLINEEQUATION
|
INLINEEQUATION
|
||||||
foreground: 00897b
|
foreground: 00897b
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
DISPLAYFORMULA
|
DISPLAYFORMULA
|
||||||
foreground: 00897b
|
foreground: 00897b
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
MARK
|
MARK
|
||||||
foreground: 363636
|
foreground: 363636
|
||||||
background: ffff76
|
background: ffff76
|
||||||
|
|
||||||
TABLE
|
TABLE
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
TABLEBORDER
|
TABLEBORDER
|
||||||
foreground: d33682
|
foreground: d33682
|
||||||
|
@ -112,7 +112,7 @@ foreground: 826200
|
|||||||
|
|
||||||
CODE
|
CODE
|
||||||
foreground: 8e24aa
|
foreground: 8e24aa
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
EMPH
|
EMPH
|
||||||
font-style: italic
|
font-style: italic
|
||||||
@ -134,11 +134,11 @@ foreground: 93a1a1
|
|||||||
|
|
||||||
VERBATIM
|
VERBATIM
|
||||||
foreground: 673ab7
|
foreground: 673ab7
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
FENCEDCODEBLOCK
|
FENCEDCODEBLOCK
|
||||||
foreground: 673ab7
|
foreground: 673ab7
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, strikeout, color)
|
||||||
# The last occurence of the same attribute takes effect
|
# The last occurence of the same attribute takes effect
|
||||||
# Could specify multiple attribute in one line
|
# Could specify multiple attribute in one line
|
||||||
@ -191,18 +191,18 @@ foreground: 6c6c6c
|
|||||||
|
|
||||||
INLINEEQUATION
|
INLINEEQUATION
|
||||||
foreground: 00897b
|
foreground: 00897b
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
DISPLAYFORMULA
|
DISPLAYFORMULA
|
||||||
foreground: 00897b
|
foreground: 00897b
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
MARK
|
MARK
|
||||||
foreground: 222222
|
foreground: 222222
|
||||||
background: ffff76
|
background: ffff76
|
||||||
|
|
||||||
TABLE
|
TABLE
|
||||||
font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
|
font-family: YaHei Consolas Hybrid, Consolas, Monaco, Andale Mono, Monospace, Courier New
|
||||||
|
|
||||||
TABLEBORDER
|
TABLEBORDER
|
||||||
foreground: d33682
|
foreground: d33682
|
||||||
|
@ -286,6 +286,9 @@ windows_opengl=0
|
|||||||
; Whether allow VNote to send request for couting users
|
; Whether allow VNote to send request for couting users
|
||||||
allow_user_track=true
|
allow_user_track=true
|
||||||
|
|
||||||
|
; Whether auto locate to current tab in note list
|
||||||
|
sync_note_list_to_current_tab=false
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
; Auto indent as previous line
|
; Auto indent as previous line
|
||||||
auto_indent=true
|
auto_indent=true
|
||||||
|
@ -326,6 +326,9 @@ void VConfigManager::initialize()
|
|||||||
m_highlightMatchesInPage = getConfigFromSettings("global",
|
m_highlightMatchesInPage = getConfigFromSettings("global",
|
||||||
"highlight_matches_in_page").toBool();
|
"highlight_matches_in_page").toBool();
|
||||||
|
|
||||||
|
m_syncNoteListToCurrentTab = getConfigFromSettings("global",
|
||||||
|
"sync_note_list_to_current_tab").toBool();
|
||||||
|
|
||||||
initEditorConfigs();
|
initEditorConfigs();
|
||||||
|
|
||||||
initMarkdownConfigs();
|
initMarkdownConfigs();
|
||||||
|
@ -634,6 +634,9 @@ public:
|
|||||||
bool getAllowUserTrack() const;
|
bool getAllowUserTrack() const;
|
||||||
void setAllowUserTrack(bool p_enabled);
|
void setAllowUserTrack(bool p_enabled);
|
||||||
|
|
||||||
|
bool getSyncNoteListToTab() const;
|
||||||
|
void setSyncNoteListToTab(bool p_enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initEditorConfigs();
|
void initEditorConfigs();
|
||||||
|
|
||||||
@ -1121,6 +1124,9 @@ private:
|
|||||||
// Whether enable smart table.
|
// Whether enable smart table.
|
||||||
bool m_enableSmartTable;
|
bool m_enableSmartTable;
|
||||||
|
|
||||||
|
// Whether auto locate to current tab in note list.
|
||||||
|
bool m_syncNoteListToCurrentTab;
|
||||||
|
|
||||||
// The name of the config file in each directory.
|
// The name of the config file in each directory.
|
||||||
static const QString c_dirConfigFile;
|
static const QString c_dirConfigFile;
|
||||||
|
|
||||||
@ -2932,4 +2938,19 @@ inline void VConfigManager::setAllowUserTrack(bool p_enabled)
|
|||||||
{
|
{
|
||||||
setConfigToSettings("global", "allow_user_track", p_enabled);
|
setConfigToSettings("global", "allow_user_track", p_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool VConfigManager::getSyncNoteListToTab() const
|
||||||
|
{
|
||||||
|
return m_syncNoteListToCurrentTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void VConfigManager::setSyncNoteListToTab(bool p_enabled)
|
||||||
|
{
|
||||||
|
if (m_syncNoteListToCurrentTab == p_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_syncNoteListToCurrentTab = p_enabled;
|
||||||
|
setConfigToSettings("global", "sync_note_list_to_current_tab", m_syncNoteListToCurrentTab);
|
||||||
|
}
|
||||||
#endif // VCONFIGMANAGER_H
|
#endif // VCONFIGMANAGER_H
|
||||||
|
@ -86,7 +86,8 @@ VMainWindow::VMainWindow(VSingleInstanceGuard *p_guard, QWidget *p_parent)
|
|||||||
m_windowOldState(Qt::WindowNoState),
|
m_windowOldState(Qt::WindowNoState),
|
||||||
m_requestQuit(false),
|
m_requestQuit(false),
|
||||||
m_printer(NULL),
|
m_printer(NULL),
|
||||||
m_ue(NULL)
|
m_ue(NULL),
|
||||||
|
m_syncNoteListToCurrentTab(true)
|
||||||
{
|
{
|
||||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||||
|
|
||||||
@ -2137,6 +2138,10 @@ void VMainWindow::handleAreaTabStatusUpdated(const VEditTabInfo &p_info)
|
|||||||
|
|
||||||
m_attachmentList->setFile(dynamic_cast<VNoteFile *>(m_curFile.data()));
|
m_attachmentList->setFile(dynamic_cast<VNoteFile *>(m_curFile.data()));
|
||||||
|
|
||||||
|
if (m_syncNoteListToCurrentTab && g_config->getSyncNoteListToTab()) {
|
||||||
|
locateFile(m_curFile, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
if (m_curFile) {
|
if (m_curFile) {
|
||||||
m_findReplaceDialog->updateState(m_curFile->getDocType(),
|
m_findReplaceDialog->updateState(m_curFile->getDocType(),
|
||||||
@ -2290,9 +2295,12 @@ void VMainWindow::closeEvent(QCloseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_syncNoteListToCurrentTab = false;
|
||||||
|
|
||||||
if (!m_editArea->closeAllFiles(false)) {
|
if (!m_editArea->closeAllFiles(false)) {
|
||||||
// Fail to close all the opened files, cancel closing app.
|
// Fail to close all the opened files, cancel closing app.
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
m_syncNoteListToCurrentTab = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2371,7 +2379,7 @@ void VMainWindow::keyPressEvent(QKeyEvent *event)
|
|||||||
QMainWindow::keyPressEvent(event);
|
QMainWindow::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VMainWindow::locateFile(VFile *p_file)
|
bool VMainWindow::locateFile(VFile *p_file, bool p_focus, bool p_show)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (!p_file || p_file->getType() != FileType::Note) {
|
if (!p_file || p_file->getType() != FileType::Note) {
|
||||||
@ -2393,13 +2401,15 @@ bool VMainWindow::locateFile(VFile *p_file)
|
|||||||
|
|
||||||
if (m_fileList->locateFile(file)) {
|
if (m_fileList->locateFile(file)) {
|
||||||
ret = true;
|
ret = true;
|
||||||
m_fileList->setFocus();
|
if (p_focus) {
|
||||||
|
m_fileList->setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the directory and file panels after location.
|
// Open the directory and file panels after location.
|
||||||
if (ret) {
|
if (ret && p_show) {
|
||||||
showNotebookPanel();
|
showNotebookPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3411,6 +3421,8 @@ void VMainWindow::setToolBarVisible(bool p_visible)
|
|||||||
void VMainWindow::kickOffStartUpTimer(const QStringList &p_files)
|
void VMainWindow::kickOffStartUpTimer(const QStringList &p_files)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(300, [this, p_files]() {
|
QTimer::singleShot(300, [this, p_files]() {
|
||||||
|
m_syncNoteListToCurrentTab = false;
|
||||||
|
|
||||||
checkNotebooks();
|
checkNotebooks();
|
||||||
QCoreApplication::sendPostedEvents();
|
QCoreApplication::sendPostedEvents();
|
||||||
promptNewNotebookIfEmpty();
|
promptNewNotebookIfEmpty();
|
||||||
@ -3441,6 +3453,8 @@ void VMainWindow::kickOffStartUpTimer(const QStringList &p_files)
|
|||||||
if (g_config->getAllowUserTrack()) {
|
if (g_config->getAllowUserTrack()) {
|
||||||
QTimer::singleShot(60000, this, SLOT(collectUserStat()));
|
QTimer::singleShot(60000, this, SLOT(collectUserStat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_syncNoteListToCurrentTab = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
VMainWindow(VSingleInstanceGuard *p_guard, QWidget *p_parent = 0);
|
VMainWindow(VSingleInstanceGuard *p_guard, QWidget *p_parent = 0);
|
||||||
|
|
||||||
// Returns true if the location succeeds.
|
// Returns true if the location succeeds.
|
||||||
bool locateFile(VFile *p_file);
|
bool locateFile(VFile *p_file, bool p_focus = true, bool p_show = true);
|
||||||
|
|
||||||
// Returns true if the location succeeds.
|
// Returns true if the location succeeds.
|
||||||
bool locateDirectory(VDirectory *p_directory);
|
bool locateDirectory(VDirectory *p_directory);
|
||||||
@ -506,6 +506,9 @@ private:
|
|||||||
|
|
||||||
VTagExplorer *m_tagExplorer;
|
VTagExplorer *m_tagExplorer;
|
||||||
|
|
||||||
|
// Whether sync note list to current tab.
|
||||||
|
bool m_syncNoteListToCurrentTab;
|
||||||
|
|
||||||
// Interval of the shared memory timer in ms.
|
// Interval of the shared memory timer in ms.
|
||||||
static const int c_sharedMemTimerInterval;
|
static const int c_sharedMemTimerInterval;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user