1 /* 2 configuration_dialog.h MindForger thinking notebook 3 4 Copyright (C) 2016-2020 Martin Dvorak <martin.dvorak@mindforger.com> 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License 8 as published by the Free Software Foundation; either version 2 9 of the License, or (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 #ifndef M8RUI_CONFIGURATION_DIALOG_H 20 #define M8RUI_CONFIGURATION_DIALOG_H 21 22 #include <QtWidgets> 23 24 #include "../../lib/src/config/configuration.h" 25 26 class QDialogButtonBox; 27 class QTabWidget; 28 29 namespace m8r { 30 31 class ConfigurationDialog : public QDialog 32 { 33 Q_OBJECT 34 35 class AppTab; 36 class ViewerTab; 37 class EditorTab; 38 class NavigatorTab; 39 class MindTab; 40 41 private: 42 QTabWidget* tabWidget; 43 AppTab* appTab; 44 ViewerTab* viewerTab; 45 EditorTab* editorTab; 46 NavigatorTab* navigatorTab; 47 MindTab* mindTab; 48 49 QDialogButtonBox *buttonBox; 50 51 public: 52 explicit ConfigurationDialog(QWidget* parent); 53 ConfigurationDialog(const ConfigurationDialog&) = delete; 54 ConfigurationDialog(const ConfigurationDialog&&) = delete; 55 ConfigurationDialog &operator=(const ConfigurationDialog&) = delete; 56 ConfigurationDialog &operator=(const ConfigurationDialog&&) = delete; 57 ~ConfigurationDialog(); 58 getAppTab()59 AppTab* getAppTab() { return appTab; } 60 61 void show(); 62 63 private slots: 64 void saveSlot(); 65 signals: 66 void saveConfigSignal(); 67 }; 68 69 /** 70 * @brief Mind tab. 71 */ 72 class ConfigurationDialog::MindTab : public QWidget 73 { 74 Q_OBJECT 75 76 private: 77 Configuration& config; 78 79 QCheckBox* saveReadsMetadataCheck; 80 QLabel* distributorSleepIntervalLabel; 81 QSpinBox* distributorSleepIntervalSpin; 82 83 public: 84 explicit MindTab(QWidget* parent); 85 ~MindTab(); 86 87 // there and back is handled by Dialog's access to this class & Config singleton 88 void refresh(); 89 void save(); 90 }; 91 92 /* 93 * App tab 94 */ 95 96 class ConfigurationDialog::AppTab : public QWidget 97 { 98 Q_OBJECT 99 100 private: 101 Configuration& config; 102 103 QLabel* themeLabel; 104 QComboBox* themeCombo; 105 106 QLabel* startupLabel; 107 QComboBox* startupCombo; 108 109 QCheckBox* showToolbarCheck; 110 QCheckBox* uiExpertModeCheck; 111 QCheckBox* nerdMenuCheck; 112 113 public: 114 explicit AppTab(QWidget* parent); 115 ~AppTab(); 116 117 // there and back is handled by Dialog's access to this class & Config singleton 118 void refresh(); 119 void save(); 120 }; 121 122 /** 123 * @brief Navigator tab. 124 */ 125 class ConfigurationDialog::NavigatorTab : public QWidget 126 { 127 Q_OBJECT 128 129 private: 130 Configuration& config; 131 132 QLabel* maxNodesLabel; 133 QSpinBox* maxNodesSpin; 134 135 public: 136 explicit NavigatorTab(QWidget* parent); 137 ~NavigatorTab(); 138 139 // there and back is handled by Dialog's access to this class & Config singleton 140 void refresh(); 141 void save(); 142 }; 143 144 145 /** 146 * @brief Viewer tab. 147 */ 148 class ConfigurationDialog::ViewerTab : public QWidget 149 { 150 Q_OBJECT 151 152 private: 153 Configuration& config; 154 155 QLabel* htmlCssThemeLabel; 156 QComboBox* htmlCssThemeCombo; 157 QLabel* zoomLabel; 158 QSpinBox* zoomSpin; 159 QCheckBox* mathSupportCheck; 160 QCheckBox* fullOPreviewCheck; 161 QLabel* diagramSupportLabel; 162 QComboBox* diagramSupportCombo; 163 QCheckBox* srcCodeHighlightSupportCheck; 164 165 public: 166 explicit ViewerTab(QWidget* parent); 167 ~ViewerTab(); 168 169 // there and back is handled by Dialog's access to this class & Config singleton 170 void refresh(); 171 void save(); 172 }; 173 174 /** 175 * @brief Editor tab. 176 */ 177 class ConfigurationDialog::EditorTab : public QWidget 178 { 179 Q_OBJECT 180 181 private: 182 Configuration& config; 183 184 QLabel* editorKeyBindingLabel; 185 QComboBox* editorKeyBindingCombo; 186 QLabel* editorFontLabel; 187 QPushButton* editorFontButton; 188 QCheckBox* editorMdSyntaxHighlightCheck; 189 QCheckBox* editorAutocompleteCheck; 190 QCheckBox* editorAutosaveCheck; 191 QLabel* editorTabWidthLabel; 192 QComboBox* editorTabWidthCombo; 193 // TODO QCheckBox* editorQuoteSectionsCheck; 194 QCheckBox* editorTabsAsSpacesCheck; 195 196 QFont editorFont; 197 198 public: 199 explicit EditorTab(QWidget* parent); 200 ~EditorTab(); 201 202 // there and back is handled by Dialog's access to this class & Config singleton 203 void refresh(); 204 void save(); 205 206 private slots: 207 void getFont(); 208 }; 209 210 } 211 #endif // M8RUI_CONFIGURATION_DIALOG_H 212