From 482a9042fc835866eea9bbd1734e8bd8f9fd05a9 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:16:57 -0700 Subject: [PATCH] FrogPilot setup - Determine if the map is open --- selfdrive/ui/qt/maps/map_panel.cc | 8 ++++++++ selfdrive/ui/qt/maps/map_panel.h | 4 ++++ selfdrive/ui/ui.h | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/selfdrive/ui/qt/maps/map_panel.cc b/selfdrive/ui/qt/maps/map_panel.cc index c4cc20e21..ff19f6c25 100644 --- a/selfdrive/ui/qt/maps/map_panel.cc +++ b/selfdrive/ui/qt/maps/map_panel.cc @@ -41,3 +41,11 @@ void MapPanel::toggleMapSettings() { emit mapPanelRequested(); show(); } + +void MapPanel::showEvent(QShowEvent *event) { + uiState()->scene.map_open = true; +} + +void MapPanel::hideEvent(QHideEvent *event) { + uiState()->scene.map_open = false; +} diff --git a/selfdrive/ui/qt/maps/map_panel.h b/selfdrive/ui/qt/maps/map_panel.h index 190bb6344..4e1af240f 100644 --- a/selfdrive/ui/qt/maps/map_panel.h +++ b/selfdrive/ui/qt/maps/map_panel.h @@ -18,4 +18,8 @@ public slots: private: QStackedLayout *content_stack; + + // FrogPilot widgets + void hideEvent(QHideEvent *event); + void showEvent(QShowEvent *event); }; diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 7238159dd..57ccda194 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -101,6 +101,10 @@ typedef struct UIScene { bool started, ignition, is_metric, map_on_left, longitudinal_control; bool world_objects_visible = false; uint64_t started_frame; + + // FrogPilot variables + bool map_open; + } UIScene; class UIState : public QObject {