forked from vnotex/vnote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvconfigmanager.h
More file actions
2992 lines (2275 loc) · 76.5 KB
/
vconfigmanager.h
File metadata and controls
2992 lines (2275 loc) · 76.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef VCONFIGMANAGER_H
#define VCONFIGMANAGER_H
#include <QObject>
#include <QFont>
#include <QPalette>
#include <QVector>
#include <QSettings>
#include <QHash>
#include <QLinkedList>
#include <QDir>
#include "vnotebook.h"
#include "markdownhighlighterdata.h"
#include "vmarkdownconverter.h"
#include "vconstants.h"
#include "vfilesessioninfo.h"
#include "utils/vmetawordmanager.h"
#include "markdownitoption.h"
#include "vhistoryentry.h"
#include "vexplorerentry.h"
class QJsonObject;
class QString;
struct VColor
{
QString m_name;
QString m_color; // #RGB or color name.
};
struct VExternalEditor
{
QString m_name;
QString m_cmd;
QString m_shortcut;
};
// Type of heading sequence.
enum class HeadingSequenceType
{
Disabled = 0,
Enabled,
// Enabled only for internal notes.
EnabledNoteOnly,
Invalid
};
// Editor key mode.
enum class KeyMode
{
Normal = 0,
Vim,
Invalid
};
enum SmartLivePreview
{
Disabled = 0,
EditorToWeb = 0x1,
WebToEditor = 0x2
};
enum
{
AutoScrollDisabled = 0,
AutoScrollEndOfDoc = 1,
AutoScrollAlways = 2
};
enum
{
OpenGLDefault = 0,
OpenGLDesktop = 1,
OpenGLAngle = 2,
OpenGLSoftware = 3
};
class VConfigManager : public QObject
{
public:
explicit VConfigManager(QObject *p_parent = NULL);
void initialize();
// Read config from the directory config json file into a QJsonObject.
// @path is the directory containing the config json file.
static QJsonObject readDirectoryConfig(const QString &path);
static bool writeDirectoryConfig(const QString &path, const QJsonObject &configJson);
static bool directoryConfigExist(const QString &path);
static bool deleteDirectoryConfig(const QString &path);
// Get the path of the folder used to store default notebook.
static QString getVnoteNotebookFolderPath();
// Get the path of the default export folder.
static QString getExportFolderPath();
static QString getDocumentPathOrHomePath();
// Get windows_opengl config.
// Because we may call this before QApplication initialization, we only
// read/write the config to the user folder.
static int getWindowsOpenGL();
static void setWindowsOpenGL(int p_openGL);
// Constants
static const QString orgName;
static const QString appName;
static const QString c_version;
// CSS style for Warning texts.
static const QString c_warningTextStyle;
// CSS style for data in label.
static const QString c_dataTextStyle;
// Reset the configuratio files.
void resetConfigurations();
// Reset the layout.
void resetLayoutConfigurations();
QFont getMdEditFont() const;
const QPalette &getMdEditPalette() const;
QVector<HighlightingStyle> getMdHighlightingStyles() const;
QHash<QString, QTextCharFormat> getCodeBlockStyles() const;
QString getLogFilePath() const;
// Get the css style URL for web view.
QString getCssStyleUrl() const;
QString getCssStyleUrl(const QString &p_style) const;
QString getCodeBlockCssStyleUrl() const;
QString getCodeBlockCssStyleUrl(const QString &p_style) const;
QString getMermaidCssStyleUrl() const;
const QString &getEditorStyle() const;
void setEditorStyle(const QString &p_style);
const QString &getCssStyle() const;
void setCssStyle(const QString &p_style);
const QString &getCodeBlockCssStyle() const;
void setCodeBlockCssStyle(const QString &p_style);
QFont getBaseEditFont() const;
QPalette getBaseEditPalette() const;
int getCurNotebookIndex() const;
void setCurNotebookIndex(int index);
int getNaviBoxCurrentIndex() const;
void setNaviBoxCurrentIndex(int p_index);
// Read [notebooks] section from settings into @p_notebooks.
void getNotebooks(QVector<VNotebook *> &p_notebooks, QObject *p_parent);
// Write @p_notebooks to [notebooks] section into settings.
void setNotebooks(const QVector<VNotebook *> &p_notebooks);
hoedown_extensions getMarkdownExtensions() const;
MarkdownConverterType getMdConverterType() const;
void setMarkdownConverterType(MarkdownConverterType type);
int getTabStopWidth() const;
void setTabStopWidth(int tabStopWidth);
bool getIsExpandTab() const;
void setIsExpandTab(bool isExpandTab);
bool getHighlightCursorLine() const;
void setHighlightCursorLine(bool p_cursorLine);
bool getHighlightSelectedWord() const;
void setHighlightSelectedWord(bool p_selectedWord);
bool getHighlightSearchedWord() const;
void setHighlightSearchedWord(bool p_searchedWord);
bool getAutoIndent() const;
void setAutoIndent(bool p_autoIndent);
bool getAutoList() const;
void setAutoList(bool p_autoList);
bool getAutoQuote() const;
const QVector<VColor> &getCustomColors() const;
const QString &getCurBackgroundColor() const;
void setCurBackgroundColor(const QString &colorName);
const QString &getCurRenderBackgroundColor() const;
void setCurRenderBackgroundColor(const QString &colorName);
// Return the color string of background @p_bgName.
QString getRenderBackgroundColor(const QString &p_bgName) const;
bool getToolsDockChecked() const;
void setToolsDockChecked(bool p_checked);
bool getSearchDockChecked() const;
void setSearchDockChecked(bool p_checked);
const QByteArray getMainWindowGeometry() const;
void setMainWindowGeometry(const QByteArray &p_geometry);
const QByteArray getMainWindowState() const;
void setMainWindowState(const QByteArray &p_state);
const QByteArray getMainSplitterState() const;
void setMainSplitterState(const QByteArray &p_state);
const QByteArray getNotebookSplitterState() const;
void setNotebookSplitterState(const QByteArray &p_state);
const QByteArray getTagExplorerSplitterState() const;
void setTagExplorerSplitterState(const QByteArray &p_state);
int getPanelViewState() const;
void setPanelViewState(int p_state);
int getMaxTagLabelLength() const;
int getMaxNumOfTagLabels() const;
bool getFindCaseSensitive() const;
void setFindCaseSensitive(bool p_enabled);
bool getFindWholeWordOnly() const;
void setFindWholeWordOnly(bool p_enabled);
bool getFindRegularExpression() const;
void setFindRegularExpression(bool p_enabled);
bool getFindIncrementalSearch() const;
void setFindIncrementalSearch(bool p_enabled);
QString getLanguage() const;
void setLanguage(const QString &p_language);
bool getEnableMermaid() const;
void setEnableMermaid(bool p_enabled);
bool getEnableFlowchart() const;
void setEnableFlowchart(bool p_enabled);
bool getEnableMathjax() const;
void setEnableMathjax(bool p_enabled);
bool getEnableWavedrom() const;
void setEnableWavedrom(bool p_enabled);
bool getEnableGraphviz() const;
void setEnableGraphviz(bool p_enabled);
int getPlantUMLMode() const;
void setPlantUMLMode(int p_mode);
qreal getWebZoomFactor() const;
void setWebZoomFactor(qreal p_factor);
bool isCustomWebZoomFactor();
int getEditorZoomDelta() const;
void setEditorZoomDelta(int p_delta);
const QString &getEditorCurrentLineBg() const;
const QString &getEditorTrailingSpaceBg() const;
const QString &getEditorSelectedWordFg() const;
const QString &getEditorSelectedWordBg() const;
const QString &getEditorSearchedWordFg() const;
const QString &getEditorSearchedWordBg() const;
const QString &getEditorSearchedWordCursorFg() const;
const QString &getEditorSearchedWordCursorBg() const;
const QString &getEditorIncrementalSearchedWordFg() const;
const QString &getEditorIncrementalSearchedWordBg() const;
const QString &getEditorVimNormalBg() const;
const QString &getEditorVimInsertBg() const;
const QString &getEditorVimVisualBg() const;
const QString &getEditorVimReplaceBg() const;
bool getEnableCodeBlockHighlight() const;
void setEnableCodeBlockHighlight(bool p_enabled);
bool getEnablePreviewImages() const;
void setEnablePreviewImages(bool p_enabled);
bool getEnablePreviewImageConstraint() const;
void setEnablePreviewImageConstraint(bool p_enabled);
bool getEnableImageConstraint() const;
void setEnableImageConstraint(bool p_enabled);
bool getEnableImageCaption() const;
void setEnableImageCaption(bool p_enabled);
const QString &getImageFolder() const;
// Empty string to reset the default folder.
void setImageFolder(const QString &p_folder);
bool isCustomImageFolder() const;
const QString &getImageFolderExt() const;
// Empty string to reset the default folder.
void setImageFolderExt(const QString &p_folder);
bool isCustomImageFolderExt() const;
const QString &getAttachmentFolder() const;
// Empty string to reset the default folder.
void setAttachmentFolder(const QString &p_folder);
bool isCustomAttachmentFolder() const;
bool getEnableTrailingSpaceHighlight() const;
void setEnableTrailingSapceHighlight(bool p_enabled);
bool getEnableTabHighlight() const;
void setEnableTabHighlight(bool p_enabled);
KeyMode getKeyMode() const;
void setKeyMode(KeyMode p_mode);
bool getEnableVimMode() const;
bool getEnableSmartImInVimMode() const;
void setEnableSmartImInVimMode(bool p_enabled);
int getEditorLineNumber() const;
void setEditorLineNumber(int p_mode);
const QString &getEditorLineNumberBg() const;
const QString &getEditorLineNumberFg() const;
int getMinimizeToStystemTray() const;
void setMinimizeToSystemTray(int p_val);
void initDocSuffixes();
const QHash<int, QList<QString>> &getDocSuffixes() const;
int getMarkdownHighlightInterval() const;
int getLineDistanceHeight() const;
bool getInsertTitleFromNoteName() const;
void setInsertTitleFromNoteName(bool p_enabled);
OpenFileMode getNoteOpenMode() const;
void setNoteOpenMode(OpenFileMode p_mode);
HeadingSequenceType getHeadingSequenceType() const;
void setHeadingSequenceType(HeadingSequenceType p_type);
int getHeadingSequenceBaseLevel() const;
void setHeadingSequenceBaseLevel(int p_level);
int getColorColumn() const;
void setColorColumn(int p_column);
const QString &getEditorColorColumnBg() const;
const QString &getEditorColorColumnFg() const;
const QString &getEditorPreviewImageLineFg() const;
const QString &getEditorPreviewImageBg() const;
bool getEnableCodeBlockLineNumber() const;
void setEnableCodeBlockLineNumber(bool p_enabled);
int getToolBarIconSize() const;
void setToolBarIconSize(int p_size);
const MarkdownitOption &getMarkdownitOption() const;
void setMarkdownitOption(const MarkdownitOption &p_opt);
const QString &getRecycleBinFolder() const;
const QString &getRecycleBinFolderExt() const;
bool getConfirmImagesCleanUp() const;
void setConfirmImagesCleanUp(bool p_enabled);
bool getConfirmReloadFolder() const;
void setConfirmReloadFolder(bool p_enabled);
const QString &getMathjaxJavascript() const;
void setMathjaxJavascript(const QString &p_js);
bool getDoubleClickCloseTab() const;
bool getMiddleClickClostTab() const;
StartupPageType getStartupPageType() const;
void setStartupPageType(StartupPageType p_type);
const QStringList &getStartupPages() const;
void setStartupPages(const QStringList &p_pages);
// Read last opened files from [last_opened_files] of session.ini.
QVector<VFileSessionInfo> getLastOpenedFiles();
// Write last opened files to [last_opened_files] of session.ini.
void setLastOpenedFiles(const QVector<VFileSessionInfo> &p_files);
// Read history from [history] of session.ini.
void getHistory(QLinkedList<VHistoryEntry> &p_history) const;
void setHistory(const QLinkedList<VHistoryEntry> &p_history);
int getHistorySize() const;
// Read explorer's starred entries from [explorer_starred] of session.ini.
void getExplorerEntries(QVector<VExplorerEntry> &p_entries) const;
// Output starred entries to [explorer_starred] of session.ini.
void setExplorerEntries(const QVector<VExplorerEntry> &p_entries);
int getExplorerCurrentIndex() const;
void setExplorerCurrentIndex(int p_idx);
// Read custom magic words from [magic_words] section.
QVector<VMagicWord> getCustomMagicWords();
// Return the configured key sequence of @p_operation.
// Return empty if there is no corresponding config.
QString getShortcutKeySequence(const QString &p_operation) const;
// Return the configured key sequence in Captain mode.
// Return empty if there is no corresponding config.
QString getCaptainShortcutKeySequence(const QString &p_operation) const;
// Get the folder the ini file exists.
QString getConfigFolder() const;
// Get the ini config file path.
QString getConfigFilePath() const;
// Get the folder c_styleConfigFolder in the config folder.
const QString &getStyleConfigFolder() const;
// Get the folder c_templateConfigFolder in the config folder.
const QString &getTemplateConfigFolder() const;
// Get the folder c_themeConfigFolder in the config folder.
const QString &getThemeConfigFolder() const;
// Get the folder c_snippetConfigFolder in the config folder.
const QString &getSnippetConfigFolder() const;
const QString &getSnippetConfigFilePath() const;
const QString getKeyboardLayoutConfigFilePath() const;
// Read all available templates files in c_templateConfigFolder.
QVector<QString> getNoteTemplates(DocType p_type = DocType::Unknown) const;
// Get the folder c_codeBlockStyleConfigFolder in the config folder.
const QString &getCodeBlockStyleConfigFolder() const;
// Get the folder c_resourceConfigFolder in the config folder.
QString getResourceConfigFolder() const;
const QString &getCommonCssUrl() const;
// All the editor styles.
QList<QString> getEditorStyles() const;
// All the css styles.
QList<QString> getCssStyles() const;
// All the css styles.
QList<QString> getCodeBlockCssStyles() const;
// Return the timer interval for checking file.
int getFileTimerInterval() const;
// Get the backup directory.
const QString &getBackupDirectory() const;
// Get the backup file extension.
const QString &getBackupExtension() const;
// Whether backup file is enabled.
bool getEnableBackupFile() const;
void setEnableBackupFile(bool p_enabled);
// Get defined external editors.
QVector<VExternalEditor> getExternalEditors() const;
const QString &getVimExemptionKeys() const;
const QString &getFlashPage() const;
const QString &getQuickAccess() const;
void setQuickAccess(const QString &p_path);
bool getHighlightMatchesInPage() const;
void setHighlightMatchesInPage(bool p_enabled);
// All the themes.
QList<QString> getThemes() const;
// Return current theme name.
const QString &getTheme() const;
void setTheme(const QString &p_theme);
QString getThemeFile() const;
bool getCloseBeforeExternalEditor() const;
QStringList getStylesToRemoveWhenCopied() const;
const QString &getStylesToInlineWhenCopied() const;
QString getStyleOfSpanForMark() const;
// Return [web]/copy_targets.
QStringList getCopyTargets() const;
bool getMenuBarChecked() const;
void setMenuBarChecked(bool p_checked);
bool getToolBarChecked() const;
void setToolBarChecked(bool p_checked);
bool getSingleClickClosePreviousTab() const;
void setSingleClickClosePreviousTab(bool p_enabled);
bool getEnableWildCardInSimpleSearch() const;
bool getEnableAutoSave() const;
void setEnableAutoSave(bool p_enabled);
QString getWkhtmltopdfPath() const;
void setWkhtmltopdfPath(const QString &p_path);
QString getWkhtmltopdfArgs() const;
void setWkhtmltopdfArgs(const QString &p_args);
bool getEnableFlashAnchor() const;
void setEnableFlashAnchor(bool p_enabled);
QStringList getCustomExport() const;
void setCustomExport(const QStringList &p_exp);
QStringList getSearchOptions() const;
void setSearchOptions(const QStringList &p_opts);
const QString &getPlantUMLServer() const;
void setPlantUMLServer(const QString &p_server);
const QString &getPlantUMLJar() const;
void setPlantUMLJar(const QString &p_jarPath);
const QStringList &getPlantUMLArgs() const;
const QString &getPlantUMLCmd() const;
const QString &getGraphvizDot() const;
void setGraphvizDot(const QString &p_dotPath);
int getNoteListViewOrder() const;
void setNoteListViewOrder(int p_order);
int getOutlineExpandedLevel() const;
void setOutlineExpandedLevel(int p_level);
const QString &getImageNamePrefix() const;
QChar getVimLeaderKey() const;
int getSmartLivePreview() const;
void setSmartLivePreview(int p_preview);
bool getInsertNewNoteInFront() const;
void setInsertNewNoteInFront(bool p_enabled);
QString getKeyboardLayout() const;
void setKeyboardLayout(const QString &p_name);
QList<int> getKeyboardLayoutMappingKeys() const;
bool getParsePasteLocalImage() const;
bool versionChanged() const;
bool isFreshInstall() const;
const QColor &getBaseBackground() const;
void setBaseBackground(const QColor &p_bg);
bool getEnableExtraBuffer() const;
int getAutoScrollCursorLine() const;
void setAutoScrollCursorLine(int p_mode);
const QString &getEditorFontFamily() const;
void setEditorFontFamily(const QString &p_font);
bool getEnableSplitFileList() const;
void setEnableSplitFileList(bool p_enable);
bool getEnableSplitTagFileList() const;
void setEnableSplitTagFileList(bool p_enable);
// Get the path to browse when inserting image.
QString getImageBrowsePath() const;
void setImageBrowsePath(const QString &p_path);
bool getPrependDotInRelativePath() const;
void setPrependDotInRelativePath(bool p_enabled);
bool getEnableSmartTable() const;
void setEnableSmartTable(bool p_enabled);
bool getAllowUserTrack() const;
void setAllowUserTrack(bool p_enabled);
bool getSyncNoteListToTab() const;
void setSyncNoteListToTab(bool p_enabled);
QDate getLastUserTrackDate() const;
void updateLastUserTrackDate();
QDateTime getLastStartDateTime() const;
void updateLastStartDateTime();
int getTableFormatInterval() const;
bool getEnableCodeBlockCopyButton() const;
private:
void initEditorConfigs();
void initMarkdownConfigs();
// Look up a config from user and default settings.
QVariant getConfigFromSettings(const QString §ion, const QString &key) const;
// Set a config to user settings.
void setConfigToSettings(const QString §ion, const QString &key, const QVariant &value);
// Get default config from vnote.ini.
QVariant getDefaultConfig(const QString &p_section, const QString &p_key) const;
// Reset user config to default config and return the default config value.
QVariant resetDefaultConfig(const QString &p_section, const QString &p_key);
// Look up a config from session settings.
QVariant getConfigFromSessionSettings(const QString &p_section, const QString &p_key) const;
// Set a config to session settings.
void setConfigToSessionSettings(const QString &p_section,
const QString &p_key,
const QVariant &p_value);
void clearGroupOfSettings(QSettings *p_settings, const QString &p_group);
// Init defaultSettings, userSettings, and m_sessionSettings.
void initSettings();
// Init from m_sessionSettings.
void initFromSessionSettings();
// Read [notebooks] section from @p_settings.
void readNotebookFromSettings(QSettings *p_settings,
QVector<VNotebook *> &p_notebooks,
QObject *parent);
// Write to [notebooks] section to @p_settings.
void writeNotebookToSettings(QSettings *p_settings,
const QVector<VNotebook *> &p_notebooks);
void readCustomColors();
// 1. Update styles common in HTML and Markdown;
// 2. Update styles for Markdown.
void updateEditStyle();
void updateMarkdownEditStyle();
static QString fetchDirConfigFilePath(const QString &p_path);
// Read the [shortcuts] section in settings to init m_shortcuts.
// Will remove invalid config items.
// First read the config in default settings;
// Second read the config in user settings and overwrite the default ones;
// If there is any config in deafult settings that is absent in user settings,
// write the combined configs to user settings.
void readShortcutsFromSettings();
// Read the [captain_mode_shortcuts] section in the settings to init
// m_captainShortcuts.
void readCaptainShortcutsFromSettings();
QHash<QString, QString> readShortcutsFromSettings(QSettings *p_settings,
const QString &p_group);
void writeShortcutsToSettings(QSettings *p_settings,
const QString &p_group,
const QHash<QString, QString> &p_shortcuts);
// Whether @p_seq is a valid key sequence for shortcuts.
bool isValidKeySequence(const QString &p_seq);
// Init the themes name-file mappings.
void initThemes();
// Output built-in themes to user theme folder if there does not exists folders
// with the same name.
void outputBuiltInThemes();
// Init the editor styles name-file mappings.
void initEditorStyles();
void initCssStyles();
void initCodeBlockCssStyles();
QString getEditorStyleFile() const;
void checkVersion();
// Default font and palette.
QFont m_defaultEditFont;
QPalette m_defaultEditPalette;
// Font and palette used for non-markdown editor.
QFont baseEditFont;
QPalette baseEditPalette;
// Font and palette used for markdown editor.
QFont mdEditFont;
QPalette mdEditPalette;
QVector<HighlightingStyle> mdHighlightingStyles;
QHash<QString, QTextCharFormat> m_codeBlockStyles;
// Index of current notebook.
int curNotebookIndex;
// Markdown Converter
hoedown_extensions markdownExtensions;
MarkdownConverterType mdConverterType;
// Num of spaces
int tabStopWidth;
// Expand tab to @tabStopWidth spaces
bool isExpandTab;
// Highlight current cursor line.
bool m_highlightCursorLine;
// Highlight selected word.
bool m_highlightSelectedWord;
// Highlight searched word.
bool m_highlightSearchedWord;
// Auto Indent.
bool m_autoIndent;
// Auto List.
bool m_autoList;
// Auto quote.
bool m_autoQuote;
// App defined color
QVector<VColor> m_customColors;
QString curBackgroundColor;
QString curRenderBackgroundColor;
// Find/Replace dialog options
bool m_findCaseSensitive;
bool m_findWholeWordOnly;
bool m_findRegularExpression;
bool m_findIncrementalSearch;
// Language
QString m_language;
// Enable Mermaid.
bool m_enableMermaid;
// Enable flowchart.js.
bool m_enableFlowchart;
// Enable Mathjax.
bool m_enableMathjax;
// Enable WaveDrom.
bool m_enableWavedrom;
// Enable Graphviz.
bool m_enableGraphviz;
QString m_graphvizDot;
// Zoom factor of the QWebEngineView.
qreal m_webZoomFactor;
// Editor zoom delta.
int m_editorZoomDelta;
// Current line background color in editor.
QString m_editorCurrentLineBg;
// Current line background color in editor in Vim normal mode.
QString m_editorVimNormalBg;
// Current line background color in editor in Vim insert mode.
QString m_editorVimInsertBg;
// Current line background color in editor in Vim visual mode.
QString m_editorVimVisualBg;
// Current line background color in editor in Vim replace mode.
QString m_editorVimReplaceBg;
// Trailing space background color in editor.
QString m_editorTrailingSpaceBg;
// Foreground and background color of selected word in editor.
QString m_editorSelectedWordFg;
QString m_editorSelectedWordBg;
// Foreground and background color of searched word in editor.
QString m_editorSearchedWordFg;
QString m_editorSearchedWordBg;
// Foreground and background color of searched word under cursor in editor.
QString m_editorSearchedWordCursorFg;
QString m_editorSearchedWordCursorBg;
// Foreground and background color of incremental searched word in editor.
QString m_editorIncrementalSearchedWordFg;
QString m_editorIncrementalSearchedWordBg;
// Enable colde block syntax highlight.
bool m_enableCodeBlockHighlight;
// Preview images in edit mode.
bool m_enablePreviewImages;
// Constrain the width of image preview in edit mode.
bool m_enablePreviewImageConstraint;
// Constrain the width of image in read mode.
bool m_enableImageConstraint;
// Center image and add the alt text as caption.
bool m_enableImageCaption;
// Global default folder name to store images of all the notes.
// Each notebook can specify its custom folder.
QString m_imageFolder;
// Global default folder name to store images of all external files.
// Each file can specify its custom folder.
QString m_imageFolderExt;
// Global default folder name to store attachments of all the notes.
// Each notebook can specify its custom folder.
QString m_attachmentFolder;
// Enable trailing-space highlight.
bool m_enableTrailingSpaceHighlight;
// Enable tab highlight.
bool m_enableTabHighlight;
// Editor key mode.
KeyMode m_keyMode;
// Enable smart input method in Vim mode.
bool m_enableSmartImInVimMode;
// Editor line number mode.
int m_editorLineNumber;
// The background color of the line number area.
QString m_editorLineNumberBg;
// The foreground color of the line number area.
QString m_editorLineNumberFg;
// Shortcuts config.
// Operation -> KeySequence.
QHash<QString, QString> m_shortcuts;
// Shortcuts config in Captain mode.
// Operation -> KeySequence.
QHash<QString, QString> m_captainShortcuts;
// Whether minimize to system tray icon when closing the app.
// -1: uninitialized;
// 0: do not minimize to the tay;
// 1: minimize to the tray.
int m_minimizeToSystemTray;
// Suffixes of different doc type.
// [DocType] -> { Suffixes }.
QHash<int, QList<QString>> m_docSuffixes;
// Interval for PegMarkdownHighlighter highlight timer (milliseconds).
int m_markdownHighlightInterval;
// Line distance height in pixel.
int m_lineDistanceHeight;
// Whether insert the note name as a title when creating a new note.
bool m_insertTitleFromNoteName;
// Default mode when opening a note.
OpenFileMode m_noteOpenMode;
// Whether auto genearte heading sequence.
HeadingSequenceType m_headingSequenceType;
// Heading sequence base level.
int m_headingSequenceBaseLevel;
// The column to style in code block.
int m_colorColumn;
// Whether display line number of code block in read mode.
bool m_enableCodeBlockLineNumber;
// The background color of the color column.
QString m_editorColorColumnBg;
// The foreground color of the color column.
QString m_editorColorColumnFg;
// The foreground color of the preview image line.
QString m_editorPreviewImageLineFg;
// The forced background color of the preview image. Can be empty.
QString m_editorPreviewImageBg;
// Icon size of tool bar in pixels.
int m_toolBarIconSize;
// Markdown-it option.
MarkdownitOption m_markdownItOpt;
// Default name of the recycle bin folder of notebook.
QString m_recycleBinFolder;
// Default name of the recycle bin folder of external files.
QString m_recycleBinFolderExt;
// Confirm before deleting unused images.
bool m_confirmImagesCleanUp;
// Confirm before reloading folder from disk.
bool m_confirmReloadFolder;
// Location and configuration for Mathjax.
QString m_mathjaxJavascript;
// Whether double click on a tab to close it.
bool m_doubleClickCloseTab;
// Whether middle click on a tab to close it.
bool m_middleClickCloseTab;
// Type of the pages to open on startup.
StartupPageType m_startupPageType;
// File paths to open on startup.
QStringList m_startupPages;
// Timer interval to check file in milliseconds.