From f8c81103fc1dc98b0403a89c549947a9777f87ce Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 15 Feb 2022 16:39:10 +0100 Subject: [PATCH] nav: set settings stack based on uiState.prime_type (#23770) * nav: set settings stack based on uiState.prime_type * also show on success --- selfdrive/ui/qt/maps/map_settings.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/ui/qt/maps/map_settings.cc b/selfdrive/ui/qt/maps/map_settings.cc index e130a9a1ec4997..1e3a99e31a1dd0 100644 --- a/selfdrive/ui/qt/maps/map_settings.cc +++ b/selfdrive/ui/qt/maps/map_settings.cc @@ -115,11 +115,12 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) { stack->addWidget(main_widget); stack->addWidget(no_prime_widget); - stack->setCurrentIndex(1); + stack->setCurrentIndex(uiState()->prime_type ? 0 : 1); QVBoxLayout *wrapper = new QVBoxLayout(this); wrapper->addWidget(stack); + clear(); if (auto dongle_id = getDongleId()) { @@ -183,8 +184,9 @@ void MapPanel::updateCurrentRoute() { } void MapPanel::parseResponse(const QString &response, bool success) { + stack->setCurrentIndex((uiState()->prime_type || success) ? 0 : 1); + if (!success) { - stack->setCurrentIndex(1); return; } @@ -283,7 +285,6 @@ void MapPanel::parseResponse(const QString &response, bool success) { } recent_layout->addStretch(); - stack->setCurrentIndex(0); repaint(); }