Map: pass changed coordinates via signal

The coordinates of a "dragged flag" were passed out-of-bound via
the global "displayed_dive_site" object and then a signal was sent
to notify of the changed coordinates.

Instead, pass the coordinates directly via the signal. This makes
the data- and control-flow more clear.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-08 13:51:57 +02:00 committed by Dirk Hohndel
parent 66c5c5f72b
commit 754160d625
6 changed files with 14 additions and 16 deletions

View file

@ -141,10 +141,10 @@ void LocationInformationWidget::clearLabels()
ui.locationTags->clear();
}
void LocationInformationWidget::updateGpsCoordinates()
void LocationInformationWidget::updateGpsCoordinates(degrees_t latitude, degrees_t longitude)
{
QString oldText = ui.diveSiteCoordinates->text();
const char *coords = printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg);
const char *coords = printGPSCoords(latitude.udeg, longitude.udeg);
ui.diveSiteCoordinates->setText(coords);
enableLocationButtons(dive_site_has_gps_location(&displayed_dive_site));
free((void *)coords);