diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.cc index 2d5c7c1727..7a1f8833b8 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.cc @@ -22,19 +22,19 @@ PlatformSelector::PlatformSelector() : ButtonControl(tr("Vehicle"), "", "") { setText(tr("SEARCHING")); setEnabled(false); searchPlatforms(query); - refresh(); + refresh(offroad); } } else { params.remove("CarPlatform"); params.remove("CarPlatformName"); - refresh(); + refresh(offroad); } }); - refresh(); + refresh(offroad); } -void PlatformSelector::refresh() { +void PlatformSelector::refresh(bool _offroad) { QString platform_param = QString::fromStdString(params.get("CarPlatform")); if (platform_param.length()) { setValue(QString::fromStdString(params.get("CarPlatformName"))); @@ -44,6 +44,8 @@ void PlatformSelector::refresh() { setText("SEARCH"); } setEnabled(true); + + offroad = _offroad; } QMap PlatformSelector::loadPlatformList() { @@ -190,7 +192,19 @@ void PlatformSelector::searchPlatforms(const QString &query) { if (!selected_platform.isEmpty()) { QVariantMap platform_data = platforms[selected_platform]; - params.put("CarPlatform", platform_data["platform"].toString().toStdString()); - params.put("CarPlatformName", selected_platform.toStdString()); + + const QString offroad_msg = offroad ? tr("This setting will take effect immediately.") : + tr("This setting will take effect once the device enters offroad state."); + const QString msg = QString("%1

%2") + .arg(selected_platform) + .arg(offroad_msg); + + QString content("

" + tr("Vehicle Selector") + "


" + "

" + msg + "

"); + + if (ConfirmationDialog(content, tr("Ok"), "", true, this).exec()) { + params.put("CarPlatform", platform_data["platform"].toString().toStdString()); + params.put("CarPlatformName", selected_platform.toStdString()); + } } } diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h index 7e7a2588bb..69d88f910e 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h @@ -15,10 +15,13 @@ class PlatformSelector : public ButtonControl { public: PlatformSelector(); -private: - Params params; +public slots: + void refresh(bool _offroad); - void refresh(); +private: void searchPlatforms(const QString &query); QMap loadPlatformList(); + + Params params; + bool offroad; }; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc index 2fdb9048e4..6d979e4912 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc @@ -6,7 +6,6 @@ */ #include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h" -#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h" #include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" @@ -18,11 +17,14 @@ VehiclePanel::VehiclePanel(QWidget *parent) : QFrame(parent) { QVBoxLayout *vlayout = new QVBoxLayout(vehicleScreen); vlayout->setContentsMargins(50, 20, 50, 20); - list->addItem(new PlatformSelector()); + platformSelector = new PlatformSelector(); + list->addItem(platformSelector); ScrollViewSP *scroller = new ScrollViewSP(list, this); vlayout->addWidget(scroller); + QObject::connect(uiState(), &UIState::offroadTransition, platformSelector, &PlatformSelector::refresh); + main_layout->addWidget(vehicleScreen); main_layout->setCurrentWidget(vehicleScreen); } diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h index d4b75feeab..1b5a19c31d 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h @@ -9,6 +9,8 @@ #include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h" + class VehiclePanel : public QFrame { Q_OBJECT @@ -18,5 +20,5 @@ public: private: QStackedLayout* main_layout = nullptr; QWidget* vehicleScreen = nullptr; - ButtonControl* carSelector = nullptr; + PlatformSelector *platformSelector = nullptr; }; diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index f946ec20e9..d9fd8edf83 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -684,6 +684,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + موافق + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 1985d8e10d..39b426e0e9 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + Ok + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index aed42574de..9dd59a0774 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -680,6 +680,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + OK + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index db522a1289..2c477811fe 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -680,6 +680,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + Ok + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 21d1e86219..37692d94f7 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -678,6 +678,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + OK + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 16fc811528..456e23dd57 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + 확인 + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index bbf431da46..a34181f407 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -680,6 +680,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + OK + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index a0d0f591a5..28e8db13df 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + ตกลง + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index 82eded261a..6e05c52216 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -678,6 +678,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + Tamam + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index b3c8cb0396..765cb44c58 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + 好的 + PrimeAdWidget diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index cedf824d21..5470c16118 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.Enter model year (e.g., 2021) and model name (Toyota Corolla): + + Vehicle Selector + + + + This setting will take effect once the device enters offroad state. + + + + This setting will take effect immediately. + + + + Ok + 確定 + PrimeAdWidget