From 9405895285f90932bee9db439fe6a13234f65395 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 23 Dec 2013 14:56:40 -0800 Subject: Improve GPS string handling This adds support for two more GPS coordinate formats and also fixes a couple of issues with the previous implementation. We used to only support full degrees and decimal minutes. We now also support fully decimal and degrees, minutes and decimal seconds. The previous implementation would color the input field red if either it couldn't parse the string, or if it was able to parse it but it was the same as the previous location. That's misleading. The previous implementation also changed all gps coordinates to the new coordinates in a multi-dive edit - instead of just changing the ones that are the same as the master dive. Fixes #387 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 028627292..5d020268c 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -920,11 +920,12 @@ void MainTab::on_notes_textChanged() void MainTab::on_coordinates_textChanged(const QString& text) { - bool gpsChanged = FALSE; - EDIT_SELECTED_DIVES(gpsChanged |= gpsHasChanged(mydive, NULL, text)); + bool gpsChanged = false; + bool parsed = false; + EDIT_SELECTED_DIVES(gpsChanged |= gpsHasChanged(mydive, current_dive, text, &parsed)); if (gpsChanged) { markChangedWidget(ui.coordinates); - } else { + } else if (!parsed) { QPalette p; p.setBrush(QPalette::Base, QColor(Qt::red).lighter()); ui.coordinates->setPalette(p); -- cgit v1.2.3-70-g09d2