diff --git a/mainwindow.cpp b/mainwindow.cpp index a2be1bb..09c2c4d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -962,10 +962,8 @@ void MainWindow::showToast(QString messageToDisplay) { toastWindow->show(); if(messageToDisplay == "Connection successful") { - - otaManagerWindow = new otaManager(this); - connect(otaManagerWindow, SIGNAL(canOtaUpdate(bool)), SLOT(openUpdateDialogOTA(bool))); - otaManagerWindow->setAttribute(Qt::WA_DeleteOnClose); + // Give the toast some time to vanish away + QTimer::singleShot(5000, this, SLOT(launchOtaUpdater())); } } @@ -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); +} diff --git a/mainwindow.h b/mainwindow.h index edc2cc3..c2c80b7 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -84,6 +84,7 @@ private slots: void showToast(QString messageToDisplay); void closeIndefiniteToast(); void openUpdateDialogOTA(bool open); + void launchOtaUpdater(); private: Ui::MainWindow *ui;