Delay OTA check after successful network connection

This commit is contained in:
Nicolas Mailloux 2021-08-19 11:11:16 -04:00
parent eab27fabd9
commit b8f4da12f7
2 changed files with 9 additions and 4 deletions

View file

@ -962,10 +962,8 @@ void MainWindow::showToast(QString messageToDisplay) {
toastWindow->show(); toastWindow->show();
if(messageToDisplay == "Connection successful") { if(messageToDisplay == "Connection successful") {
// Give the toast some time to vanish away
otaManagerWindow = new otaManager(this); QTimer::singleShot(5000, this, SLOT(launchOtaUpdater()));
connect(otaManagerWindow, SIGNAL(canOtaUpdate(bool)), SLOT(openUpdateDialogOTA(bool)));
otaManagerWindow->setAttribute(Qt::WA_DeleteOnClose);
} }
} }
@ -987,3 +985,9 @@ void MainWindow::openUpdateDialogOTA(bool open) {
; ;
} }
} }
void MainWindow::launchOtaUpdater() {
otaManagerWindow = new otaManager(this);
connect(otaManagerWindow, SIGNAL(canOtaUpdate(bool)), SLOT(openUpdateDialogOTA(bool)));
otaManagerWindow->setAttribute(Qt::WA_DeleteOnClose);
}

View file

@ -84,6 +84,7 @@ private slots:
void showToast(QString messageToDisplay); void showToast(QString messageToDisplay);
void closeIndefiniteToast(); void closeIndefiniteToast();
void openUpdateDialogOTA(bool open); void openUpdateDialogOTA(bool open);
void launchOtaUpdater();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;