vsettingsdialog.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #ifndef VSETTINGSDIALOG_H
  2. #define VSETTINGSDIALOG_H
  3. #include <QDialog>
  4. #include <QVector>
  5. #include <QString>
  6. class QDialogButtonBox;
  7. class QComboBox;
  8. class QGroupBox;
  9. class QDoubleSpinBox;
  10. class QCheckBox;
  11. class QLineEdit;
  12. class QStackedLayout;
  13. class QListWidget;
  14. class QPlainTextEdit;
  15. class QVBoxLayout;
  16. class VGeneralTab : public QWidget
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit VGeneralTab(QWidget *p_parent = 0);
  21. bool loadConfiguration();
  22. bool saveConfiguration();
  23. private:
  24. QLayout *setupStartupPagesLayout();
  25. bool loadLanguage();
  26. bool saveLanguage();
  27. bool loadSystemTray();
  28. bool saveSystemTray();
  29. bool loadStartupPageType();
  30. bool saveStartupPageType();
  31. // Language
  32. QComboBox *m_langCombo;
  33. // System tray
  34. QCheckBox *m_systemTray;
  35. // Startup page type.
  36. QComboBox *m_startupPageTypeCombo;
  37. // Startup pages.
  38. QPlainTextEdit *m_startupPagesEdit;
  39. // Startup pages add files button.
  40. QPushButton *m_startupPagesAddBtn;
  41. static const QVector<QString> c_availableLangs;
  42. };
  43. class VReadEditTab : public QWidget
  44. {
  45. Q_OBJECT
  46. public:
  47. explicit VReadEditTab(QWidget *p_parent = 0);
  48. bool loadConfiguration();
  49. bool saveConfiguration();
  50. QGroupBox *m_readBox;
  51. QGroupBox *m_editBox;
  52. };
  53. class VNoteManagementTab : public QWidget
  54. {
  55. Q_OBJECT
  56. public:
  57. explicit VNoteManagementTab(QWidget *p_parent = 0);
  58. bool loadConfiguration();
  59. bool saveConfiguration();
  60. QGroupBox *m_noteBox;
  61. QGroupBox *m_externalBox;
  62. // Image folder.
  63. QCheckBox *m_customImageFolder;
  64. QLineEdit *m_imageFolderEdit;
  65. // Image folder of External File.
  66. QCheckBox *m_customImageFolderExt;
  67. QLineEdit *m_imageFolderEditExt;
  68. // Attachment folder.
  69. QCheckBox *m_customAttachmentFolder;
  70. QLineEdit *m_attachmentFolderEdit;
  71. private slots:
  72. void customImageFolderChanged(int p_state);
  73. void customImageFolderExtChanged(int p_state);
  74. void customAttachmentFolderChanged(int p_state);
  75. private:
  76. bool loadImageFolder();
  77. bool saveImageFolder();
  78. bool loadImageFolderExt();
  79. bool saveImageFolderExt();
  80. bool loadAttachmentFolder();
  81. bool saveAttachmentFolder();
  82. };
  83. class VMarkdownTab : public QWidget
  84. {
  85. Q_OBJECT
  86. public:
  87. explicit VMarkdownTab(QWidget *p_parent = 0);
  88. bool loadConfiguration();
  89. bool saveConfiguration();
  90. // Default note open mode for markdown.
  91. QComboBox *m_openModeCombo;
  92. // Whether enable heading sequence.
  93. QComboBox *m_headingSequenceTypeCombo;
  94. QComboBox *m_headingSequenceLevelCombo;
  95. // Web zoom factor.
  96. QCheckBox *m_customWebZoom;
  97. QDoubleSpinBox *m_webZoomFactorSpin;
  98. // Color column in code block.
  99. QLineEdit *m_colorColumnEdit;
  100. private:
  101. bool loadOpenMode();
  102. bool saveOpenMode();
  103. bool loadHeadingSequence();
  104. bool saveHeadingSequence();
  105. bool loadWebZoomFactor();
  106. bool saveWebZoomFactor();
  107. bool loadColorColumn();
  108. bool saveColorColumn();
  109. };
  110. class VSettingsDialog : public QDialog
  111. {
  112. Q_OBJECT
  113. public:
  114. explicit VSettingsDialog(QWidget *p_parent = 0);
  115. private slots:
  116. void saveConfiguration();
  117. private:
  118. void loadConfiguration();
  119. void addTab(QWidget *p_widget, const QString &p_label);
  120. QStackedLayout *m_tabs;
  121. QListWidget *m_tabList;
  122. QDialogButtonBox *m_btnBox;
  123. };
  124. #endif // VSETTINGSDIALOG_H