mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-24 15:23:53 +08:00
ui: disable longitudinal personality settings when using stock long (#28443)
* disable longitdinal personality settings * disable title label * Revert "disable title label" This reverts commit ef315ac2770191f1309f774185266e0cd9fe54b0. * gray checked button on disable
This commit is contained in:
@@ -91,7 +91,7 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
|
||||
|
||||
std::vector<QString> 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);
|
||||
|
||||
@@ -64,6 +64,7 @@ public slots:
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
ButtonParamControl *long_personality_setting;
|
||||
|
||||
void updateToggles();
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user