|
|
@ -96,15 +96,8 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { |
|
|
|
"../assets/offroad/icon_speed_limit.png", |
|
|
|
"../assets/offroad/icon_speed_limit.png", |
|
|
|
longi_button_texts); |
|
|
|
longi_button_texts); |
|
|
|
|
|
|
|
|
|
|
|
// Watch param to update the personality setting in the UI
|
|
|
|
// set up uiState update for personality setting
|
|
|
|
ParamWatcher *lp_watch = new ParamWatcher(this); |
|
|
|
QObject::connect(uiState(), &UIState::uiUpdate, this, &TogglesPanel::updateState); |
|
|
|
lp_watch->addParam("LongitudinalPersonality"); |
|
|
|
|
|
|
|
QObject::connect(lp_watch, &ParamWatcher::paramChanged, [=](const QString ¶m_name, const QString ¶m_value) { |
|
|
|
|
|
|
|
lp_watch->addParam("LongitudinalPersonality"); |
|
|
|
|
|
|
|
if (isVisible()) { |
|
|
|
|
|
|
|
long_personality_setting->refresh(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto &[param, title, desc, icon] : toggle_defs) { |
|
|
|
for (auto &[param, title, desc, icon] : toggle_defs) { |
|
|
|
auto toggle = new ParamControl(param, title, desc, icon, this); |
|
|
|
auto toggle = new ParamControl(param, title, desc, icon, this); |
|
|
@ -131,6 +124,18 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TogglesPanel::updateState(const UIState &s) { |
|
|
|
|
|
|
|
const SubMaster &sm = *(s.sm); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sm.updated("longitudinalPlan")) { |
|
|
|
|
|
|
|
auto personality = sm["longitudinalPlan"].getLongitudinalPlan().getPersonalityDEPRECATED(); |
|
|
|
|
|
|
|
if (personality != s.scene.personality && s.scene.started && isVisible()) { |
|
|
|
|
|
|
|
long_personality_setting->setCheckedButton(static_cast<int>(personality)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
uiState()->scene.personality = personality; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TogglesPanel::expandToggleDescription(const QString ¶m) { |
|
|
|
void TogglesPanel::expandToggleDescription(const QString ¶m) { |
|
|
|
toggles[param.toStdString()]->showDescription(); |
|
|
|
toggles[param.toStdString()]->showDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|