fix offroad home on tici (#20435)
* grid layout was a hack * duplicate slot * looks better * fix that Co-authored-by: Comma Device <device@comma.ai>albatross
parent
61a0129fdc
commit
106ed2ea66
|
@ -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":
|
||||
|
|
|
@ -6,11 +6,8 @@
|
|||
|
||||
#include <QDateTime>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QStackedLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#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() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLWidget>
|
||||
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue