diff --git a/SConstruct b/SConstruct index 358d337fef..ce02f50844 100644 --- a/SConstruct +++ b/SConstruct @@ -266,7 +266,7 @@ Export('envCython') qt_env = env.Clone() qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia"] if arch != "aarch64": - qt_modules += ["DBus", "WebEngine", "WebEngineWidgets"] + qt_modules += ["DBus"] qt_libs = [] if arch == "Darwin": diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index f9551cd2ba..acb333c5ab 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -6,11 +6,8 @@ #include #include -#include #include -#include #include -#include #include "common/params.h" #include "common/timing.h" @@ -31,37 +28,28 @@ // HomeWindow: the container for the offroad (OffroadHome) and onroad (GLWindow) UIs HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) { - layout = new QGridLayout; - layout->setMargin(0); + layout = new QStackedLayout(); + layout->setStackingMode(QStackedLayout::StackAll); // onroad UI glWindow = new GLWindow(this); - layout->addWidget(glWindow, 0, 0); + layout->addWidget(glWindow); // draw offroad UI on top of onroad UI home = new OffroadHome(); - layout->addWidget(home, 0, 0); + layout->addWidget(home); - QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), this, SLOT(setVisibility(bool))); + QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), home, SLOT(setVisible(bool))); QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), this, SIGNAL(offroadTransition(bool))); QObject::connect(glWindow, SIGNAL(screen_shutoff()), this, SIGNAL(closeSettings())); QObject::connect(this, SIGNAL(openSettings()), home, SLOT(refresh())); setLayout(layout); - setStyleSheet(R"( - * { - color: white; - } - )"); -} - -void HomeWindow::setVisibility(bool offroad) { - home->setVisible(offroad); } void HomeWindow::mousePressEvent(QMouseEvent* e) { UIState* ui_state = &glWindow->ui_state; - if (GLWindow::ui_state.scene.started && GLWindow::ui_state.scene.driver_view) { + if (GLWindow::ui_state.scene.driver_view) { Params().write_db_value("IsDriverViewEnabled", "0", 1); return; } @@ -73,7 +61,7 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) { emit openSettings(); } - // Vision click + // Handle sidebar collapsing if (ui_state->scene.started && (e->x() >= ui_state->viz_rect.x - bdr_s)) { ui_state->sidebar_collapsed = !ui_state->sidebar_collapsed; } @@ -112,11 +100,11 @@ OffroadHome::OffroadHome(QWidget* parent) : QWidget(parent) { DriveStats* drive = new DriveStats; drive->setFixedSize(800, 800); - statsAndSetup->addWidget(drive, 0, Qt::AlignLeft); + statsAndSetup->addWidget(drive); SetupWidget* setup = new SetupWidget; - setup->setFixedSize(700, 700); - statsAndSetup->addWidget(setup, 0, Qt::AlignRight); + //setup->setFixedSize(700, 700); + statsAndSetup->addWidget(setup); QWidget* statsAndSetupWidget = new QWidget(); statsAndSetupWidget->setLayout(statsAndSetup); @@ -137,7 +125,11 @@ OffroadHome::OffroadHome(QWidget* parent) : QWidget(parent) { timer->start(10 * 1000); setLayout(main_layout); - setStyleSheet(R"(background-color: none;)"); + setStyleSheet(R"( + * { + color: white; + } + )"); } void OffroadHome::openAlerts() { diff --git a/selfdrive/ui/qt/home.hpp b/selfdrive/ui/qt/home.hpp index 834c5cdbbb..f941c928aa 100644 --- a/selfdrive/ui/qt/home.hpp +++ b/selfdrive/ui/qt/home.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include #include @@ -65,7 +64,6 @@ public: private: QTimer* timer; - // offroad home screen widgets QLabel* date; QStackedLayout* center_layout; OffroadAlert* alerts_widget; @@ -85,17 +83,14 @@ public: GLWindow* glWindow; signals: - void offroadTransition(bool offroad); void openSettings(); void closeSettings(); + void offroadTransition(bool offroad); protected: void mousePressEvent(QMouseEvent* e) override; private: - QGridLayout* layout; OffroadHome* home; - -private slots: - void setVisibility(bool offroad); + QStackedLayout* layout; }; diff --git a/selfdrive/ui/qt/widgets/setup.cc b/selfdrive/ui/qt/widgets/setup.cc index 43e3387a70..64a2f68265 100644 --- a/selfdrive/ui/qt/widgets/setup.cc +++ b/selfdrive/ui/qt/widgets/setup.cc @@ -158,14 +158,10 @@ PrimeAdWidget::PrimeAdWidget(QWidget* parent) : QWidget(parent) { SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) { mainLayout = new QStackedLayout; - QWidget* blankWidget = new QWidget; - //blankWidget->setStyleSheet(R"background-color: transparent;"); - mainLayout->addWidget(blankWidget); - // Unpaired, registration prompt layout QVBoxLayout* finishRegistationLayout = new QVBoxLayout; - finishRegistationLayout ->setMargin(30); + finishRegistationLayout->setMargin(30); QLabel* registrationDescription = new QLabel("Pair your device with the comma connect app"); registrationDescription->setWordWrap(true); @@ -220,7 +216,7 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) { setLayout(mainLayout); setStyleSheet(R"( - QFrame { + SetupWidget { background-color: #292929; } * { @@ -246,7 +242,7 @@ void SetupWidget::parseError(QString response) { void SetupWidget::showQrCode(){ showQr = true; - mainLayout->setCurrentIndex(2); + mainLayout->setCurrentIndex(1); } void SetupWidget::replyFinished(QString response) { @@ -261,7 +257,7 @@ void SetupWidget::replyFinished(QString response) { bool is_prime = json["prime"].toBool(); if (!is_paired) { - mainLayout->setCurrentIndex(1 + showQr); + mainLayout->setCurrentIndex(showQr); } else if (!is_prime) { showQr = false; mainLayout->setCurrentWidget(primeAd);