tici touch ups (#20434)

* tici touch ups

* trim

* less squish

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 61a0129fdc
vw-mqb-aeb
Adeeb Shihadeh 4 years ago committed by GitHub
parent e24dab1c92
commit ae0756edc6
  1. 5
      selfdrive/ui/qt/home.cc
  2. 43
      selfdrive/ui/qt/offroad/settings.cc
  3. 6
      selfdrive/ui/qt/offroad/settings.hpp
  4. 4
      selfdrive/ui/qt/window.cc

@ -190,6 +190,9 @@ void OffroadHome::refresh() {
alert_notification->setStyleSheet(style); alert_notification->setStyleSheet(style);
} }
// GLWindow: the onroad UI
static void handle_display_state(UIState* s, bool user_input) { static void handle_display_state(UIState* s, bool user_input) {
static int awake_timeout = 0; static int awake_timeout = 0;
awake_timeout = std::max(awake_timeout - 1, 0); awake_timeout = std::max(awake_timeout - 1, 0);
@ -203,8 +206,6 @@ static void handle_display_state(UIState* s, bool user_input) {
} }
// GLWindow: the onroad UI
GLWindow::GLWindow(QWidget* parent) : QOpenGLWidget(parent) { GLWindow::GLWindow(QWidget* parent) : QOpenGLWidget(parent) {
timer = new QTimer(this); timer = new QTimer(this);
QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timerUpdate())); QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timerUpdate()));

