mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make editing a location work with dive sites
Not sure if this is the final implementation, but at least for simple cases it works now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
cd28e88bee
commit
5c4d266060
1 changed files with 6 additions and 19 deletions
|
@ -1158,25 +1158,12 @@ void MainTab::on_location_textChanged(const QString &text)
|
||||||
// If we have GPS data for the location entered, add it.
|
// If we have GPS data for the location entered, add it.
|
||||||
void MainTab::on_location_editingFinished()
|
void MainTab::on_location_editingFinished()
|
||||||
{
|
{
|
||||||
// if we have a location and no GPS data, look up the GPS data;
|
// find the dive site or create it
|
||||||
// but if the GPS data was intentionally cleared then don't
|
const char *name = ui.location->text().toUtf8().data();
|
||||||
if (!currentTrip &&
|
uint32_t uuid = get_dive_site_uuid_by_name(name);
|
||||||
!same_string(displayed_dive.location, "") &&
|
if (!uuid)
|
||||||
ui.coordinates->text().trimmed().isEmpty() &&
|
uuid = create_dive_site(name);
|
||||||
!(editMode == DIVE && dive_has_gps_location(current_dive))) {
|
displayed_dive.dive_site_uuid = uuid;
|
||||||
struct dive *dive;
|
|
||||||
int i = 0;
|
|
||||||
for_each_dive (i, dive) {
|
|
||||||
if (same_string(displayed_dive.location, dive->location) &&
|
|
||||||
(dive->latitude.udeg || dive->longitude.udeg)) {
|
|
||||||
displayed_dive.latitude = dive->latitude;
|
|
||||||
displayed_dive.longitude = dive->longitude;
|
|
||||||
MainWindow::instance()->globe()->reload();
|
|
||||||
updateGpsCoordinates();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::on_suit_textChanged(const QString &text)
|
void MainTab::on_suit_textChanged(const QString &text)
|
||||||
|
|
Loading…
Add table
Reference in a new issue