|
|
@ -156,6 +156,7 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) { |
|
|
|
|
|
|
|
|
|
|
|
void MapPanel::showEvent(QShowEvent *event) { |
|
|
|
void MapPanel::showEvent(QShowEvent *event) { |
|
|
|
updateCurrentRoute(); |
|
|
|
updateCurrentRoute(); |
|
|
|
|
|
|
|
refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MapPanel::clear() { |
|
|
|
void MapPanel::clear() { |
|
|
@ -184,18 +185,25 @@ void MapPanel::updateCurrentRoute() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MapPanel::parseResponse(const QString &response, bool success) { |
|
|
|
void MapPanel::parseResponse(const QString &response, bool success) { |
|
|
|
stack->setCurrentIndex((uiState()->prime_type || success) ? 0 : 1); |
|
|
|
if (!success) return; |
|
|
|
|
|
|
|
|
|
|
|
if (!success) { |
|
|
|
cur_destinations = response; |
|
|
|
return; |
|
|
|
if (isVisible()) { |
|
|
|
|
|
|
|
refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MapPanel::refresh() { |
|
|
|
|
|
|
|
stack->setCurrentIndex(uiState()->prime_type ? 0 : 1); |
|
|
|
|
|
|
|
if (cur_destinations == prev_destinations) return; |
|
|
|
|
|
|
|
|
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(response.trimmed().toUtf8()); |
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(cur_destinations.trimmed().toUtf8()); |
|
|
|
if (doc.isNull()) { |
|
|
|
if (doc.isNull()) { |
|
|
|
qDebug() << "JSON Parse failed on navigation locations"; |
|
|
|
qDebug() << "JSON Parse failed on navigation locations"; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prev_destinations = cur_destinations; |
|
|
|
clear(); |
|
|
|
clear(); |
|
|
|
|
|
|
|
|
|
|
|
bool has_recents = false; |
|
|
|
bool has_recents = false; |
|
|
|