From e418e2e4b6baf60074987339efe96c156ccaee91 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 2 Dec 2014 21:05:04 -0800 Subject: [PATCH] Hide splash screen Also restructured code to remove duplication --- src/QGCMessageBox.h | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/QGCMessageBox.h b/src/QGCMessageBox.h index 987171513..659a7a57c 100644 --- a/src/QGCMessageBox.h +++ b/src/QGCMessageBox.h @@ -87,48 +87,35 @@ private: return (parent == NULL) ? MainWindow::instance() : parent; } -#ifdef Q_OS_MAC static StandardButton _messageBox(Icon icon, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton, QWidget* parent) { // You can't use QGCMessageBox if QGCApplication is not created yet. Q_ASSERT(qgcApp()); parent = _validateParameters(buttons, &defaultButton, parent); + + if (MainWindow::instance()) { + MainWindow::instance()->hideSplashScreen(); + } #ifdef QT_DEBUG if (qgcApp()->runningUnitTests()) { return UnitTest::_messageBox(icon, title, text, buttons, defaultButton); } else -#endif // QT_DEBUG +#endif { +#ifdef Q_OS_MAC QString emptyTitle; QMessageBox box(icon, emptyTitle, title, buttons, parent); box.setDefaultButton(defaultButton); box.setInformativeText(text); - return static_cast(box.exec()); - } - } #else - static StandardButton _messageBox(Icon icon, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton, QWidget* parent) - { - // You can't use QGCMessageBox if QGCApplication is not created yet. - Q_ASSERT(qgcApp()); - - parent = _validateParameters(buttons, &defaultButton, parent); - -#ifdef QT_DEBUG - if (qgcApp()->runningUnitTests()) { - return UnitTest::_messageBox(icon, title, text, buttons, defaultButton); - } else -#endif // QT_DEBUG - { QMessageBox box(icon, title, text, buttons, parent); box.setDefaultButton(defaultButton); +#endif return static_cast(box.exec()); } } - -#endif // Q_OS_MAC }; #endif -- 2.22.0