From 88659504993f892cc84a96f85d6bf5d53d5cb71f Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Sun, 21 Jul 2024 15:16:31 +0200 Subject: [PATCH] Update definitions for compatibility in SunnyPilot UI The commit introduces several definitions under the SUNNYPILOT flag in different files for compatibility. These changes are meant to make sure controls previously relying on other labels now properly use specifically defined SunnyPilot labels. The update reduces confusion and enhances code clarity. --- selfdrive/ui/qt/network/networking.h | 1 + selfdrive/ui/qt/offroad/settings.h | 1 + selfdrive/ui/qt/offroad/software_settings.cc | 1 + selfdrive/ui/qt/offroad_home.h | 1 + selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h | 9 --------- tools/cabana/detailwidget.h | 1 + 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/selfdrive/ui/qt/network/networking.h b/selfdrive/ui/qt/network/networking.h index a02ddb6702..502b47a276 100644 --- a/selfdrive/ui/qt/network/networking.h +++ b/selfdrive/ui/qt/network/networking.h @@ -11,6 +11,7 @@ #define ListWidget ListWidgetSP #define ToggleControl ToggleControlSP #define LabelControl LabelControlSP +#define ElidedLabel ElidedLabelSP #else #include "selfdrive/ui/qt/widgets/controls.h" #endif diff --git a/selfdrive/ui/qt/offroad/settings.h b/selfdrive/ui/qt/offroad/settings.h index 66754e516b..dcc2f132c4 100644 --- a/selfdrive/ui/qt/offroad/settings.h +++ b/selfdrive/ui/qt/offroad/settings.h @@ -18,6 +18,7 @@ #include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h" #define ListWidget ListWidgetSP #define ParamControl ParamControlSP +#define ButtonControl ButtonControlSP #define ButtonParamControl ButtonParamControlSP #define ToggleControl ToggleControlSP #define LabelControl LabelControlSP diff --git a/selfdrive/ui/qt/offroad/software_settings.cc b/selfdrive/ui/qt/offroad/software_settings.cc index fa39daa6de..55e9c176b1 100644 --- a/selfdrive/ui/qt/offroad/software_settings.cc +++ b/selfdrive/ui/qt/offroad/software_settings.cc @@ -21,6 +21,7 @@ #ifdef SUNNYPILOT #define ListWidget ListWidgetSP +#define ButtonControl ButtonControlSP #endif diff --git a/selfdrive/ui/qt/offroad_home.h b/selfdrive/ui/qt/offroad_home.h index be905861e1..92e0307bc1 100644 --- a/selfdrive/ui/qt/offroad_home.h +++ b/selfdrive/ui/qt/offroad_home.h @@ -23,6 +23,7 @@ #define OffroadHomeImp OffroadHomeSP #define LayoutWidget LayoutWidgetSP #define Sidebar SidebarSP +#define ElidedLabel ElidedLabelSP #else #include "selfdrive/ui/qt/widgets/controls.h" #include "selfdrive/ui/qt/onroad/onroad_home.h" diff --git a/selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h b/selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h index 1719b6150f..3b68ed5a5f 100644 --- a/selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h +++ b/selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h @@ -17,15 +17,6 @@ #include "selfdrive/ui/qt/widgets/input.h" #include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_toggle.h" -// This is for compatibility purposes, until we properly do inheritance splitting -// This is because some controls were needing LabelControlSP, but the original code was using LabelControl -// which was modified in-place in the past but since we now have a new file, we will be moving it to LabelControlSP -#define LabelControl LabelControlSP //Not used on SP private code -#define ElidedLabel ElidedLabelSP //Not used on SP private code -#define ButtonControl ButtonControlSP //Not used on SP private code -#define Toggle ToggleSP //Not used on SP private code -#define ToggleControl ToggleControlSP //Not used on SP private code - QFrame *horizontal_line(QWidget *parent = nullptr); class ElidedLabelSP : public QLabel { diff --git a/tools/cabana/detailwidget.h b/tools/cabana/detailwidget.h index 58972d0860..91472eb214 100644 --- a/tools/cabana/detailwidget.h +++ b/tools/cabana/detailwidget.h @@ -8,6 +8,7 @@ #ifdef SUNNYPILOT #include "selfdrive/ui/sunnypilot/qt/widgets/sp_priv_controls.h" +#define ElidedLabel ElidedLabelSP #else #include "selfdrive/ui/qt/widgets/controls.h" #endif