SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
preferencesdialog.h
Go to the documentation of this file.
1
14#ifndef PREFERENCESDIALOG_H
15#define PREFERENCESDIALOG_H
16
17#include <QDialog>
18
19#include <QColor>
20#include <QFont>
21
23
24class QCheckBox;
25class QComboBox;
26class QDoubleSpinBox;
27class QLineEdit;
28class QListWidget;
29class QPushButton;
30class QRadioButton;
31class QSpinBox;
32class QStackedWidget;
33class QVBoxLayout;
34
39class QPropertyModel;
40
41class PreferencesDialog : public QDialog
42{
43 Q_OBJECT
44
45public:
46 explicit PreferencesDialog(QWidget *parent = nullptr);
47 ~PreferencesDialog() override = default;
48
51 void openAtCategory(const QString &label);
52
53private slots:
54 void onApply();
55 void onAccept();
56 void onResetToDefaults();
57
58private:
59 void buildUi();
60 void readFromManager();
61 void writeToManager();
62 void applyTwoDDefaultsToWidgets(
64
65 QWidget *buildGeneralPage();
66 QWidget *buildSelectionPage();
67 QWidget *buildCanvasPage();
68 QWidget *buildRenderingPage();
69 QWidget *buildSimulationPage();
75 QWidget *buildSimulationDefaultsPage();
76 void addDynamicWaveDefaultGroups(QVBoxLayout *stepsLay,
77 QVBoxLayout *solverLay);
78 void addTwoDDefaultGroups(QVBoxLayout *lay, QVBoxLayout *cplLay,
79 QVBoxLayout *meshLay);
80 QWidget *buildObjectDefaultsPage();
81 QWidget *buildMapDisplayPage();
82 QWidget *buildMeasureToolPage();
83 QWidget *buildPlotsPage();
84 QWidget *buildNamingPage();
85 QWidget *buildAppearancePage();
86 QWidget *buildKeyboardPage();
87
88 QListWidget *m_categoryList = nullptr;
89 QStackedWidget *m_pages = nullptr;
90
91 // Object Defaults page is self-contained (see objectdefaultspage.h);
92 // the dialog only forwards load/apply/reset.
93 class ObjectDefaultsPage *m_objectDefaultsPage = nullptr;
94
95 // Appearance
96 QRadioButton *m_appearanceSystemRadio = nullptr;
97 QRadioButton *m_appearanceLightRadio = nullptr;
98 QRadioButton *m_appearanceDarkRadio = nullptr;
99
100 // General
101 QCheckBox *m_showLicenseOnStartupBox = nullptr;
102 QCheckBox *m_autoLengthBox = nullptr;
103 QComboBox *m_defaultEngineCombo = nullptr;
104 QSpinBox *m_profileMaxPathsSpin = nullptr;
105 QSpinBox *m_profileHaloRadiusSpin = nullptr;
106 QPushButton *m_profileStartColorBtn = nullptr;
107 QColor m_pendingProfileStartColor;
108 QDoubleSpinBox *m_profileStartWidthSpin = nullptr;
109 QPushButton *m_profileEndColorBtn = nullptr;
110 QColor m_pendingProfileEndColor;
111 QDoubleSpinBox *m_profileEndWidthSpin = nullptr;
112
113 // Selection
114 QSpinBox *m_clickTolerancePxSpin = nullptr;
115 QSpinBox *m_dragThresholdPxSpin = nullptr;
116 QCheckBox *m_clearOnMissBox = nullptr;
117 // Per-class pens + brushes are edited through a QPropertyModel-
118 // backed QTreeView. Edits route through SelectionRenderingPrefs's
119 // setters directly into PreferencesManager, so writeToManager()
120 // leaves them alone.
121 SelectionRenderingPrefs *m_selectionPrefs = nullptr;
122
123 // 2D mesh BC edge defaults — same QPropertyModel treatment as the
124 // selection pens above.
125 MeshBcRenderingPrefs *m_meshBcPrefs = nullptr;
126 QPropertyModel *m_meshBcModel = nullptr;
127 QPropertyModel *m_selectionModel = nullptr;
128
129 // Canvas
130 QComboBox *m_defaultToolCombo = nullptr;
131 QRadioButton *m_crsAutoRadio = nullptr;
132 QRadioButton *m_crsCustomRadio = nullptr;
133 QLineEdit *m_crsAuthorityEdit = nullptr;
134 QSpinBox *m_crsCodeSpin = nullptr;
135
136 // Snapping
137 QCheckBox *m_snapEnabledBox = nullptr;
138 QSpinBox *m_snapToleranceSpin = nullptr;
139 QCheckBox *m_snapToVerticesBox = nullptr;
140
141 // Rendering — link pens are edited through a QPropertyModel-backed
142 // QTreeView so colour, width, cap, join and dash are all exposed
143 // by QPenPropertyItem's standard expandable children. Edits route
144 // through LinkRenderingPrefs's Q_PROPERTY setters straight into
145 // PreferencesManager::setLinkPen(), so there is no pending-state
146 // to apply on OK and writeToManager() leaves them alone.
147 QDoubleSpinBox *m_labelLodSpin = nullptr;
148 LinkRenderingPrefs *m_linkPrefs = nullptr;
149 QPropertyModel *m_linkPenModel = nullptr;
150 // Node symbols — same QPropertyModel pattern as link pens. The bridge
151 // exposes pen, fill brush, and size per node type so QPenPropertyItem
152 // and QBrushPropertyItem handle every sub-attribute (colour / width /
153 // dash / cap / join / brush style), and a plain double row drives the
154 // marker diameter.
155 NodeRenderingPrefs *m_nodePrefs = nullptr;
156 QPropertyModel *m_nodeStyleModel = nullptr;
157 QCheckBox *m_qsgNodesBox = nullptr;
158 QCheckBox *m_qsgMeshBox = nullptr;
159
160 // Simulation
161 QSpinBox *m_progressTickMsSpin = nullptr;
162 QSpinBox *m_live2DHistoryCapSpin = nullptr;
163 QSpinBox *m_live2DHistoryMBSpin = nullptr;
164
165 // Simulation Defaults (applied to fresh blank projects).
166 QComboBox *m_simFlowUnitsCombo = nullptr;
167 QComboBox *m_simInfiltrationCombo = nullptr;
168 QComboBox *m_simFlowRoutingCombo = nullptr;
169 QCheckBox *m_simIgnoreRainfallBox = nullptr;
170 QCheckBox *m_simIgnoreRdiiBox = nullptr;
171 QCheckBox *m_simIgnoreSnowmeltBox = nullptr;
172 QCheckBox *m_simIgnoreGroundwaterBox = nullptr;
173 QCheckBox *m_simIgnoreQualityBox = nullptr;
174 QCheckBox *m_simIgnoreRoutingBox = nullptr;
175 QCheckBox *m_simModule2DBox = nullptr;
176 QCheckBox *m_simAllowPondingBox = nullptr;
177 QCheckBox *m_simSkipSteadyStateBox = nullptr;
178 QDoubleSpinBox *m_simMinSlopePctSpin = nullptr;
179 QDoubleSpinBox *m_simDryDaysSpin = nullptr;
180 QSpinBox *m_simReportStepSpin = nullptr; // minutes
181 QSpinBox *m_simDryStepSpin = nullptr; // minutes
182 QSpinBox *m_simWetStepSpin = nullptr; // minutes
183 QSpinBox *m_simRuleStepSpin = nullptr; // seconds
184 QDoubleSpinBox *m_simRoutingStepSpin = nullptr; // seconds
185 QDoubleSpinBox *m_simSysFlowTolSpin = nullptr;
186 QDoubleSpinBox *m_simLatFlowTolSpin = nullptr;
187 QSpinBox *m_simMaxTrialsSpin = nullptr;
188
189 // Dynamic-Wave-specific defaults.
190 QComboBox *m_simInertialDampCombo = nullptr;
191 QComboBox *m_simNormalFlowCombo = nullptr;
192 QComboBox *m_simForceMainCombo = nullptr;
193 QComboBox *m_simSurchargeCombo = nullptr;
194 QCheckBox *m_simVariableStepBox = nullptr;
195 QDoubleSpinBox *m_simVariableStepFactorSpin = nullptr; // 0–1
196 QDoubleSpinBox *m_simMinRoutingStepSpin = nullptr; // seconds
197 QDoubleSpinBox *m_simLengtheningStepSpin = nullptr; // seconds
198 QDoubleSpinBox *m_simHeadToleranceSpin = nullptr;
199 QComboBox *m_simNodeContinuityCombo = nullptr;
200 QCheckBox *m_simAndersonAccelBox = nullptr;
201 QSpinBox *m_simThreadsSpin = nullptr;
202 QComboBox *m_simUnsteadyFrictionCombo = nullptr; // UNSTEADY_FRICTION
203 QDoubleSpinBox *m_simUfK3Spin = nullptr; // UF_K3 (0–0.05)
204
205 // Simulation Defaults > 2D tabs — [2D_OPTIONS] solver keys plus the
206 // mesh-generation seeds.
207 QDoubleSpinBox *m_twoDMaxTimestepSpin = nullptr; // seconds
208 QDoubleSpinBox *m_twoDThetaSpin = nullptr;
209 QDoubleSpinBox *m_twoDCflSpin = nullptr;
210 QSpinBox *m_twoDLtsTiersSpin = nullptr;
211 QDoubleSpinBox *m_twoDHMoveSpin = nullptr;
212 QDoubleSpinBox *m_twoDFroudeMaxSpin = nullptr;
213 QCheckBox *m_twoDAdvectionBox = nullptr;
214 QDoubleSpinBox *m_twoDDryDepthSpin = nullptr;
215 QDoubleSpinBox *m_twoDLimiterEpsSpin = nullptr;
216 QDoubleSpinBox *m_twoDFluxDhEpsSpin = nullptr;
217 QComboBox *m_twoDCellClosureCombo = nullptr;
218 QComboBox *m_twoDFaceReconCombo = nullptr;
219 QDoubleSpinBox *m_twoDVfrMinWetFracSpin = nullptr;
220 QDoubleSpinBox *m_twoDCouplingCdSpin = nullptr;
221 QDoubleSpinBox *m_twoDCouplingSyncSpin = nullptr;
222 QCheckBox *m_twoDCouplingAreaAutoBox = nullptr;
223 QComboBox *m_twoDRainfallModeCombo = nullptr;
224 QCheckBox *m_twoDReport2DBox = nullptr;
225 QDoubleSpinBox *m_twoDMeshMinAngleSpin = nullptr;
226 QDoubleSpinBox *m_twoDMeshMaxAreaSpin = nullptr;
227 QSpinBox *m_twoDMeshMaxSteinerSpin = nullptr;
228 QDoubleSpinBox *m_twoDMeshIdwPowerSpin = nullptr;
229 QDoubleSpinBox *m_twoDMeshSimplifyEpsSpin = nullptr;
230 QDoubleSpinBox *m_twoDMeshSnapEpsSpin = nullptr;
231 QDoubleSpinBox *m_twoDMeshFlattenRadSpin = nullptr;
232 QCheckBox *m_twoDMeshNodesBox = nullptr;
233 QCheckBox *m_twoDMeshNodesRimBox = nullptr;
234 QCheckBox *m_twoDMeshMinSepBox = nullptr;
235 QDoubleSpinBox *m_twoDMeshMinSepSpin = nullptr;
236 QCheckBox *m_twoDMeshThinningBox = nullptr;
237 QDoubleSpinBox *m_twoDMeshThinningTolSpin = nullptr;
238 QSpinBox *m_twoDMeshThinningPassesSpin = nullptr;
239 QCheckBox *m_twoDMeshMinSpacingBox = nullptr;
240 QDoubleSpinBox *m_twoDMeshMinSpacingSpin = nullptr;
241 QDoubleSpinBox *m_twoDMeshBoundaryBufSpin = nullptr;
242 QCheckBox *m_twoDMeshMaxEdgeBox = nullptr;
243 QDoubleSpinBox *m_twoDMeshMaxEdgeSpin = nullptr;
244 QDoubleSpinBox *m_twoDMeshManningsSpin = nullptr;
245 QDoubleSpinBox *m_twoDMeshInitDepthSpin = nullptr;
246 QCheckBox *m_twoDMeshOutputExternalBox = nullptr;
247
248 // Map Display / Scale Bar
249 QPushButton *m_scaleBarColorBtn = nullptr;
250 QColor m_pendingScaleBarColor;
251 QSpinBox *m_scaleBarPenWidthSpin = nullptr;
252 QComboBox *m_scaleBarPenStyleCombo = nullptr;
253 QPushButton *m_scaleBarFontBtn = nullptr;
254 QFont m_pendingScaleBarFont;
255 QComboBox *m_scaleBarUnitsCombo = nullptr;
256 QComboBox *m_scaleBarPositionCombo = nullptr;
257 QSpinBox *m_scaleBarMaxBarLengthSpin = nullptr;
258 QSpinBox *m_scaleBarLabelDecimalsSpin = nullptr; // -1..4
259 QCheckBox *m_scaleBarCompactNotationBox = nullptr;
260
261 // Measure Tool
262 QPushButton *m_measureLineColorBtn = nullptr;
263 QColor m_pendingMeasureLineColor;
264 QPushButton *m_measureLabelFontBtn = nullptr;
265 QFont m_pendingMeasureLabelFont;
266 QSpinBox *m_measureLabelDecimalsSpin = nullptr;
267 QPushButton *m_measureFillColorBtn = nullptr;
268 QColor m_pendingMeasureFillColor;
269 QSpinBox *m_measureFillOpacitySpin = nullptr;
270
271 // Plots — default numeric precision (X / Y axis)
272 // One dropdown per axis carrying an openswmmvis::plot::
273 // AxisNumberFormatPreset in each item's data. The preference itself is
274 // still stored as a mode + digit count, so no settings migration.
275 QComboBox *m_plotXFormatCombo = nullptr;
276 QComboBox *m_plotYFormatCombo = nullptr;
277
278 // Naming prefixes (one QLineEdit per element kind)
279 QLineEdit *m_prefixJunction = nullptr;
280 QLineEdit *m_prefixOutfall = nullptr;
281 QLineEdit *m_prefixStorage = nullptr;
282 QLineEdit *m_prefixDivider = nullptr;
283 QLineEdit *m_prefixConduit = nullptr;
284 QLineEdit *m_prefixPump = nullptr;
285 QLineEdit *m_prefixOrifice = nullptr;
286 QLineEdit *m_prefixWeir = nullptr;
287 QLineEdit *m_prefixOutlet = nullptr;
288 QLineEdit *m_prefixRaingage = nullptr;
289 QLineEdit *m_prefixSubcatchment = nullptr;
290};
291
292#endif // PREFERENCESDIALOG_H
Definition meshbcrenderingprefs.h:33
Definition noderenderingprefs.h:25
Definition objectdefaultspage.h:28
Definition preferencesdialog.h:42
void openAtCategory(const QString &label)
Definition preferencesdialog.cpp:1549
~PreferencesDialog() override=default
Definition selectionrenderingprefs.h:28
const char * label
Human label for the filter entry.
Definition gdaldrivers.cpp:22
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Definition preferencesmanager.h:504