nav: show error when route request fails

old-commit-hash: f6b7128741f01c383b31dbd7d3241f26f1e23070
This commit is contained in:
Willem Melching
2021-07-26 14:56:53 +02:00
parent 63a4bdf281
commit fe1eb7e99f
+7 -1
View File
@@ -147,7 +147,7 @@ void MapWindow::timerUpdate() {
loaded_once = loaded_once || m_map->isFullyLoaded();
if (!loaded_once) {
map_instructions->showError("Map loading");
map_instructions->showError("Map Loading");
return;
}
@@ -343,6 +343,7 @@ void MapWindow::calculateRoute(QMapbox::Coordinate destination) {
}
void MapWindow::routeCalculated(QGeoRouteReply *reply) {
bool got_route = false;
if (reply->error() == QGeoRouteReply::NoError) {
if (reply->routes().size() != 0) {
qWarning() << "Got route response";
@@ -357,6 +358,7 @@ void MapWindow::routeCalculated(QGeoRouteReply *reply) {
navSource["data"] = QVariant::fromValue<QMapbox::Feature>(feature);
m_map->updateSource("navSource", navSource);
m_map->setLayoutProperty("navLayer", "visibility", "visible");
got_route = true;
updateETA();
} else {
@@ -366,6 +368,10 @@ void MapWindow::routeCalculated(QGeoRouteReply *reply) {
qWarning() << "Got error in route reply" << reply->errorString();
}
if (!got_route) {
map_instructions->showError("Failed to Route");
}
reply->deleteLater();
}