[2014-07-08 19:12:56 +0300] Miika Turkia:
> There is no visual indication that the GPS position
> is added before saving. (Once upon a time the GPS edit field was populated
> after selecting the location, if there was matching GPS coordinates
> available.)

So the search loop ran for matching dive locations every time the
location name changes? Or perhaps just when the location field was
modified and then unselected? Or some other heuristic. None of these
seem as clean and simple as the current behavior.

> If I have same location with GPS coordinates and without coordinates, then
> the coordinates are not updated to new location. I am not sure whether the
> current behavior is the correct way or not (as there can be multiple
> locations with same name but different coordinates...e.g. coral garden is
> in pretty much any tropical dive destination). Anyway, it would be cool if
> one was presented an option to select the coordinates from a list, if
> multiple different coordinates are available for same location.

That could indeed be interesting but it goes well beyond the scope of
the limited completion feature we currently have. Currently, when there
are several dives with matching location names, the GPS coordinates are
copied from the first matching dive in the list. I guess that's as good
a heuristic as you can expect from a simple completion feature.

> The GPS retrieval is not executed if I only re-type the dive location (e.g.
> clear the location and type it again, and save only after the whole edit).

Yes it is, but you need to clear the GPS coordinates for that to work.
If there already are GPS coordinates, they are left as is.

Dirk wanted to release 4.2 soon, I recall, and therefore I suggest it
incorporates the simple patch attached to restore the GPS completion
feature we had before. As you point out, further improvements could be
made but they are drastic and it seems wise not to delay 4.2 for them...

Cheers.

-- 
Gaetan
>From 15d44f5b5b0a8b420e635c8256ee747455ecefd3 Mon Sep 17 00:00:00 2001
From: Gaetan Bisson <[email protected]>
Date: Mon, 7 Jul 2014 21:45:16 -1000
Subject: [PATCH] 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 <[email protected]>
---
 qt-ui/maintab.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 5dd5a53..477cd22 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();
 
-- 
2.0.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to