From cddd5942f8accaa612d8e107b45c1bf3d47a5c95 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 11 Feb 2019 15:34:43 +0100 Subject: Undo: update dive list after edit command The dive list was not updated automatically when an edit command was executed. There was already a signal to do that, viz. divesChanged(). But that signal worked by-trip and didn't have a dive-field specifier. The edit-commands used the divesEdited() signal that isn't by-trip but has a dive-field specifier. Unify these two signals to be by-trip and with dive-field specifier. This needs common code to generate the by-trip list that is moved to a command_private.h header. Since there might now be multiple signals (one per trip) actually check in the main-tab whether the current trip is affected to avoid multiple update of fields. This has the positive(?) effect of not doing any update if the current dive isn't changed. Signed-off-by: Berthold Stoeger --- core/subsurface-qt/DiveListNotifier.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'core/subsurface-qt/DiveListNotifier.h') diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h index d9ef4152b..53009410e 100644 --- a/core/subsurface-qt/DiveListNotifier.h +++ b/core/subsurface-qt/DiveListNotifier.h @@ -13,6 +13,7 @@ // Dive fields that can be edited. // Use "enum class" to not polute the global name space. enum class DiveField { + NR, DATETIME, DEPTH, DURATION, @@ -46,7 +47,7 @@ signals: // - The "trip" arguments are null for top-level-dives. void divesAdded(dive_trip *trip, bool addTrip, const QVector &dives); void divesDeleted(dive_trip *trip, bool deleteTrip, const QVector &dives); - void divesChanged(dive_trip *trip, const QVector &dives); + void divesChanged(dive_trip *trip, const QVector &dives, DiveField field); void divesMovedBetweenTrips(dive_trip *from, dive_trip *to, bool deleteFrom, bool createTo, const QVector &dives); void divesTimeChanged(dive_trip *trip, timestamp_t delta, const QVector &dives); @@ -69,9 +70,6 @@ signals: 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); public: // Desktop uses the QTreeView class to present the list of dives. The layout // of this class gives us a very fundamental problem, as we can not easily -- cgit v1.2.3-70-g09d2