From 7e448d1de1d3ebf4be8b706c80f96d298d234ccd Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 24 Jul 2023 16:16:09 -0700 Subject: [PATCH] let's make map_settings_btn public --- selfdrive/ui/qt/onroad.cc | 8 +++++--- selfdrive/ui/qt/onroad.h | 8 +------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index e7b3506195..81f08c0e54 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::toggleMapSettings, m, &MapPanel::toggleMapSettings); + QObject::connect(nvg->map_settings_btn, &MapSettingsButton::clicked, m, &MapPanel::toggleMapSettings); + nvg->map_settings_btn->setVisible(true); m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE); split->insertWidget(0, m); @@ -225,8 +226,10 @@ void ExperimentalButton::paintEvent(QPaintEvent *event) { // MapSettingsButton MapSettingsButton::MapSettingsButton(QWidget *parent) : QPushButton(parent) { setFixedSize(btn_size, btn_size); - settings_img = loadPixmap("../assets/navigation/nav-settings.png", {136, 136}); + + // hidden by default, made visible if map is created (has prime or mapbox token) + setVisible(false); } void MapSettingsButton::paintEvent(QPaintEvent *event) { @@ -256,7 +259,6 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par main_layout->addWidget(experimental_btn, 0, Qt::AlignTop | Qt::AlignRight); map_settings_btn = new MapSettingsButton(this); - QObject::connect(map_settings_btn, &MapSettingsButton::clicked, this, &AnnotatedCameraWidget::toggleMapSettings); main_layout->addWidget(map_settings_btn, 0, Qt::AlignBottom | Qt::AlignRight); dm_img = loadPixmap("../assets/img_driver_face.png", {img_size + 5, img_size + 5}); diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index a3725621fa..2460d03b60 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -54,9 +54,6 @@ class MapSettingsButton : public QPushButton { public: explicit MapSettingsButton(QWidget *parent = 0); -signals: - void toggleMapSettings(); - private: void paintEvent(QPaintEvent *event) override; @@ -83,16 +80,13 @@ class AnnotatedCameraWidget : public CameraWidget { public: explicit AnnotatedCameraWidget(VisionStreamType type, QWidget* parent = 0); void updateState(const UIState &s); - -signals: - void toggleMapSettings(); + MapSettingsButton *map_settings_btn; private: void drawIcon(QPainter &p, int x, int y, QPixmap &img, QBrush bg, float opacity); void drawText(QPainter &p, int x, int y, const QString &text, int alpha = 255); ExperimentalButton *experimental_btn; - MapSettingsButton *map_settings_btn; QPixmap dm_img; float speed; QString speedUnit;