mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d5691cd7cb
commit
cddd5942f8
7 changed files with 97 additions and 67 deletions
|
|
@ -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<dive *> &dives);
|
||||
void divesDeleted(dive_trip *trip, bool deleteTrip, const QVector<dive *> &dives);
|
||||
void divesChanged(dive_trip *trip, const QVector<dive *> &dives);
|
||||
void divesChanged(dive_trip *trip, const QVector<dive *> &dives, DiveField field);
|
||||
void divesMovedBetweenTrips(dive_trip *from, dive_trip *to, bool deleteFrom, bool createTo, const QVector<dive *> &dives);
|
||||
void divesTimeChanged(dive_trip *trip, timestamp_t delta, const QVector<dive *> &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<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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue