From ad21fe0e2fc8b7b6b72a35a5b5e000209fe41fef Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 24 Jul 2023 14:57:37 -0700 Subject: [PATCH] this works but is ugly --- selfdrive/ui/qt/maps/map_panel.cc | 9 ++++++++- selfdrive/ui/qt/maps/map_panel.h | 3 ++- selfdrive/ui/qt/onroad.cc | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/selfdrive/ui/qt/maps/map_panel.cc b/selfdrive/ui/qt/maps/map_panel.cc index 6fe71b9d47..20f666a248 100644 --- a/selfdrive/ui/qt/maps/map_panel.cc +++ b/selfdrive/ui/qt/maps/map_panel.cc @@ -22,6 +22,7 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q if (visible) { emit mapPanelRequested(); } setVisible(visible); }); +// QObject::connect(map, &MapWindow::requestSettings, this, &MapPanel::requestMapSettings); QObject::connect(map, &MapWindow::requestSettings, [=](bool settings) { content_stack->setCurrentIndex(settings ? 1 : 0); }); @@ -34,7 +35,13 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q content_stack->addWidget(settings); } -void MapPanel::mapSettingsRequested() { +void MapPanel::toggleMapSettings() { + emit mapPanelRequested(); + setVisible(true); + content_stack->setCurrentIndex((content_stack->currentIndex() + 1) % 2); +} + +void MapPanel::requestMapSettings(bool settings) { // TODO rename requestMapSettings emit mapPanelRequested(); setVisible(true); content_stack->setCurrentIndex(1); diff --git a/selfdrive/ui/qt/maps/map_panel.h b/selfdrive/ui/qt/maps/map_panel.h index 1f663cbabb..f10e1516ec 100644 --- a/selfdrive/ui/qt/maps/map_panel.h +++ b/selfdrive/ui/qt/maps/map_panel.h @@ -14,7 +14,8 @@ signals: void mapPanelRequested(); public slots: - void mapSettingsRequested(); + void requestMapSettings(bool settings); + void toggleMapSettings(); private: diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index b64010be5c..f367ae9eba 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -92,7 +92,8 @@ void OnroadWindow::offroadTransition(bool offroad) { map = m; QObject::connect(m, &MapPanel::mapPanelRequested, this, &OnroadWindow::mapPanelRequested); - QObject::connect(nvg, &AnnotatedCameraWidget::mapSettingsRequested, m, &MapPanel::mapSettingsRequested); +// QObject::connect(nvg, &AnnotatedCameraWidget::mapSettingsRequested, m, &MapPanel::mapSettingsRequested); + QObject::connect(nvg, &AnnotatedCameraWidget::mapSettingsRequested, m, &MapPanel::toggleMapSettings); m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE); split->insertWidget(0, m);