mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-12 19:33:48 +08:00
ui: deprecate RETURN_IF_SUNNYPILOT macro and cleanup (#540)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -356,8 +356,7 @@ void SettingsWindow::setCurrentPanel(int index, const QString ¶m) {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user