mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-24 03:22:04 +08:00
ParamControl - ParamControlSP
This commit is contained in:
@@ -15,6 +15,10 @@
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
|
||||
#ifdef SUNNYPILOT
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#endif
|
||||
|
||||
// ********** settings window + top-level panels **********
|
||||
class SettingsWindow : public QFrame {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -178,15 +178,6 @@ ParamControl::ParamControl(const QString ¶m, const QString &title, const QSt
|
||||
: ToggleControl(title, desc, icon, false, parent) {
|
||||
key = param.toStdString();
|
||||
QObject::connect(this, &ParamControl::toggleFlipped, this, &ParamControl::toggleClicked);
|
||||
|
||||
hlayout->removeWidget(&toggle);
|
||||
hlayout->insertWidget(0, &toggle);
|
||||
|
||||
hlayout->removeWidget(this->icon_label);
|
||||
this->icon_pixmap = QPixmap(icon).scaledToWidth(20, Qt::SmoothTransformation);
|
||||
this->icon_label->setPixmap(this->icon_pixmap);
|
||||
this->icon_label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
hlayout->insertWidget(1, this->icon_label);
|
||||
}
|
||||
|
||||
void ParamControl::toggleClicked(bool state) {
|
||||
|
||||
@@ -181,8 +181,6 @@ public:
|
||||
refresh();
|
||||
}
|
||||
|
||||
bool isToggled() { return params.getBool(key); }
|
||||
|
||||
private:
|
||||
void toggleClicked(bool state);
|
||||
void setIcon(bool state) {
|
||||
@@ -193,8 +191,14 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SUNNYPILOT
|
||||
protected:
|
||||
#endif
|
||||
std::string key;
|
||||
Params params;
|
||||
#ifdef SUNNYPILOT
|
||||
private:
|
||||
#endif
|
||||
QPixmap active_icon_pixmap;
|
||||
bool confirm = false;
|
||||
bool store_confirm = false;
|
||||
|
||||
@@ -15,7 +15,8 @@ widgets_src = [
|
||||
"sunnypilot/qt/offroad/models_fetcher.cc",
|
||||
"sunnypilot/qt/offroad/speed_limit_warning_settings.cc",
|
||||
"sunnypilot/qt/offroad/speed_limit_policy_settings.cc",
|
||||
"sunnypilot/qt/offroad/sunnylink_settings.cc"
|
||||
"sunnypilot/qt/offroad/sunnylink_settings.cc",
|
||||
"sunnypilot/qt/widgets/sp_priv_controls.cc"
|
||||
]
|
||||
|
||||
network_src = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
class CameraOffset : public SPOptionControl {
|
||||
@@ -38,7 +38,7 @@ signals:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
CameraOffset *camera_offset;
|
||||
PathOffset *path_offset;
|
||||
|
||||
@@ -38,7 +38,7 @@ DisplayPanel::DisplayPanel(QWidget *parent) : ListWidget(parent, false) {
|
||||
connect(brightness_control, &SPOptionControl::updateLabels, brightness_control, &BrightnessControl::refresh);
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
|
||||
class OnroadScreenOff : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
@@ -62,7 +62,7 @@ public slots:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
OnroadScreenOff *onroad_screen_off;
|
||||
OnroadScreenOffBrightness *onroad_screen_off_brightness;
|
||||
|
||||
@@ -47,7 +47,7 @@ LaneChangeSettings::LaneChangeSettings(QWidget* parent) : QWidget(parent) {
|
||||
connect(pause_lateral_speed, &SPOptionControl::updateLabels, pause_lateral_speed, &PauseLateralSpeed::refresh);
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
list->addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
class AutoLaneChangeTimer : public SPOptionControl {
|
||||
@@ -50,7 +50,7 @@ public slots:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
AutoLaneChangeTimer *auto_lane_change_timer;
|
||||
PauseLateralSpeed *pause_lateral_speed;
|
||||
|
||||
@@ -44,7 +44,7 @@ MadsSettings::MadsSettings(QWidget* parent) : QWidget(parent) {
|
||||
list->addItem(dlob_settings);
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
list->addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
class MadsSettings : public QWidget {
|
||||
@@ -19,7 +19,7 @@ public slots:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
ButtonParamControl *dlob_settings;
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ MonitoringPanel::MonitoringPanel(QWidget *parent) : QFrame(parent) {
|
||||
};
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
list->addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
class MonitoringPanel : public QFrame {
|
||||
@@ -13,5 +13,5 @@ private:
|
||||
QStackedLayout* main_layout = nullptr;
|
||||
QWidget* monitoringScreen = nullptr;
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "common/swaglog.h"
|
||||
#include "selfdrive/ui/qt/network/wifi_manager.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/locations_fetcher.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
QWidget* osmScreen = nullptr;
|
||||
Params params;
|
||||
Params mem_params{ Hardware::PC() ? "": "/dev/shm/params"};
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
std::optional<QFuture<quint64>> mapSizeFuture;
|
||||
const SubMaster &sm = *uiState()->sm;
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ TogglesPanelSP::TogglesPanelSP(SettingsWindow *parent) : TogglesPanel(parent) {
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &TogglesPanelSP::updateState);
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
bool locked = params.getBool((param + "Lock").toStdString());
|
||||
toggle->setEnabled(!locked);
|
||||
|
||||
@@ -13,6 +13,7 @@ private slots:
|
||||
void updateState(const UIState &s) override;
|
||||
|
||||
private:
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
ButtonParamControl *accel_personality_setting;
|
||||
|
||||
ParamWatcher *param_watcher;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
|
||||
@@ -33,7 +33,7 @@ public slots:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
SpeedLimitValueOffset *slvo;
|
||||
ButtonParamControl *speed_limit_offset_settings;
|
||||
|
||||
@@ -23,7 +23,7 @@ SpeedLimitWarningSettings::SpeedLimitWarningSettings(QWidget* parent) : QWidget(
|
||||
speed_limit_warning_settings->showDescription();
|
||||
list->addItem(speed_limit_warning_settings);
|
||||
|
||||
speed_limit_warning_flash = new ParamControl(
|
||||
speed_limit_warning_flash = new ParamControlSP(
|
||||
"SpeedLimitWarningFlash",
|
||||
tr("Warning with speed limit flash"),
|
||||
tr("When Speed Limit Warning is enabled, the speed limit sign will alert the driver when the cruising speed is faster than then speed limit plus the offset."),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
|
||||
@@ -33,11 +33,11 @@ public slots:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
SpeedLimitWarningValueOffset *slwvo;
|
||||
ButtonParamControl *speed_limit_warning_offset_settings;
|
||||
ParamControl *speed_limit_warning_flash;
|
||||
ParamControlSP *speed_limit_warning_flash;
|
||||
ButtonParamControl *speed_limit_warning_settings;
|
||||
ParamWatcher *param_watcher;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ SunnylinkPanel::SunnylinkPanel(QWidget* parent) : QFrame(parent) {
|
||||
connect(uiState(), &UIState::sunnylinkDeviceUsersChanged, this, &SunnylinkPanel::updateLabels);
|
||||
|
||||
auto list = new ListWidget(this, false);
|
||||
sunnylinkEnabledBtn = new ParamControl(
|
||||
sunnylinkEnabledBtn = new ParamControlSP(
|
||||
"SunnylinkEnabled",
|
||||
tr("Enable sunnylink"),
|
||||
sunnylinkBtnDescription,
|
||||
@@ -29,12 +29,12 @@ SunnylinkPanel::SunnylinkPanel(QWidget* parent) : QFrame(parent) {
|
||||
list->addItem(horizontal_line());
|
||||
|
||||
sunnylinkBtnDescription = tr("This is the master switch, it will allow you to cutoff any sunnylink requests should you want to do that.");
|
||||
connect(sunnylinkEnabledBtn, &ParamControl::showDescriptionEvent, [=]() {
|
||||
connect(sunnylinkEnabledBtn, &ParamControlSP::showDescriptionEvent, [=]() {
|
||||
//resets the description to the default one for the easter egg
|
||||
sunnylinkEnabledBtn->setDescription(sunnylinkBtnDescription);
|
||||
});
|
||||
|
||||
connect(sunnylinkEnabledBtn, &ParamControl::toggleFlipped, [=](bool enabled) {
|
||||
connect(sunnylinkEnabledBtn, &ParamControlSP::toggleFlipped, [=](bool enabled) {
|
||||
if (enabled) {
|
||||
auto proud_description = "<font color='SeaGreen'>"+ tr("🎉Welcome back! We're excited to see you've enabled sunnylink again! 🚀")+ "</font>";
|
||||
sunnylinkEnabledBtn->showDescription();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
const QString SUNNYLINK_BASE_URL = util::getenv("SUNNYLINK_API_HOST", "https://stg.api.sunnypilot.ai").c_str();
|
||||
@@ -78,7 +78,7 @@ public slots:
|
||||
|
||||
private:
|
||||
|
||||
ParamControl* sunnylinkEnabledBtn;
|
||||
ParamControlSP* sunnylinkEnabledBtn;
|
||||
QStackedLayout* main_layout = nullptr;
|
||||
QWidget* sunnylinkScreen = nullptr;
|
||||
ScrollView *scrollView = nullptr;
|
||||
|
||||
@@ -251,7 +251,7 @@ SunnypilotPanel::SunnypilotPanel(QWidget *parent) : QFrame(parent) {
|
||||
dlp_settings->showDescription();
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
list->addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/speed_limit_warning_settings.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/speed_limit_policy_settings.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
class TorqueFriction : public SPOptionControl {
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
LaneChangeSettings* lane_change_settings = nullptr;
|
||||
CustomOffsetsSettings* custom_offsets_settings = nullptr;
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
ParamWatcher *param_watcher;
|
||||
|
||||
TorqueFriction *friction;
|
||||
|
||||
@@ -72,7 +72,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
|
||||
// Hyundai/Kia/Genesis
|
||||
addItem(new LabelControl(tr("Hyundai/Kia/Genesis")));
|
||||
auto hkgSmoothStop = new ParamControl(
|
||||
auto hkgSmoothStop = new ParamControlSP(
|
||||
"HkgSmoothStop",
|
||||
tr("HKG CAN: Smoother Stopping Performance (Beta)"),
|
||||
tr("Smoother stopping behind a stopped car or desired stopping event. This is only applicable to HKG CAN platforms using openpilot longitudinal control."),
|
||||
@@ -83,7 +83,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
|
||||
// Subaru
|
||||
addItem(new LabelControl(tr("Subaru")));
|
||||
auto subaruManualParkingBrakeSng = new ParamControl(
|
||||
auto subaruManualParkingBrakeSng = new ParamControlSP(
|
||||
"SubaruManualParkingBrakeSng",
|
||||
tr("Manual Parking Brake: Stop and Go (Beta)"),
|
||||
tr("Experimental feature to enable stop and go for Subaru Global models with manual handbrake. Models with electric parking brake should keep this disabled. Thanks to martinl for this implementation!"),
|
||||
@@ -94,7 +94,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
|
||||
// Toyota/Lexus
|
||||
addItem(new LabelControl(tr("Toyota/Lexus")));
|
||||
stockLongToyota = new ParamControl(
|
||||
stockLongToyota = new ParamControlSP(
|
||||
"StockLongToyota",
|
||||
tr("Enable Stock Toyota Longitudinal Control"),
|
||||
tr("sunnypilot will <b>not</b> take over control of gas and brakes. Stock Toyota longitudinal control will be used."),
|
||||
@@ -103,7 +103,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
stockLongToyota->setConfirmation(true, false);
|
||||
addItem(stockLongToyota);
|
||||
|
||||
auto lkasToggle = new ParamControl(
|
||||
auto lkasToggle = new ParamControlSP(
|
||||
"LkasToggle",
|
||||
tr("Allow M.A.D.S. toggling w/ LKAS Button (Beta)"),
|
||||
QString("%1<br>"
|
||||
@@ -115,7 +115,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
lkasToggle->setConfirmation(true, false);
|
||||
addItem(lkasToggle);
|
||||
|
||||
auto toyotaTss2LongTune = new ParamControl(
|
||||
auto toyotaTss2LongTune = new ParamControlSP(
|
||||
"ToyotaTSS2Long",
|
||||
tr("Toyota TSS2 Longitudinal: Custom Tuning"),
|
||||
tr("Smoother longitudinal performance for Toyota/Lexus TSS2/LSS2 cars. Big thanks to dragonpilot-community for this implementation."),
|
||||
@@ -124,7 +124,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
toyotaTss2LongTune->setConfirmation(true, false);
|
||||
addItem(toyotaTss2LongTune);
|
||||
|
||||
auto toyotaAbh = new ParamControl(
|
||||
auto toyotaAbh = new ParamControlSP(
|
||||
"ToyotaAutoHold",
|
||||
tr("Enable Automatic Brake Hold (AHB)"),
|
||||
QString("<b>%1</b><br><br>%2<br><br><b>%3</b>")
|
||||
@@ -136,7 +136,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
toyotaAbh->setConfirmation(true, false);
|
||||
addItem(toyotaAbh);
|
||||
|
||||
toyotaEnhancedBsm = new ParamControl(
|
||||
toyotaEnhancedBsm = new ParamControlSP(
|
||||
"ToyotaEnhancedBsm",
|
||||
tr("Enable Enhanced Blind Spot Monitor"),
|
||||
"",
|
||||
@@ -145,7 +145,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
toyotaEnhancedBsm->setConfirmation(true, false);
|
||||
addItem(toyotaEnhancedBsm);
|
||||
|
||||
auto toyotaSngHack = new ParamControl(
|
||||
auto toyotaSngHack = new ParamControlSP(
|
||||
"ToyotaSnG",
|
||||
tr("Enable Toyota Stop and Go Hack"),
|
||||
tr("sunnypilot will allow some Toyota/Lexus cars to auto resume during stop and go traffic. This feature is only applicable to certain models. Use at your own risk."),
|
||||
@@ -154,7 +154,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
toyotaSngHack->setConfirmation(true, false);
|
||||
addItem(toyotaSngHack);
|
||||
|
||||
auto toyotaAutoLock = new ParamControl(
|
||||
auto toyotaAutoLock = new ParamControlSP(
|
||||
"ToyotaAutoLock",
|
||||
tr("Enable Toyota Door Auto Locking"),
|
||||
tr("sunnypilot will attempt to lock the doors when drive above 10 km/h (6.2 mph).\nReboot Required."),
|
||||
@@ -163,7 +163,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
toyotaAutoLock->setConfirmation(true, false);
|
||||
addItem(toyotaAutoLock);
|
||||
|
||||
auto toyotaAutoUnlock = new ParamControl(
|
||||
auto toyotaAutoUnlock = new ParamControlSP(
|
||||
"ToyotaAutoUnlockByShifter",
|
||||
tr("Enable Toyota Door Auto Unlocking"),
|
||||
tr("sunnypilot will attempt to unlock the doors when shift to gear P.\nReboot Required."),
|
||||
@@ -174,7 +174,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge
|
||||
|
||||
// Volkswagen
|
||||
addItem(new LabelControl(tr("Volkswagen")));
|
||||
auto volkswagenCCOnly = new ParamControl(
|
||||
auto volkswagenCCOnly = new ParamControlSP(
|
||||
"VwCCOnly",
|
||||
tr("Enable CC Only support"),
|
||||
tr("sunnypilot supports Volkswagen MQB CC only platforms with this toggle enabled. Only enable this toggle if your car does not have ACC from the factory."),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "common/watchdog.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
|
||||
class VehiclePanel : public QWidget {
|
||||
@@ -44,8 +44,8 @@ private:
|
||||
Params params;
|
||||
bool is_onroad = false;
|
||||
|
||||
ParamControl *stockLongToyota;
|
||||
ParamControl *toyotaEnhancedBsm;
|
||||
ParamControlSP *stockLongToyota;
|
||||
ParamControlSP *toyotaEnhancedBsm;
|
||||
|
||||
const QString toyotaEnhancedBsmDescription = QString("%1<br><br>"
|
||||
"%2")
|
||||
|
||||
@@ -92,7 +92,7 @@ VisualsPanel::VisualsPanel(QWidget *parent) : ListWidget(parent) {
|
||||
chevron_info_settings->showDescription();
|
||||
|
||||
for (auto &[param, title, desc, icon] : toggle_defs) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
auto toggle = new ParamControlSP(param, title, desc, icon, this);
|
||||
|
||||
addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
|
||||
class VisualsPanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
|
||||
private:
|
||||
Params params;
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
std::map<std::string, ParamControlSP*> toggles;
|
||||
|
||||
ButtonParamControl *dev_ui_settings;
|
||||
ButtonParamControl *chevron_info_settings;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h"
|
||||
|
||||
ParamControlSP::ParamControlSP(const QString ¶m, const QString &title, const QString &desc, const QString &icon, QWidget *parent)
|
||||
: ParamControl(param, title, desc, icon, parent) {
|
||||
|
||||
hlayout->removeWidget(&toggle);
|
||||
hlayout->insertWidget(0, &toggle);
|
||||
|
||||
hlayout->removeWidget(this->icon_label);
|
||||
this->icon_pixmap = QPixmap(icon).scaledToWidth(20, Qt::SmoothTransformation);
|
||||
this->icon_label->setPixmap(this->icon_pixmap);
|
||||
this->icon_label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
hlayout->insertWidget(1, this->icon_label);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
|
||||
class ParamControlSP : public ParamControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ParamControlSP(const QString ¶m, const QString &title, const QString &desc, const QString &icon, QWidget *parent = nullptr);
|
||||
|
||||
bool isToggled() { return params.getBool(key); }
|
||||
};
|
||||
Reference in New Issue
Block a user