diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/brightness.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/brightness.cc index ffd3ce1d8..e9bd13485 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/brightness.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/brightness.cc @@ -25,8 +25,8 @@ const QMap Brightness::brightness_options = { Brightness::Brightness() : OptionControlSP( "Brightness", - tr("Brightness"), - tr("Overrides the brightness of the device."), + tr("Global Brightness"), + tr("Overrides the brightness of the device. This applies to both onroad and offroad screens. "), "../assets/offroad/icon_blank.png", {0, 11}, 1, true, &brightness_options) { diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc index b92696078..43e606745 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc @@ -91,22 +91,6 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) { updateState(); }); - interactivityTimeout = new OptionControlSP("InteractivityTimeout", tr("Interactivity Timeout"), - tr("Apply a custom timeout for settings UI." - "\nThis is the time after which settings UI closes automatically if user is not interacting with the screen."), - "", {0, 120}, 10, true, nullptr, false); - - connect(interactivityTimeout, &OptionControlSP::updateLabels, [=]() { - updateState(); - }); - - addItem(interactivityTimeout); - - // Brightness - brightness = new Brightness(); - connect(brightness, &OptionControlSP::updateLabels, brightness, &Brightness::refresh); - addItem(brightness); - addItem(device_grid_layout); // offroad mode and power buttons @@ -215,13 +199,6 @@ void DevicePanelSP::updateState() { } toggleDeviceBootMode->setDescription(deviceSleepModeDescription(currStatus)); - QString timeoutValue = QString::fromStdString(params.get("InteractivityTimeout")); - if (timeoutValue == "0" || timeoutValue.isEmpty()) { - interactivityTimeout->setLabel("Default"); - } else { - interactivityTimeout->setLabel(timeoutValue + "s"); - } - if (offroad and not offroad_mode_param) { power_group_layout->insertWidget(0, offroadBtn, 0, Qt::AlignHCenter); } else { diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.h index 1e86e7201..ce4acfc7c 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.h @@ -8,7 +8,6 @@ #pragma once #include "selfdrive/ui/sunnypilot/qt/offroad/settings/max_time_offroad.h" -#include "selfdrive/ui/sunnypilot/qt/offroad/settings/brightness.h" #include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" #include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" @@ -32,8 +31,6 @@ private: PushButtonSP *offroadBtn; MaxTimeOffroad *maxTimeOffroad; ButtonParamControlSP *toggleDeviceBootMode; - Brightness *brightness; - OptionControlSP *interactivityTimeout; QVBoxLayout *power_group_layout; bool offroad; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/display/onroad_screen_brightness.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/display/onroad_screen_brightness.cc index 3e9dc427b..8833ffa89 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/display/onroad_screen_brightness.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/display/onroad_screen_brightness.cc @@ -15,6 +15,7 @@ OnroadScreenBrightnessControl::OnroadScreenBrightnessControl(const QString ¶ auto *mainFrameLayout = new QGridLayout(); mainFrame->setLayout(mainFrameLayout); mainFrameLayout->setSpacing(0); + mainFrameLayout->setContentsMargins(0, 0, 0, 0); onroadScreenOffTimer = new OptionControlSP( "OnroadScreenOffTimer", diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.cc index b441021ff..274e28cf8 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.cc @@ -24,6 +24,24 @@ DisplayPanel::DisplayPanel(QWidget *parent) : QWidget(parent) { "", this); list->addItem(onroadScreenBrightnessControl); + list->addItem(horizontal_line()); + + // Global Brightness + brightness = new Brightness(); + connect(brightness, &OptionControlSP::updateLabels, brightness, &Brightness::refresh); + list->addItem(brightness); + list->addItem(horizontal_line()); + + // Interactivity Timeout + interactivityTimeout = new OptionControlSP("InteractivityTimeout", tr("Interactivity Timeout"), + tr("Apply a custom timeout for settings UI." + "\nThis is the time after which settings UI closes automatically if user is not interacting with the screen."), + "", {0, 120}, 10, true, nullptr, false); + + connect(interactivityTimeout, &OptionControlSP::updateLabels, [=]() { + refresh(); + }); + list->addItem(interactivityTimeout); sunnypilotScroller = new ScrollViewSP(list, this); vlayout->addWidget(sunnypilotScroller); @@ -37,4 +55,11 @@ void DisplayPanel::showEvent(QShowEvent *event) { void DisplayPanel::refresh() { onroadScreenBrightnessControl->refresh(); + + QString timeoutValue = QString::fromStdString(params.get("InteractivityTimeout")); + if (timeoutValue == "0" || timeoutValue.isEmpty()) { + interactivityTimeout->setLabel("Default"); + } else { + interactivityTimeout->setLabel(timeoutValue + "s"); + } } diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.h index 1714c8a43..69b440c9d 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/display_panel.h @@ -7,6 +7,7 @@ #pragma once +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/brightness.h" #include "selfdrive/ui/sunnypilot/qt/offroad/settings/display/onroad_screen_brightness.h" #include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" #include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" @@ -25,4 +26,6 @@ private: ScrollViewSP *sunnypilotScroller = nullptr; Params params; OnroadScreenBrightnessControl *onroadScreenBrightnessControl = nullptr; + Brightness *brightness; + OptionControlSP *interactivityTimeout; };