mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 04:53:24 +00:00
Dive site rewrite: be smarter when dealing with auto created sites
If we download dive site locations from the companion app we can be slightly smarter if the user overwrite the location feel on the Notes tab. We can be pretty sure that they wanted to keep the GPS location and just correct the dive site name (or possibly assign that location to an existing dive site). This tries to accomplish that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3d8f884abb
commit
65babff6bc
1 changed files with 12 additions and 0 deletions
|
@ -1352,6 +1352,12 @@ void MainTab::on_location_editingFinished()
|
|||
|
||||
if (!found) {
|
||||
uint32_t uuid = create_dive_site(qPrintable(ui.location->text()));
|
||||
ds = get_dive_site_by_uuid(uuid);
|
||||
if (same_string(displayed_dive_site.notes, "SubsurfaceWebservice")) {
|
||||
ds->latitude = displayed_dive_site.latitude;
|
||||
ds->longitude = displayed_dive_site.longitude;
|
||||
delete_dive_site(displayed_dive_site.uuid);
|
||||
}
|
||||
displayed_dive.dive_site_uuid = uuid;
|
||||
copy_dive_site(get_dive_site_by_uuid(uuid), &displayed_dive_site);
|
||||
markChangedWidget(ui.location);
|
||||
|
@ -1371,6 +1377,12 @@ void MainTab::on_location_editingFinished()
|
|||
if(ds_from_dive && ui.location->text() == ds_from_dive->name)
|
||||
return;
|
||||
ds_from_dive = get_dive_site(idx);
|
||||
if (!dive_site_has_gps_location(ds_from_dive) &&
|
||||
same_string(displayed_dive_site.notes, "SubsurfaceWebservice")) {
|
||||
ds_from_dive->latitude = displayed_dive_site.latitude;
|
||||
ds_from_dive->longitude = displayed_dive_site.longitude;
|
||||
delete_dive_site(displayed_dive_site.uuid);
|
||||
}
|
||||
displayed_dive.dive_site_uuid = ds_from_dive->uuid;
|
||||
copy_dive_site(get_dive_site_by_uuid(ds_from_dive->uuid), &displayed_dive_site);
|
||||
markChangedWidget(ui.location);
|
||||
|
|
Loading…
Add table
Reference in a new issue