diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 64bf44d2ce..a165f34144 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -91,7 +91,7 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { std::vector longi_button_texts{tr("Aggressive"), tr("Standard"), tr("Relaxed")}; - ButtonParamControl* long_personality_setting = new ButtonParamControl("LongitudinalPersonality", tr("Driving Personality"), + long_personality_setting = new ButtonParamControl("LongitudinalPersonality", tr("Driving Personality"), tr("Standard is recommended. In aggressive mode, openpilot will follow lead cars closer and be more aggressive with the gas and brake. In relaxed mode openpilot will stay further away from lead cars."), "../assets/offroad/icon_speed_limit.png", longi_button_texts); @@ -143,6 +143,7 @@ void TogglesPanel::updateToggles() { .arg(tr("New Driving Visualization")) .arg(tr("The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.")); + long_personality_setting->setEnabled(false); const bool is_release = params.getBool("IsReleaseBranch"); auto cp_bytes = params.get("CarParamsPersistent"); if (!cp_bytes.empty()) { @@ -161,6 +162,7 @@ void TogglesPanel::updateToggles() { // normal description and toggle e2e_toggle->setEnabled(true); e2e_toggle->setDescription(e2e_description); + long_personality_setting->setEnabled(true); } else { // no long for now e2e_toggle->setEnabled(false); diff --git a/selfdrive/ui/qt/offroad/settings.h b/selfdrive/ui/qt/offroad/settings.h index c63be4e138..e35811fdc8 100644 --- a/selfdrive/ui/qt/offroad/settings.h +++ b/selfdrive/ui/qt/offroad/settings.h @@ -64,6 +64,7 @@ public slots: private: Params params; std::map toggles; + ButtonParamControl *long_personality_setting; void updateToggles(); }; diff --git a/selfdrive/ui/qt/widgets/controls.h b/selfdrive/ui/qt/widgets/controls.h index 654c6e2c1c..807441cc85 100644 --- a/selfdrive/ui/qt/widgets/controls.h +++ b/selfdrive/ui/qt/widgets/controls.h @@ -216,14 +216,17 @@ public: QPushButton:pressed { background-color: #4a4a4a; } - QPushButton:checked { + QPushButton:checked:enabled { background-color: #33Ab4C; } + QPushButton:disabled { + color: #33E4E4E4; + } )"; key = param.toStdString(); int value = atoi(params.get(key).c_str()); - QButtonGroup *button_group = new QButtonGroup(this); + button_group = new QButtonGroup(this); button_group->setExclusive(true); for (int i = 0; i < button_texts.size(); i++) { QPushButton *button = new QPushButton(button_texts[i], this); @@ -242,9 +245,16 @@ public: }); } + void setEnabled(bool enable) { + for (auto btn : button_group->buttons()) { + btn->setEnabled(enable); + } + } + private: std::string key; Params params; + QButtonGroup *button_group; }; class ListWidget : public QWidget {