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
timeserieseditordialog.h
Go to the documentation of this file.
1
33#ifndef OPENSWMMVIS_UI_DIALOGS_TIMESERIESEDITORDIALOG_H
34#define OPENSWMMVIS_UI_DIALOGS_TIMESERIESEDITORDIALOG_H
35
36#include <QDialog>
37#include <QPointer>
38#include <QVector>
39
40class QAction;
41class QCheckBox;
42class QCloseEvent;
43class QComboBox;
44class QDateTimeEdit;
45class QDoubleSpinBox;
46class QFrame;
47class QLabel;
48class QLineEdit;
49class QListView;
50class QPushButton;
51class QRadioButton;
52class QSortFilterProxyModel;
53class QSplitter;
54class QToolButton;
55class QStatusBar;
56class QTableView;
57class QToolBar;
58class QUndoStack;
59
61class TimeseriesProvider;
62class TimeseriesRegistry;
63}
64
65namespace openswmmvis::ui {
66
67class TimeseriesEditChartView;
68class TimeseriesListModel;
69class TimeseriesTableModel;
70class ChartAxisFormatController;
71
72class TimeseriesEditorDialog : public QDialog
73{
74 Q_OBJECT
75public:
80 enum class Mode { Edit, CreateNew };
81 Q_ENUM(Mode)
82
83
92 QUndoStack *undoStack,
93 openswmmvis::timeseries::TimeseriesProvider *initialSelection = nullptr,
94 QWidget *parent = nullptr);
95
97
109 QUndoStack *undoStack,
110 QWidget *parent = nullptr);
111
121 QUndoStack *undoStack,
122 const QString &initialName,
123 QWidget *parent = nullptr);
124
128 QString currentName() const;
129
131 Mode mode() const noexcept { return m_mode; }
132
134 TimeseriesTableModel *tableModel() const noexcept { return m_tableModel; }
135
137 TimeseriesEditChartView *chartView() const noexcept { return m_chartView; }
138
139 // ── CreateNew-mode introspection (exposed for tests) ────────────────────
140
142 QString pendingName() const;
143
145 bool isCreateEnabled() const;
146
148 void submitCreateNew();
149
155 void setProjectAnchor(const QString &dir);
156 [[nodiscard]] QString projectAnchor() const { return m_projectAnchor; }
157
166 int linkExternalFile(const QString &path, const QString &columnSelector = QString());
167
168protected:
172 void closeEvent(QCloseEvent *e) override;
173
174private slots:
175 void onSelectModeTriggered_();
176 void onPanModeTriggered_();
177 void onZoomInModeTriggered_();
178 void onZoomOutModeTriggered_();
179 void onEditModeTriggered_();
180 void onSnapToggled_(bool on);
181 void onMutationRejected_(const QString &reason);
182 void onProviderPointsChanged_();
183 void onProviderPointsInserted_();
184 void onProviderPointsRemoved_();
185 void onCreateNewNameChanged_(const QString &text);
186 void onCreateNewSubmit_();
187
188 // ── Row editing (Phase 6.7.3.4-followup) ────────────────────────────────
189 void onAddRowTriggered_();
190 void onDeleteRowsTriggered_();
191 void onCopyRowsTriggered_();
192 void onPasteRowsTriggered_();
193 void onGridContextMenu_(const QPoint &posInViewport);
194
195 // ── Source-mode card (Phase 6.7.3.6) ────────────────────────────────────
196 void onSourceModeRadioToggled_();
197 void onBrowseExternalFile_();
198 void onColumnSelectorChanged_(int index);
199 void onReloadExternalFile_();
200 void onDetachToInline_();
201 void onTimeModeComboChanged_(int index);
202
203 // ── Transform panel (Phase 6.7.3.5 follow-up) ───────────────────────────
204 void onApplyRotateClicked_();
205 void onApplyScaleClicked_();
206 void onChartEditModeChanged_();
207
208 // ── List pane CRUD (Phase 6.7.3-CRUD) ───────────────────────────────────
209 void onListSelectionChanged_();
210 void onListFilterChanged_(const QString &text);
211 void onNewSeriesClicked_();
212 void onDeleteSeriesClicked_();
213 void onRenameSeriesClicked_();
214
215private:
216 void buildUi_(const QVector<openswmmvis::timeseries::TimeseriesProvider *> &providers);
217 void wireProviderSignals_();
218 void updateStatusBar_();
219 void buildCreateCard_();
220 void bindNewProvider_(openswmmvis::timeseries::TimeseriesProvider *p);
221
222 // ── List pane CRUD (Phase 6.7.3-CRUD) ───────────────────────────────────
223 void buildListPane_();
226 void rebindActiveProvider_(openswmmvis::timeseries::TimeseriesProvider *p);
227
228 // ── Source-mode card helpers ────────────────────────────────────────────
229 void buildSourceModeCard_();
230 void refreshSourceModeCardForProvider_();
234 void refreshTimeModeRow_();
243 void populateColumnCombo_(const QStringList &headers,
244 const QString &columnSelector,
245 bool fabricatedHeaders = false);
246
247 // ── Transform-panel helpers (Phase 6.7.3.5 follow-up) ───────────────────
248 void buildTransformPanel_();
258 int loadExternalFileIntoProvider_(openswmmvis::timeseries::TimeseriesProvider *p,
259 const QString &path,
260 const QString &columnSelector,
261 QStringList *columnHeadersOut = nullptr,
262 QString *errorOut = nullptr,
263 bool *fabricatedOut = nullptr);
264
265 QVector<QPointer<openswmmvis::timeseries::TimeseriesProvider>> m_providers;
266 QUndoStack *m_undoStack = nullptr;
267 QPointer<openswmmvis::timeseries::TimeseriesRegistry> m_registry;
268 Mode m_mode = Mode::Edit;
269
270 QSplitter *m_splitter = nullptr;
271 QTableView *m_table = nullptr;
272 TimeseriesTableModel *m_tableModel = nullptr;
273 TimeseriesEditChartView *m_chartView = nullptr;
274 ChartAxisFormatController *m_axisFmt = nullptr;
275 QToolBar *m_toolbar = nullptr;
276 QStatusBar *m_status = nullptr;
277 QLabel *m_countLabel = nullptr;
278 QLabel *m_rangeLabel = nullptr;
279 // Guards to break the chart<->table selection feedback loop.
280 bool m_suppressTableSelectionSync_ts = false;
281 bool m_suppressChartSelectionSync_ts = false;
282
283 // ── List pane CRUD (Phase 6.7.3-CRUD) ───────────────────────────────────
284 QWidget *m_listPane = nullptr;
285 QSortFilterProxyModel *m_listProxy = nullptr;
286 QListView *m_listView = nullptr;
287 QLineEdit *m_listFilterEdit = nullptr;
288 QToolButton *m_listNewBtn = nullptr;
289 QToolButton *m_listDeleteBtn = nullptr;
290 QToolButton *m_listRenameBtn = nullptr;
291 openswmmvis::ui::TimeseriesListModel *m_listModel = nullptr;
292
293 // ── CreateNew-mode UI (null in Edit mode) ───────────────────────────────
294 QFrame *m_createCard = nullptr;
295 QLineEdit *m_nameEdit = nullptr;
296 QLabel *m_nameValidationLabel = nullptr;
297 QComboBox *m_sourceModeCombo = nullptr;
298 QPushButton *m_createBtn = nullptr;
299
300 QAction *m_actSelect = nullptr;
301 QAction *m_actPan = nullptr;
302 QAction *m_actZoomIn = nullptr;
303 QAction *m_actZoomOut = nullptr;
304 QAction *m_actZoomExt = nullptr;
305 QAction *m_actEdit = nullptr;
306 QAction *m_actRotate = nullptr;
307 QAction *m_actScale = nullptr;
308 QAction *m_actSnap = nullptr;
309 QAction *m_actUndo = nullptr;
310 QAction *m_actRedo = nullptr;
311
312 // Row-editing actions (Phase 6.7.3.4-followup — Add/Delete/Copy/Paste).
313 QAction *m_actAddRow = nullptr;
314 QAction *m_actDeleteRow = nullptr;
315 QAction *m_actCopy = nullptr;
316 QAction *m_actPaste = nullptr;
317
318 // ── Source-mode card (Phase 6.7.3.6) ────────────────────────────────────
319 QFrame *m_sourceCard = nullptr;
320 QRadioButton *m_radioInline = nullptr;
321 QRadioButton *m_radioExternal = nullptr;
322 QRadioButton *m_radioGeopackage = nullptr;
323 QLineEdit *m_extPathEdit = nullptr;
324 QPushButton *m_extBrowseBtn = nullptr;
325 QString m_projectAnchor;
326 QComboBox *m_extColumnCombo = nullptr;
327 bool m_extHeadersFabricated = false;
328 QLabel *m_extStatusLabel = nullptr;
329 QPushButton *m_extReloadBtn = nullptr;
330 QPushButton *m_extDetachBtn = nullptr;
331 QLabel *m_gpkgPlaceholderLbl = nullptr;
332 QComboBox *m_timeModeCombo = nullptr;
333 QLabel *m_timeModeBadge = nullptr;
334
335 // ── Transform panel (Phase 6.7.3.5 follow-up) ───────────────────────────
336 QFrame *m_transformPanel = nullptr;
337 QFrame *m_rotateGroup = nullptr;
338 QFrame *m_scaleGroup = nullptr;
339 QDateTimeEdit *m_rotatePivotTimeEdit = nullptr;
340 QDoubleSpinBox *m_rotatePivotValueEdit = nullptr;
341 QDoubleSpinBox *m_rotateAngleEdit = nullptr;
342 QCheckBox *m_rotateUseCentroid = nullptr;
343 QPushButton *m_rotateApplyBtn = nullptr;
344 QDateTimeEdit *m_scaleAnchorTimeEdit = nullptr;
345 QDoubleSpinBox *m_scaleAnchorValueEdit = nullptr;
346 QDoubleSpinBox *m_scaleXEdit = nullptr;
347 QDoubleSpinBox *m_scaleYEdit = nullptr;
348 QCheckBox *m_scaleUseCentroid = nullptr;
349 QPushButton *m_scaleApplyBtn = nullptr;
350};
351
352} // namespace openswmmvis::ui
353
354#endif // OPENSWMMVIS_UI_DIALOGS_TIMESERIESEDITORDIALOG_H
Definition timeseriesprovider.h:43
Definition timeseriesregistry.h:35
Definition chartaxisformatcontroller.h:37
Definition timeserieseditchartview.h:58
Definition timeserieseditordialog.h:73
TimeseriesTableModel * tableModel() const noexcept
The grid model. Exposed for tests.
Definition timeserieseditordialog.h:134
QString pendingName() const
Text in the create-card name field, or empty in Edit mode.
Definition timeserieseditordialog.cpp:354
TimeseriesEditChartView * chartView() const noexcept
The chart view. Exposed for tests.
Definition timeserieseditordialog.h:137
bool isCreateEnabled() const
True iff the Create button is currently enabled.
Definition timeserieseditordialog.cpp:359
int linkExternalFile(const QString &path, const QString &columnSelector=QString())
Bind the editor's first provider to an external file (CSV/TSV/.dat). Flips source mode to ExternalFil...
Definition timeserieseditordialog.cpp:1444
QString currentName() const
Name of the first provider currently bound to the dialog. Empty before a CreateNew commits....
Definition timeserieseditordialog.cpp:219
Mode mode() const noexcept
Current mode.
Definition timeserieseditordialog.h:131
QString projectAnchor() const
Definition timeserieseditordialog.h:156
void submitCreateNew()
Programmatically click the create-card's Create button (test hook).
Definition timeserieseditordialog.cpp:364
static TimeseriesEditorDialog * createNew(openswmmvis::timeseries::TimeseriesRegistry *registry, QUndoStack *undoStack, QWidget *parent=nullptr)
Slice BM.0-Add-New factory: build the dialog in CreateNew mode on top of a registry....
Definition timeserieseditordialog.cpp:172
static QString pickTimeseries(openswmmvis::timeseries::TimeseriesRegistry *registry, QUndoStack *undoStack, const QString &initialName, QWidget *parent=nullptr)
Modal pick / create / edit entry point for callers that round-trip a time series selection inline (e....
Definition timeserieseditordialog.cpp:185
void closeEvent(QCloseEvent *e) override
Step F + Step E.2 — dispose any ExternalFile-mode point cache on the way out so the registry doesn't ...
Definition timeserieseditordialog.cpp:156
void setProjectAnchor(const QString &dir)
Slice IO-11d — set the directory used to display external-file paths in relative form....
Definition timeserieseditordialog.cpp:226
Mode
Editing mode. Edit is the default — the dialog is bound to one or more existing providers....
Definition timeserieseditordialog.h:80
Definition timeserieslistmodel.h:44
Definition timeseriestablemodel.h:48
int e
Definition inpmeshreader.cpp:41
ArrowPlacement p
Definition linesymbollayer.cpp:27
int index
Position in m_quadRegions / m_quadReports.
Definition meshgenerator.cpp:153
Definition timeseriesprovider.h:34
Definition openswmmvislayer.h:43
int path
Definition pslgminsize.cpp:234
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
QString text
Definition queryparser.cpp:35