Undo: make undo-system dive site-aware

As opposed to dive trips, dive sites were always directly added
to the global table, even on import. Instead, parse the divesites
into a distinct table and merge them on import.

Currently, this does not do any merging of dive sites, i.e. dive
sites are considered as either equal or different. Nevertheless,
merging of data should be rather easy to implement and simply
follow the code of the dive merging.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-03 15:12:22 +01:00 committed by Dirk Hohndel
parent 37146c5742
commit 82af1b2377
22 changed files with 269 additions and 114 deletions

View file

@ -758,15 +758,17 @@ extern void average_max_depth(struct diveplan *dive, int *avg_depth, int *max_de
#ifdef __cplusplus
}
/* Make pointers to dive, dive_trip and dive_table "Qt metatypes" so that they can
* be passed through QVariants and through QML.
/* Make pointers to dive, dive_trip, dive_table, trip_table and dive_site_table
* "Qt metatypes" so that they can be passed through QVariants and through QML.
* Note: we have to use the typedef "dive_table_t" instead of "struct dive_table",
* because MOC removes the "struct", but dive_table is already the name of a global
* variable, leading to compilation errors. Likewise for "struct trip_table". */
* variable, leading to compilation errors. Likewise for "struct trip_table" and
* "struct dive_site_table". */
Q_DECLARE_METATYPE(struct dive *);
Q_DECLARE_METATYPE(struct dive_trip *);
Q_DECLARE_METATYPE(dive_table_t *);
Q_DECLARE_METATYPE(trip_table_t *);
Q_DECLARE_METATYPE(dive_site_table_t *);
#endif