can do clean up in another PR

show
pull/29068/head
Shane Smiskol 2 years ago
parent 4dcabec1d9
commit 8a0651459c
  1. 17
      selfdrive/ui/qt/maps/map_panel.cc
  2. 1
      selfdrive/ui/qt/maps/map_panel.h

@ -17,7 +17,11 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q
QObject::connect(device(), &Device::interactiveTimeout, [=]() {
content_stack->setCurrentIndex(0);
});
QObject::connect(map, &MapWindow::requestVisible, this, &MapPanel::requestVisible);
QObject::connect(map, &MapWindow::requestVisible, [=](bool visible) {
// when we show the map for a new route, signal HomeWindow to hide the sidebar
if (visible) { emit mapPanelRequested(); }
setVisible(visible);
});
QObject::connect(map, &MapWindow::requestSettings, [=](bool settings) {
content_stack->setCurrentIndex(settings ? 1 : 0);
});
@ -30,17 +34,10 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q
content_stack->addWidget(settings);
}
void MapPanel::requestVisible(bool visible) {
// when we show the map for a new route, signal HomeWindow to hide the sidebar
if (visible && !isVisible()) {
emit mapPanelRequested();
}
setVisible(visible);
}
void MapPanel::toggleMapSettings() {
// show settings if not visible, then toggle between map and settings
int new_index = isVisible() ? (1 - content_stack->currentIndex()) : 1;
content_stack->setCurrentIndex(new_index);
requestVisible(true);
emit mapPanelRequested();
show();
}

@ -14,7 +14,6 @@ signals:
void mapPanelRequested();
public slots:
void requestVisible(bool visible);
void toggleMapSettings();
private:

Loading…
Cancel
Save