ui: deprecate RETURN_IF_SUNNYPILOT macro and cleanup (#540)

This commit is contained in:
Jason Wen
2025-01-08 21:49:55 -05:00
committed by GitHub
parent 1b7066eb12
commit d0f11e59ad
5 changed files with 8 additions and 13 deletions
-2
View File
@@ -3,9 +3,7 @@
#include <QHBoxLayout>
#include <QMouseEvent>
#include "selfdrive/ui/qt/offroad/experimental_mode.h"
#include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/widgets/prime.h"
// HomeWindow: the container for the offroad and onroad UIs
+2 -2
View File
@@ -356,8 +356,7 @@ void SettingsWindow::setCurrentPanel(int index, const QString &param) {
}
SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
RETURN_IF_SUNNYPILOT
#ifndef SUNNYPILOT
// setup two main layouts
sidebar_widget = new QWidget;
QVBoxLayout *sidebar_layout = new QVBoxLayout(sidebar_widget);
@@ -457,4 +456,5 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
border-radius: 30px;
}
)");
#endif
}
-6
View File
@@ -13,12 +13,6 @@
#include "cereal/gen/cpp/car.capnp.h"
#include "common/params.h"
#ifdef SUNNYPILOT
#define RETURN_IF_SUNNYPILOT return;
#else
#define RETURN_IF_SUNNYPILOT // Do nothing
#endif
QString getVersion();
QString getBrand();
QString getUserAgent();
+2 -1
View File
@@ -6,7 +6,7 @@
#include "selfdrive/ui/qt/util.h"
AbstractControl::AbstractControl(const QString &title, const QString &desc, const QString &icon, QWidget *parent) : QFrame(parent) {
RETURN_IF_SUNNYPILOT
#ifndef SUNNYPILOT
QVBoxLayout *main_layout = new QVBoxLayout(this);
main_layout->setMargin(0);
@@ -57,6 +57,7 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons
});
main_layout->addStretch();
#endif
}
void AbstractControl::hideEvent(QHideEvent *e) {
+4 -2
View File
@@ -111,15 +111,16 @@ UIState::UIState(QObject *parent) : QObject(parent) {
prime_state = new PrimeState(this);
language = QString::fromStdString(Params().get("LanguageSetting"));
RETURN_IF_SUNNYPILOT
#ifndef SUNNYPILOT
// update timer
timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
timer->start(1000 / UI_FREQ);
#endif
}
void UIState::update() {
RETURN_IF_SUNNYPILOT
#ifndef SUNNYPILOT
update_sockets(this);
update_state(this);
updateStatus();
@@ -128,6 +129,7 @@ void UIState::update() {
watchdog_kick(nanos_since_boot());
}
emit uiUpdate(*this);
#endif
}
Device::Device(QObject *parent) : brightness_filter(BACKLIGHT_OFFROAD, BACKLIGHT_TS, BACKLIGHT_DT), QObject(parent) {