Files
StarPilot/selfdrive/ui/qt/window.cc
T
Adeeb Shihadeh 672d0d4727 move offroad alerts to home screen (#2681)
* move offroad alerts to home screen

* offroad aletrs work, but sidebar doesn't look nice

* fix sidebar

* looks better

* cleanup

* little bigger

Co-authored-by: grekiki <gregor1234567890@gmail.com>
old-commit-hash: 8320a153fb530f973669fa1aafa693a17d4ef035
2020-12-04 15:21:55 -08:00

47 lines
1.2 KiB
C++

#include "window.hpp"
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
main_layout = new QStackedLayout;
homeWindow = new HomeWindow(this);
main_layout->addWidget(homeWindow);
settingsWindow = new SettingsWindow(this);
main_layout->addWidget(settingsWindow);
onboardingWindow = new OnboardingWindow(this);
main_layout->addWidget(onboardingWindow);
main_layout->setMargin(0);
setLayout(main_layout);
QObject::connect(homeWindow, SIGNAL(openSettings()), this, SLOT(openSettings()));
QObject::connect(settingsWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings()));
// start at onboarding
main_layout->setCurrentWidget(onboardingWindow);
QObject::connect(onboardingWindow, SIGNAL(onboardingDone()), this, SLOT(closeSettings()));
onboardingWindow->updateActiveScreen();
setStyleSheet(R"(
* {
color: white;
background-color: #072339;
}
)");
}
void MainWindow::openSettings() {
main_layout->setCurrentWidget(settingsWindow);
}
void MainWindow::closeSettings() {
main_layout->setCurrentWidget(homeWindow);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event){
if (event->type() == QEvent::MouseButtonPress) {
homeWindow->glWindow->wake();
}
return false;
}