mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-29 18:42:07 +08:00
nav: show error when route request fails
old-commit-hash: f6b7128741f01c383b31dbd7d3241f26f1e23070
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user