diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-11-26 23:39:37 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-01-09 20:58:04 -0800 |
commit | ec37c71f5eeb7d4b0c4b8719b52583fadb0b8f4c (patch) | |
tree | b1af183d2fb5c827e940591b90547390eb70c31b /desktop-widgets/command_divelist.cpp | |
parent | 7df8d8c888cb8e1cdb12a171a4715c8f5af7c80d (diff) | |
download | subsurface-ec37c71f5eeb7d4b0c4b8719b52583fadb0b8f4c.tar.gz |
Core: add trip_table parameter to trip-functions
Currently trips are added to the global trip table. If we want to
make dive-import undoable, we should be able to parse trips of a
log-file into a distinct table. Therefore, add a trip_table
parameter to
- insert_trip()
- create_and_hookup_trip_from_dive()
- autogroup_dives()
- unregister_trip()
- remove_dive_from_trip()
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/command_divelist.cpp')
-rw-r--r-- | desktop-widgets/command_divelist.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp index c00935912..c8ec5d082 100644 --- a/desktop-widgets/command_divelist.cpp +++ b/desktop-widgets/command_divelist.cpp @@ -68,7 +68,7 @@ DiveToAdd DiveListBase::removeDive(struct dive *d, std::vector<OwningTripPtr> &t // remove the whole trip. res.trip = unregister_dive_from_trip(d); if (res.trip && res.trip->dives.nr == 0) { - unregister_trip(res.trip); // Remove trip from backend + unregister_trip(res.trip, &trip_table); // Remove trip from backend tripsToAdd.emplace_back(res.trip); // Take ownership of trip } @@ -164,7 +164,7 @@ std::vector<dive *> DiveListBase::addDives(DivesAndTripsToAdd &toAdd) addedTrips.reserve(toAdd.trips.size()); for (OwningTripPtr &trip: toAdd.trips) { addedTrips.push_back(trip.get()); - insert_trip(trip.release()); // Return ownership to backend + insert_trip(trip.release(), &trip_table); // Return ownership to backend } toAdd.trips.clear(); @@ -229,7 +229,7 @@ static OwningTripPtr moveDiveToTrip(DiveToTrip &diveToTrip) // Remove dive from trip - if this is the last dive in the trip, remove the whole trip. dive_trip *trip = unregister_dive_from_trip(diveToTrip.dive); if (trip && trip->dives.nr == 0) { - unregister_trip(trip); // Remove trip from backend + unregister_trip(trip, &trip_table); // Remove trip from backend res.reset(trip); } @@ -257,7 +257,7 @@ static void moveDivesBetweenTrips(DivesToTrip &dives) for (OwningTripPtr &trip: dives.tripsToAdd) { dive_trip *t = trip.release(); // Give up ownership createdTrips.push_back(t); - insert_trip(t); // Return ownership to backend + insert_trip(t, &trip_table); // Return ownership to backend } dives.tripsToAdd.clear(); |