From 62077abd3c3dc5824bb55fc5521537c438af2ad5 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 17 Jul 2021 00:14:50 -0700 Subject: [PATCH] more touchups (#21634) * wait to hide * same msg * networking ui fixups * clicked Co-authored-by: Comma Device --- selfdrive/ui/qt/offroad/networking.cc | 13 +++++++------ selfdrive/ui/qt/setup/setup.cc | 11 +++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/selfdrive/ui/qt/offroad/networking.cc b/selfdrive/ui/qt/offroad/networking.cc index f63fc26b74..9db1b4a49f 100644 --- a/selfdrive/ui/qt/offroad/networking.cc +++ b/selfdrive/ui/qt/offroad/networking.cc @@ -211,7 +211,7 @@ void WifiUI::refresh() { clearLayout(main_layout); if (wifi->seen_networks.size() == 0) { - QLabel *scanning = new QLabel("No networks found. Scanning..."); + QLabel *scanning = new QLabel("Scanning for networks..."); scanning->setStyleSheet("font-size: 65px;"); main_layout->addWidget(scanning, 0, Qt::AlignCenter); return; @@ -221,7 +221,7 @@ void WifiUI::refresh() { int i = 0; for (Network &network : wifi->seen_networks) { QHBoxLayout *hlayout = new QHBoxLayout; - hlayout->setContentsMargins(44, 50, 73, 50); + hlayout->setContentsMargins(44, 0, 73, 0); hlayout->setSpacing(50); // Clickable SSID label @@ -235,16 +235,17 @@ void WifiUI::refresh() { font-weight: %1; text-align: left; border: none; - padding: 0; + padding-top: 50px; + padding-bottom: 50px; )").arg(weight)); QObject::connect(ssid_label, &QPushButton::clicked, this, [=]() { emit connectToNetwork(network); }); - hlayout->addWidget(ssid_label, 1); + hlayout->addWidget(ssid_label, network.connected == ConnectedType::CONNECTING ? 0 : 1); if (network.connected == ConnectedType::CONNECTING) { QPushButton *connecting = new QPushButton("CONNECTING..."); connecting->setStyleSheet(R"( font-size: 32px; - font-weight: 500; + font-weight: 600; color: white; border-radius: 0; padding: 27px; @@ -293,5 +294,5 @@ void WifiUI::refresh() { } i++; } - main_layout->addStretch(1); + main_layout->addStretch(2); } diff --git a/selfdrive/ui/qt/setup/setup.cc b/selfdrive/ui/qt/setup/setup.cc index dbd31c17ed..33f93e6d70 100644 --- a/selfdrive/ui/qt/setup/setup.cc +++ b/selfdrive/ui/qt/setup/setup.cc @@ -270,7 +270,7 @@ QWidget * Setup::download_failed() { QPushButton *reboot = new QPushButton("Reboot device"); reboot->setObjectName("navBtn"); blayout->addWidget(reboot); - QObject::connect(reboot, &QPushButton::released, this, [=]() { + QObject::connect(reboot, &QPushButton::clicked, this, [=]() { Hardware::reboot(); }); @@ -278,7 +278,7 @@ QWidget * Setup::download_failed() { restart->setObjectName("navBtn"); restart->setProperty("primary", true); blayout->addWidget(restart); - QObject::connect(restart, &QPushButton::released, this, [=]() { + QObject::connect(restart, &QPushButton::clicked, this, [=]() { setCurrentIndex(0); }); @@ -312,8 +312,11 @@ Setup::Setup(QWidget *parent) : QStackedWidget(parent) { QObject::connect(this, &Setup::finished, [=](bool success) { // hide setup on success qDebug() << "finished" << success; - setVisible(!success); - setCurrentWidget(failed_widget); + if (success) { + QTimer::singleShot(3000, this, &QWidget::hide); + } else { + setCurrentWidget(failed_widget); + } }); // TODO: revisit pressed bg color