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

@ -46,8 +46,7 @@ void MapWidget::doneLoading(QQuickWidget::Status status)
m_mapHelper = rootObject()->findChild<MapWidgetHelper *>();
connect(m_mapHelper, SIGNAL(selectedDivesChanged(QList<int>)),
this, SLOT(selectedDivesChanged(QList<int>)));
connect(m_mapHelper, SIGNAL(coordinatesChanged()),
this, SLOT(coordinatesChangedLocal()));
connect(m_mapHelper, &MapWidgetHelper::coordinatesChanged, this, &MapWidget::coordinatesChangedLocal);
}
void MapWidget::centerOnSelectedDiveSite()
@ -116,10 +115,10 @@ void MapWidget::selectedDivesChanged(QList<int> list)
skipReload = false;
}
void MapWidget::coordinatesChangedLocal()
void MapWidget::coordinatesChangedLocal(degrees_t latitude, degrees_t longitude)
{
CHECK_IS_READY_RETURN_VOID();
emit coordinatesChanged();
emit coordinatesChanged(latitude, longitude);
}
void MapWidget::updateDiveSiteCoordinates(uint32_t uuid, degrees_t latitude, degrees_t longitude)