From 4e6cc1f3bc2df070d7b0946d21d09860bf67edf3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 18 Jan 2025 15:22:15 -0500 Subject: [PATCH] ui: Hide regulatory button on non-comma devices (#585) Co-authored-by: DevTekVE --- .../qt/offroad/settings/device_panel.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc index c7c9a61409..25bce83e43 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc @@ -24,10 +24,21 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) { {"translateBtn", tr("Language")}, }; + int row = 0, col = 0; for (int i = 0; i < device_btns.size(); i++) { + if (device_btns[i].first == "regulatoryBtn" && !Hardware::TICI()) { + continue; + } + auto *btn = new PushButtonSP(device_btns[i].second, 720, this); - device_grid_layout->addWidget(btn, i / 2, i % 2); + device_grid_layout->addWidget(btn, row, col); buttons[device_btns[i].first] = btn; + + col++; + if (col > 1) { + col = 0; + row++; + } } connect(buttons["dcamBtn"], &PushButtonSP::clicked, [this]() { @@ -48,8 +59,6 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) { const std::string txt = util::read_file("../assets/offroad/fcc.html"); ConfirmationDialog::rich(QString::fromStdString(txt), this); }); - } else { - buttons["regulatoryBtn"]->setEnabled(false); } connect(buttons["translateBtn"], &PushButtonSP::clicked, [=]() {