@ -72,7 +72,7 @@ QWidget * toggles_panel() {
return widget; return widget;
} }
QWidget * device_panel() { DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
QVBoxLayout *device_layout = new QVBoxLayout; QVBoxLayout *device_layout = new QVBoxLayout;
device_layout->setMargin(100); device_layout->setMargin(100);
@ -116,35 +116,36 @@ QWidget * device_panel() {
device_layout->addWidget(new ButtonControl("Uninstall " + brand, "UNINSTALL", device_layout->addWidget(new ButtonControl("Uninstall " + brand, "UNINSTALL",
"", "",
[=]() { [=]() {
if (ConfirmationDialog::confirm("Are you srue you want to uninstall?")) { if (ConfirmationDialog::confirm("Are you sure you want to uninstall?")) {
Params().write_db_value("DoUninstall", "1"); Params().write_db_value("DoUninstall", "1");
} }
})); }));
// power buttons // power buttons
QHBoxLayout *power_layout = new QHBoxLayout();
power_layout->setSpacing(30);
QPushButton *reboot_btn = new QPushButton("Reboot");
power_layout->addWidget(reboot_btn);
QObject::connect(reboot_btn, &QPushButton::released, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to reboot?")) {
Hardware::reboot();
}
});
QPushButton *poweroff_btn = new QPushButton("Power Off"); QPushButton *poweroff_btn = new QPushButton("Power Off");
poweroff_btn->setStyleSheet("background-color: #E22C2C;"); poweroff_btn->setStyleSheet("background-color: #E22C2C;");
device_layout->addWidget(poweroff_btn, Qt::AlignBottom); power_layout->addWidget(poweroff_btn);
QObject::connect(poweroff_btn, &QPushButton::released, [=]() { QObject::connect(poweroff_btn, &QPushButton::released, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to power off?")) { if (ConfirmationDialog::confirm("Are you sure you want to power off?")) {
Hardware::poweroff(); Hardware::poweroff();
} }
}); });
device_layout->addSpacing(20); device_layout->addLayout(power_layout);
QPushButton *reboot_btn = new QPushButton("Reboot"); setLayout(device_layout);
device_layout->addWidget(reboot_btn, Qt::AlignBottom); setStyleSheet(R"(
QObject::connect(reboot_btn, &QPushButton::released, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to reboot?")) {
Hardware::reboot();
}
});
QWidget *widget = new QWidget;
widget->setLayout(device_layout);
widget->setStyleSheet(R"(
QPushButton { QPushButton {
padding: 0; padding: 0;
height: 120px; height: 120px;
@ -152,7 +153,6 @@ QWidget * device_panel() {
background-color: #393939; background-color: #393939;
} }
)"); )");
return widget;
} }
DeveloperPanel::DeveloperPanel(QWidget* parent) : QFrame(parent) { DeveloperPanel::DeveloperPanel(QWidget* parent) : QFrame(parent) {
@ -175,10 +175,11 @@ void DeveloperPanel::showEvent(QShowEvent *event) {
for (int i = 0; i < dev_params.size(); i++) { for (int i = 0; i < dev_params.size(); i++) {
const auto &[name, value] = dev_params[i]; const auto &[name, value] = dev_params[i];
QString val = QString::fromStdString(value).trimmed();
if (labels.size() > i) { if (labels.size() > i) {
labels[i]->setText(QString::fromStdString(value)); labels[i]->setText(val);
} else { } else {
labels.push_back(new LabelControl(name, QString::fromStdString(value))); labels.push_back(new LabelControl(name, val));
layout()->addWidget(labels[i]); layout()->addWidget(labels[i]);
if (i < (dev_params.size() - 1)) { if (i < (dev_params.size() - 1)) {
layout()->addWidget(horizontal_line()); layout()->addWidget(horizontal_line());
@ -248,7 +249,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
// setup panels // setup panels
QPair<QString, QWidget *> panels[] = { QPair<QString, QWidget *> panels[] = {
{"Device", device_panel()}, {"Device", new DevicePanel(this)},
{"Network", network_panel(this)}, {"Network", network_panel(this)},
{"Toggles", toggles_panel()}, {"Toggles", toggles_panel()},
{"Developer", new DeveloperPanel()}, {"Developer", new DeveloperPanel()},
@ -278,7 +279,9 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
sidebar_layout->addWidget(btn, 0, Qt::AlignRight); sidebar_layout->addWidget(btn, 0, Qt::AlignRight);
panel_layout->addWidget(panel); panel_layout->addWidget(panel);
QObject::connect(btn, &QPushButton::released, [=, w = panel]() { panel_layout->setCurrentWidget(w); }); QObject::connect(btn, &QPushButton::released, [=, w = panel]() {
panel_layout->setCurrentWidget(w);
});
} }
qobject_cast<QPushButton *>(nav_btns->buttons()[0])->setChecked(true); qobject_cast<QPushButton *>(nav_btns->buttons()[0])->setChecked(true);
sidebar_layout->setContentsMargins(50, 50, 100, 50); sidebar_layout->setContentsMargins(50, 50, 100, 50);

@ -12,6 +12,12 @@
// ********** settings window + top-level panels ********** // ********** settings window + top-level panels **********
class DevicePanel : public QWidget {
Q_OBJECT
public:
explicit DevicePanel(QWidget* parent = nullptr);
};
class DeveloperPanel : public QFrame { class DeveloperPanel : public QFrame {
Q_OBJECT Q_OBJECT
public: public:

@ -2,6 +2,7 @@
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
main_layout = new QStackedLayout; main_layout = new QStackedLayout;
main_layout->setMargin(0);
homeWindow = new HomeWindow(this); homeWindow = new HomeWindow(this);
main_layout->addWidget(homeWindow); main_layout->addWidget(homeWindow);
@ -12,8 +13,6 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
onboardingWindow = new OnboardingWindow(this); onboardingWindow = new OnboardingWindow(this);
main_layout->addWidget(onboardingWindow); main_layout->addWidget(onboardingWindow);
main_layout->setMargin(0);
setLayout(main_layout);
QObject::connect(homeWindow, SIGNAL(openSettings()), this, SLOT(openSettings())); QObject::connect(homeWindow, SIGNAL(openSettings()), this, SLOT(openSettings()));
QObject::connect(homeWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings())); QObject::connect(homeWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings()));
QObject::connect(homeWindow, SIGNAL(offroadTransition(bool)), this, SLOT(offroadTransition(bool))); QObject::connect(homeWindow, SIGNAL(offroadTransition(bool)), this, SLOT(offroadTransition(bool)));
@ -25,6 +24,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
onboardingWindow->updateActiveScreen(); onboardingWindow->updateActiveScreen();
// no outline to prevent the focus rectangle // no outline to prevent the focus rectangle
setLayout(main_layout);
setStyleSheet(R"( setStyleSheet(R"(
* { * {
font-family: Inter; font-family: Inter;

Loading…
Cancel
Save