From d7d408a99e7459ec1a5fc2d9953e72924054b834 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 24 Feb 2019 21:22:33 +0100 Subject: Undo: implement undo of dive trip editing This is copying the dive editing code. It uses an OO design with virtual functions for getting and setting the values. It doesn't use templates though, as both fields of strig type. This feels a bit over-engineered, but it is 1) consistent with the dive edit code and 2) the number / types of dive trip fields might increase. Signed-off-by: Berthold Stoeger --- core/subsurface-qt/DiveListNotifier.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h index 46e160208..b57595aa6 100644 --- a/core/subsurface-qt/DiveListNotifier.h +++ b/core/subsurface-qt/DiveListNotifier.h @@ -10,7 +10,7 @@ #include -// Dive fields that can be edited. +// Dive and trip fields that can be edited. // Use "enum class" to not polute the global name space. enum class DiveField { NR, @@ -29,6 +29,10 @@ enum class DiveField { MODE, NOTES, }; +enum class TripField { + LOCATION, + NOTES +}; class DiveListNotifier : public QObject { Q_OBJECT @@ -54,6 +58,9 @@ signals: void cylindersReset(dive_trip *trip, const QVector &dives); void weightsystemsReset(dive_trip *trip, const QVector &dives); + // Trip edited signal + void tripChanged(dive_trip *trip, TripField field); + // Selection-signals come in two kinds: // - divesSelected, divesDeselected and currentDiveChanged are finer grained and are // called batch-wise per trip (except currentDiveChanged, of course). These signals -- cgit v1.2.3-70-g09d2