From 1a3f86a5425aea8e49a5f7a8787207e8211a8d8f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 17 Jan 2025 21:38:29 -0500 Subject: [PATCH] ui: Transition offroad state for Device panel buttons (#584) --- selfdrive/ui/qt/offroad/settings.cc | 2 ++ selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index b633bdf33a..64c610db55 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -261,6 +261,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { } }); addItem(translateBtn); +#endif QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { for (auto btn : findChildren()) { @@ -270,6 +271,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { } }); +#ifndef SUNNYPILOT // power buttons QHBoxLayout *power_layout = new QHBoxLayout(); power_layout->setSpacing(30); diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc index 36a56c9d88..c7c9a61409 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc @@ -65,6 +65,12 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) { addItem(device_grid_layout); + QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { + for (auto btn : findChildren()) { + btn->setEnabled(offroad); + } + }); + // offroad mode and power buttons QHBoxLayout *power_layout = new QHBoxLayout();