summaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-01-27 22:08:13 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit45ef87954669c765cb7b317384066c6eb88dc5d3 (patch)
treef8ef494e7d440e04a9b1d138e5c6816dc4834f88 /core/subsurface-qt
parent9e603cbe2bbcae1822859b284c39dd804bf321fb (diff)
downloadsubsurface-45ef87954669c765cb7b317384066c6eb88dc5d3.tar.gz
Undo: update notes field if changed by undo commands
To keep the UI in a consistent state, update the notes field if it is changed by an undo command. To that purpose, add a new signal to diveListNotifier with a list of dives and a field-id as payload. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/subsurface-qt')
-rw-r--r--core/subsurface-qt/DiveListNotifier.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h
index 40343791f..5051bf73a 100644
--- a/core/subsurface-qt/DiveListNotifier.h
+++ b/core/subsurface-qt/DiveListNotifier.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-// The DiveListNotifier emits signals when the dive-list changes (dives/trips created/deleted/moved)
+// The DiveListNotifier emits signals when the dive-list changes (dives/trips created/deleted/moved/edited)
// Note that vectors are passed by reference, so this will only work for signals inside the UI thread!
#ifndef DIVELISTNOTIFIER_H
@@ -10,6 +10,23 @@
#include <QObject>
+// Dive fields that can be edited.
+// Use "enum class" to not polute the global name space.
+enum class DiveField {
+ DATETIME,
+ AIR_TEMP,
+ WATER_TEMP,
+ LOCATION,
+ DIVEMASTER,
+ BUDDY,
+ RATING,
+ VISIBILITY,
+ SUIT,
+ TAGS,
+ MODE,
+ NOTES,
+};
+
class DiveListNotifier : public QObject {
Q_OBJECT
signals:
@@ -49,6 +66,9 @@ signals:
void diveSiteDeleted(dive_site *ds, int idx);
void diveSiteDiveCountChanged(dive_site *ds);
void diveSiteChanged(dive_site *ds, int field); // field according to LocationInformationModel
+
+ // Signals emitted when dives are edited.
+ void divesEdited(const QVector<dive *> &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
@@ -60,7 +80,7 @@ public:
bool inCommand() const;
// The following class and function are used by divelist-modifying commands
- // to signalize that are in-flight. If the returned object goes out of scope,
+ // to signal that they are in-flight. If the returned object goes out of scope,
// the command-in-flight status is reset to its previous value. Thus, the
// function can be called recursively.
class InCommandMarker {