From 6f574c53a38ad848bfd364acb0ae16680c3f6c8a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 20 Mar 2019 21:46:58 +0100 Subject: Undo: implement undo of dive site editing This one is a bit more tricky. There are two modes: set dive site and set newly created dive site. This is realized using an OO model with derived classed. Quite convoluted - but it seems to work. Moreover, editing a dive site is not simply setting a value, but the list of dives in a dive site has to be kept up to date. Finally, we have to inform the dive site list of the changed number of dives. Therefore add a new signal diveSiteDivesChanged. To send only one signal per dive site, hook into the undo() and redo() functions and call the functions of the base class there. Signed-off-by: Berthold Stoeger --- core/subsurface-qt/DiveListNotifier.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h index 5051bf73a..10cc4bb4d 100644 --- a/core/subsurface-qt/DiveListNotifier.h +++ b/core/subsurface-qt/DiveListNotifier.h @@ -16,7 +16,7 @@ enum class DiveField { DATETIME, AIR_TEMP, WATER_TEMP, - LOCATION, + DIVESITE, DIVEMASTER, BUDDY, RATING, @@ -66,6 +66,7 @@ signals: void diveSiteDeleted(dive_site *ds, int idx); void diveSiteDiveCountChanged(dive_site *ds); void diveSiteChanged(dive_site *ds, int field); // field according to LocationInformationModel + void diveSiteDivesChanged(dive_site *ds); // The dives associated with that site changed // Signals emitted when dives are edited. void divesEdited(const QVector &dives, DiveField); -- cgit v1.2.3-70-g09d2