mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Location completer: give distance if known
If both the displayed dive and the dive site which is shown as a potential completion have a GPS fix, indicate the distance. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e82f8ea565
commit
8c0d0de2e6
6 changed files with 38 additions and 1 deletions
|
@ -517,6 +517,18 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||
free( (void*) gpsCoords);
|
||||
}
|
||||
|
||||
if (dive_site_has_gps_location(ds) && dive_site_has_gps_location(&displayed_dive_site)) {
|
||||
// so we are showing a completion and both the current dive site and the completion
|
||||
// have a GPS fix... so let's show the distance
|
||||
if (ds->latitude.udeg == displayed_dive_site.latitude.udeg &&
|
||||
ds->longitude.udeg == displayed_dive_site.longitude.udeg) {
|
||||
bottomText += tr(" (same GPS fix)");
|
||||
} else {
|
||||
int distanceMeters = get_distance(ds->latitude, ds->longitude, displayed_dive_site.latitude, displayed_dive_site.longitude);
|
||||
QString distance = distance_string(distanceMeters);
|
||||
bottomText += tr(" (~ %1 away)").arg(distance);
|
||||
}
|
||||
}
|
||||
fontBigger.setPointSize(fontBigger.pointSize() + 1);
|
||||
fontBigger.setBold(true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue