Qt ui: close settings on onroad transition (#20114)

* need to test

* works

* reduce diff

* refactor

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: dab2e1298b
commatwo_master
grekiki 4 years ago committed by GitHub
parent aa5575dd06
commit 2b6237dd4c
  1. 1
      selfdrive/ui/qt/home.cc
  2. 1
      selfdrive/ui/qt/home.hpp
  3. 7
      selfdrive/ui/qt/window.cc
  4. 1
      selfdrive/ui/qt/window.hpp

@ -143,6 +143,7 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
home = new OffroadHome();
layout->addWidget(home, 0, 0);
QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), this, SLOT(setVisibility(bool)));
QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), this, SIGNAL(offroadTransition(bool)));
QObject::connect(this, SIGNAL(openSettings()), home, SLOT(refresh()));
setLayout(layout);
setStyleSheet(R"(

@ -83,6 +83,7 @@ public:
GLWindow* glWindow;
signals:
void offroadTransition(bool offroad);
void openSettings();
protected:

@ -15,6 +15,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
main_layout->setMargin(0);
setLayout(main_layout);
QObject::connect(homeWindow, SIGNAL(openSettings()), this, SLOT(openSettings()));
QObject::connect(homeWindow, SIGNAL(offroadTransition(bool)), this, SLOT(offroadTransition(bool)));
QObject::connect(settingsWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings()));
// start at onboarding
@ -29,6 +30,12 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
)");
}
void MainWindow::offroadTransition(bool offroad){
if(!offroad){
closeSettings();
}
}
void MainWindow::openSettings() {
main_layout->setCurrentWidget(settingsWindow);
}

@ -23,6 +23,7 @@ private:
OnboardingWindow *onboardingWindow;
public slots:
void offroadTransition(bool offroad);
void openSettings();
void closeSettings();
};

Loading…
Cancel
Save