Skip to content

Commit

Permalink
nav: set settings stack based on uiState.prime_type (commaai#23770)
Browse files Browse the repository at this point in the history
* nav: set settings stack based on uiState.prime_type

* also show on success
  • Loading branch information
pd0wm authored Feb 15, 2022
1 parent 14f7a78 commit f8c8110
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions selfdrive/ui/qt/maps/map_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -283,7 +285,6 @@ void MapPanel::parseResponse(const QString &response, bool success) {
}

recent_layout->addStretch();
stack->setCurrentIndex(0);
repaint();
}

Expand Down

0 comments on commit f8c8110

Please sign in to comment.