mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: inform model of dive site addition / deletion
Introduce two DiveListNotifier signals which are sent by the undo commands if dives are added to / removed from the core. The signal has the dive site and the index in the global dive site table as payload. Thus, the model has only to remove the appropriate rows. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
84f7179367
commit
59e602447b
9 changed files with 43 additions and 16 deletions
|
@ -133,8 +133,9 @@ DivesAndTripsToAdd DiveListBase::removeDives(DivesAndSitesToRemove &divesAndSite
|
|||
divesAndSitesToDelete.dives.clear();
|
||||
|
||||
for (dive_site *ds: divesAndSitesToDelete.sites) {
|
||||
unregister_dive_site(ds);
|
||||
int idx = unregister_dive_site(ds);
|
||||
sitesToAdd.emplace_back(ds);
|
||||
emit diveListNotifier.diveSiteDeleted(ds, idx);
|
||||
}
|
||||
divesAndSitesToDelete.sites.clear();
|
||||
|
||||
|
@ -188,7 +189,8 @@ DivesAndSitesToRemove DiveListBase::addDives(DivesAndTripsToAdd &toAdd)
|
|||
// Finally, add any necessary dive sites
|
||||
for (OwningDiveSitePtr &ds: toAdd.sites) {
|
||||
sites.push_back(ds.get());
|
||||
register_dive_site(ds.release()); // Return ownership to backend
|
||||
int idx = register_dive_site(ds.release()); // Return ownership to backend
|
||||
emit diveListNotifier.diveSiteAdded(sites.back(), idx);
|
||||
}
|
||||
toAdd.sites.clear();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue