mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 17:43:54 +08:00
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
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user