From 19f5ad8cabcef647c52c2912c2f9d49ff6dba0da Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Tue, 23 Jun 2015 17:10:49 -0700 Subject: [PATCH] Add delay routine to MainWindow to allow sleep in a Qt friendly way #4823 --- src/gui/src/MainWindow.cpp | 9 +++++++++ src/gui/src/MainWindow.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 1ecfde01..fa09d8ad 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -1351,3 +1351,12 @@ QString MainWindow::getProfileRootForArg() return QString("\"%1\"").arg(dir); } + +void MainWindow::delay(unsigned int s) +{ + QTime dieTime= QTime::currentTime().addSecs(s); + + while( QTime::currentTime() < dieTime ) { + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + } +} diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 80b1dbb4..7f81d177 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -63,6 +63,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase friend class QSynergyApplication; friend class SetupWizard; + friend class PluginWizardPage; public: enum qSynergyState @@ -108,6 +109,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void serverDetected(const QString name); void setEdition(int type); void updateLocalFingerprint(); + void delay(unsigned int); public slots: void appendLogRaw(const QString& text);