summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gaetan Bisson <bisson@archlinux.org>2014-07-07 21:45:16 -1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-08 10:02:17 -0700
commitc054b18b7055473279b7120d334c453d1c0427ec (patch)
treef128b53ff30ade4161da9abb9d4ec63daad7e22e
parentf79c659b10ab437e273dd8a13d7c9fed52703f6c (diff)
downloadsubsurface-c054b18b7055473279b7120d334c453d1c0427ec.tar.gz
make GPS coordinates autofilling really work
Move the gpsHasChanged() call on selected dive when coordinates have changed *before* autofilling, otherwise it erases the autofilled values. Also update displayed_dive when autofilling, otherwise values are stored but not displayed immediately after saving. Signed-off-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 5dd5a53f4..477cd2223 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -690,6 +690,10 @@ void MainTab::acceptChanges()
time_t offset = current_dive->when - displayed_dive.when;
MODIFY_SELECTED_DIVES(mydive->when -= offset;);
}
+ if (displayed_dive.latitude.udeg != current_dive->latitude.udeg ||
+ displayed_dive.longitude.udeg != current_dive->longitude.udeg) {
+ MODIFY_SELECTED_DIVES(gpsHasChanged(mydive, cd, ui.coordinates->text(), 0));
+ }
if (!same_string(displayed_dive.location, cd->location)) {
MODIFY_SELECTED_DIVES(EDIT_TEXT(location));
// if we have a location text and haven't edited the coordinates, try to fill the coordinates
@@ -707,16 +711,14 @@ void MainTab::acceptChanges()
mydive->latitude = dive->latitude;
mydive->longitude = dive->longitude;
});
+ displayed_dive.latitude = dive->latitude;
+ displayed_dive.longitude = dive->longitude;
MainWindow::instance()->globe()->reload();
break;
}
}
}
}
- if (displayed_dive.latitude.udeg != current_dive->latitude.udeg ||
- displayed_dive.longitude.udeg != current_dive->longitude.udeg) {
- MODIFY_SELECTED_DIVES(gpsHasChanged(mydive, cd, ui.coordinates->text(), 0));
- }
if (tagsChanged(&displayed_dive, cd))
saveTags();