mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-07 06:35:41 +08:00
different prompt in onroad/offroad
This commit is contained in:
@@ -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<QString, QVariantMap> 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("<b>%1</b><br><br>%2")
|
||||
.arg(selected_platform)
|
||||
.arg(offroad_msg);
|
||||
|
||||
QString content("<body><h2 style=\"text-align: center;\">" + tr("Vehicle Selector") + "</h2><br>"
|
||||
"<p style=\"text-align: center; margin: 0 128px; font-size: 50px;\">" + msg + "</p></body>");
|
||||
|
||||
if (ConfirmationDialog(content, tr("Ok"), "", true, this).exec()) {
|
||||
params.put("CarPlatform", platform_data["platform"].toString().toStdString());
|
||||
params.put("CarPlatformName", selected_platform.toStdString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<QString, QVariantMap> loadPlatformList();
|
||||
|
||||
Params params;
|
||||
bool offroad;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -684,6 +684,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">موافق</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">Ok</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -680,6 +680,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -680,6 +680,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">Ok</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -678,6 +678,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">확인</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -680,6 +680,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">ตกลง</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -678,6 +678,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">Tamam</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">好的</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -679,6 +679,22 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Enter model year (e.g., 2021) and model name (Toyota Corolla):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Vehicle Selector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect once the device enters offroad state.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished">確定</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
Reference in New Issue
Block a user