From fb934247a28a439de23735024ec8074587c0c416 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 9 May 2025 23:09:27 -0400 Subject: [PATCH] ui: brand settings for Vehicle panel (#898) * init * brand factory * more * mazda * nissan * rivian * subaru * tesla * toyota * volkswagen * do this * stretch here --- selfdrive/ui/sunnypilot/SConscript | 19 +++++- .../vehicle/brand_settings_factory.cc | 62 +++++++++++++++++++ .../settings/vehicle/brand_settings_factory.h | 18 ++++++ .../vehicle/brand_settings_interface.cc | 8 +++ .../vehicle/brand_settings_interface.h | 21 +++++++ .../qt/offroad/settings/vehicle/brands.h | 21 +++++++ .../settings/vehicle/chrysler_settings.cc | 31 ++++++++++ .../settings/vehicle/chrysler_settings.h | 27 ++++++++ .../offroad/settings/vehicle/ford_settings.cc | 31 ++++++++++ .../offroad/settings/vehicle/ford_settings.h | 27 ++++++++ .../offroad/settings/vehicle/gm_settings.cc | 31 ++++++++++ .../qt/offroad/settings/vehicle/gm_settings.h | 27 ++++++++ .../settings/vehicle/honda_settings.cc | 31 ++++++++++ .../offroad/settings/vehicle/honda_settings.h | 27 ++++++++ .../settings/vehicle/hyundai_settings.cc | 31 ++++++++++ .../settings/vehicle/hyundai_settings.h | 27 ++++++++ .../settings/vehicle/mazda_settings.cc | 31 ++++++++++ .../offroad/settings/vehicle/mazda_settings.h | 27 ++++++++ .../settings/vehicle/nissan_settings.cc | 31 ++++++++++ .../settings/vehicle/nissan_settings.h | 27 ++++++++ .../settings/vehicle/rivian_settings.cc | 31 ++++++++++ .../settings/vehicle/rivian_settings.h | 27 ++++++++ .../settings/vehicle/subaru_settings.cc | 31 ++++++++++ .../settings/vehicle/subaru_settings.h | 27 ++++++++ .../settings/vehicle/tesla_settings.cc | 31 ++++++++++ .../offroad/settings/vehicle/tesla_settings.h | 27 ++++++++ .../settings/vehicle/toyota_settings.cc | 31 ++++++++++ .../settings/vehicle/toyota_settings.h | 27 ++++++++ .../settings/vehicle/volkswagen_settings.cc | 31 ++++++++++ .../settings/vehicle/volkswagen_settings.h | 27 ++++++++ .../qt/offroad/settings/vehicle_panel.cc | 27 +++++++- .../qt/offroad/settings/vehicle_panel.h | 9 ++- 32 files changed, 877 insertions(+), 4 deletions(-) create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brands.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.h create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.h diff --git a/selfdrive/ui/sunnypilot/SConscript b/selfdrive/ui/sunnypilot/SConscript index 4ff3f70477..379adfcede 100644 --- a/selfdrive/ui/sunnypilot/SConscript +++ b/selfdrive/ui/sunnypilot/SConscript @@ -50,11 +50,28 @@ network_src = [ ] vehicle_panel_qt_src = [ + "sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.cc", + "sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.cc", "sunnypilot/qt/offroad/settings/vehicle/platform_selector.cc", ] +brand_settings_qt_src = [ + "sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/ford_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/gm_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/honda_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/mazda_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/nissan_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/rivian_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/subaru_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/tesla_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/toyota_settings.cc", + "sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.cc", +] + sp_widgets_src = widgets_src + network_src -sp_qt_src = qt_src + lateral_panel_qt_src + vehicle_panel_qt_src +sp_qt_src = qt_src + lateral_panel_qt_src + vehicle_panel_qt_src + brand_settings_qt_src sp_qt_util = qt_util Export('sp_widgets_src', 'sp_qt_src', "sp_qt_util") diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.cc new file mode 100644 index 0000000000..08b137d270 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.cc @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brands.h" + +static const QStringList supportedBrands = { + "chrysler", + "ford", + "gm", + "honda", + "hyundai", + "mazda", + "nissan", + "rivian", + "subaru" + "tesla", + "toyota", + "volkswagen", +}; + +BrandSettingsInterface* BrandSettingsFactory::createBrandSettings(const QString& brand, QWidget* parent) { + if (brand == "chrysler") + return new ChryslerSettings(parent); + if (brand == "ford") + return new FordSettings(parent); + if (brand == "gm") + return new GMSettings(parent); + if (brand == "honda") + return new HondaSettings(parent); + if (brand == "hyundai") + return new HyundaiSettings(parent); + if (brand == "mazda") + return new MazdaSettings(parent); + if (brand == "nissan") + return new NissanSettings(parent); + if (brand == "rivian") + return new RivianSettings(parent); + if (brand == "subaru") + return new SubaruSettings(parent); + if (brand == "tesla") + return new TeslaSettings(parent); + if (brand == "toyota") + return new ToyotaSettings(parent); + if (brand == "volkswagen") + return new VolkswagenSettings(parent); + + // Default empty settings if brand not supported + return nullptr; +} + +bool BrandSettingsFactory::isBrandSupported(const QString& brand) { + return supportedBrands.contains(brand); +} + +QStringList BrandSettingsFactory::getSupportedBrands() { + return supportedBrands; +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.h new file mode 100644 index 0000000000..b4dc9fc81b --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.h @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +class BrandSettingsFactory { + +public: + static BrandSettingsInterface* createBrandSettings(const QString &brand, QWidget *parent = nullptr); + static bool isBrandSupported(const QString& brand); + static QStringList getSupportedBrands(); +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.cc new file mode 100644 index 0000000000..4c49207270 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.cc @@ -0,0 +1,8 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h new file mode 100644 index 0000000000..2b6c57ae91 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include + +class BrandSettingsInterface : public QWidget { + Q_OBJECT + +public: + explicit BrandSettingsInterface(QWidget *parent = nullptr) : QWidget(parent) {} + virtual ~BrandSettingsInterface() = default; + + virtual void updatePanel(bool offroad) = 0; + virtual void updateSettings() = 0; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brands.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brands.h new file mode 100644 index 0000000000..795dba5739 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brands.h @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.h" diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.cc new file mode 100644 index 0000000000..0912a7afd8 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +ChryslerSettings::ChryslerSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void ChryslerSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void ChryslerSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.h new file mode 100644 index 0000000000..20a6235542 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/chrysler_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class ChryslerSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit ChryslerSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.cc new file mode 100644 index 0000000000..eaae5a621a --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +FordSettings::FordSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void FordSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void FordSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.h new file mode 100644 index 0000000000..1d97651bab --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/ford_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class FordSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit FordSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.cc new file mode 100644 index 0000000000..1aa4ccf938 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +GMSettings::GMSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void GMSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void GMSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.h new file mode 100644 index 0000000000..35988d95e1 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/gm_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class GMSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit GMSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.cc new file mode 100644 index 0000000000..1efdb747f3 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +HondaSettings::HondaSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void HondaSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void HondaSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.h new file mode 100644 index 0000000000..e494e8001d --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/honda_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class HondaSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit HondaSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.cc new file mode 100644 index 0000000000..7e4ea4326c --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +HyundaiSettings::HyundaiSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void HyundaiSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void HyundaiSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.h new file mode 100644 index 0000000000..0f065124fe --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/hyundai_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class HyundaiSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit HyundaiSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.cc new file mode 100644 index 0000000000..330afdc48c --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +MazdaSettings::MazdaSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void MazdaSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void MazdaSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.h new file mode 100644 index 0000000000..3d109fbe9e --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/mazda_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class MazdaSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit MazdaSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.cc new file mode 100644 index 0000000000..0faa6836fa --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +NissanSettings::NissanSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void NissanSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void NissanSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.h new file mode 100644 index 0000000000..397a17e97b --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/nissan_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class NissanSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit NissanSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.cc new file mode 100644 index 0000000000..401048ee51 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +RivianSettings::RivianSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void RivianSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void RivianSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.h new file mode 100644 index 0000000000..bf83f5966f --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/rivian_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class RivianSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit RivianSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.cc new file mode 100644 index 0000000000..7a021ef4c6 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +SubaruSettings::SubaruSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void SubaruSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void SubaruSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.h new file mode 100644 index 0000000000..bdf7835595 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/subaru_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class SubaruSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit SubaruSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.cc new file mode 100644 index 0000000000..d811f19913 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +TeslaSettings::TeslaSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void TeslaSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void TeslaSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.h new file mode 100644 index 0000000000..5c40324dc2 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/tesla_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class TeslaSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit TeslaSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.cc new file mode 100644 index 0000000000..13b4435d17 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +ToyotaSettings::ToyotaSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void ToyotaSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void ToyotaSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.h new file mode 100644 index 0000000000..46c8ef9827 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/toyota_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class ToyotaSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit ToyotaSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.cc new file mode 100644 index 0000000000..457776f50a --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.cc @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.h" + +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" + +VolkswagenSettings::VolkswagenSettings(QWidget *parent) : BrandSettingsInterface(parent) { + QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout->setContentsMargins(0, 0, 0, 0); + + ListWidget *list = new ListWidget(this, false); + + main_layout->addWidget(new ScrollViewSP(list, this)); +} + +void VolkswagenSettings::updatePanel(bool _offroad) { + updateSettings(); + + offroad = _offroad; +} + +void VolkswagenSettings::updateSettings() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.h new file mode 100644 index 0000000000..c74123e7b2 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/volkswagen_settings.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#pragma once + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +class VolkswagenSettings : public BrandSettingsInterface { + Q_OBJECT + +public: + explicit VolkswagenSettings(QWidget *parent = nullptr); + void updatePanel(bool _offroad); + void updateSettings(); + +private: + bool offroad = false; +}; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc index cc3e6df183..7ba5790acb 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.cc @@ -7,6 +7,8 @@ #include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_factory.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brands.h" #include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" VehiclePanel::VehiclePanel(QWidget *parent) : QFrame(parent) { @@ -18,11 +20,14 @@ VehiclePanel::VehiclePanel(QWidget *parent) : QFrame(parent) { vlayout->setContentsMargins(50, 20, 50, 20); platformSelector = new PlatformSelector(); + QObject::connect(platformSelector, &PlatformSelector::refreshPanel, this, &VehiclePanel::updateBrandSettings); list->addItem(platformSelector); ScrollViewSP *scroller = new ScrollViewSP(list, this); vlayout->addWidget(scroller); + currentBrandSettings = nullptr; + QObject::connect(uiState(), &UIState::offroadTransition, this, &VehiclePanel::updatePanel); main_layout->addWidget(vehicleScreen); @@ -35,6 +40,26 @@ void VehiclePanel::showEvent(QShowEvent *event) { void VehiclePanel::updatePanel(bool _offroad) { platformSelector->refresh(_offroad); - + updateBrandSettings(); offroad = _offroad; } + +void VehiclePanel::updateBrandSettings() { + if (!isVisible()) { + return; + } + + if (currentBrandSettings) { + vehicleScreen->layout()->removeWidget(currentBrandSettings); + delete currentBrandSettings; + currentBrandSettings = nullptr; + } + + if (BrandSettingsFactory::isBrandSupported(platformSelector->brand)) { + currentBrandSettings = BrandSettingsFactory::createBrandSettings(platformSelector->brand, this); + if (currentBrandSettings) { + vehicleScreen->layout()->addWidget(currentBrandSettings); + currentBrandSettings->updatePanel(offroad); + } + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h index f6265da7a6..5fc03d3d68 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_panel.h @@ -9,6 +9,7 @@ #include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/brand_settings_interface.h" #include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h" class VehiclePanel : public QFrame { @@ -24,6 +25,10 @@ public slots: private: QStackedLayout* main_layout = nullptr; QWidget* vehicleScreen = nullptr; - PlatformSelector *platformSelector = nullptr; - bool offroad; + PlatformSelector* platformSelector = nullptr; + BrandSettingsInterface* currentBrandSettings = nullptr; + bool offroad = false; + +private slots: + void updateBrandSettings(); };