From 32e65669a3cbb6f492481f98cbb0110cb3bd3003 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 21 Apr 2015 01:28:31 +0200 Subject: [PATCH] GUI improvements: naming and better user experience during shutdown --- .../components/infobarstatuscomponent.ui | 6 +-- src/swiftgui_standard/swiftguistd.cpp | 46 +++++++++++-------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/blackgui/components/infobarstatuscomponent.ui b/src/blackgui/components/infobarstatuscomponent.ui index 7ed74aca2..7e533c64b 100644 --- a/src/blackgui/components/infobarstatuscomponent.ui +++ b/src/blackgui/components/infobarstatuscomponent.ui @@ -54,7 +54,7 @@ Network - nt. + net @@ -73,7 +73,7 @@ Simulator - sm. + sim @@ -93,7 +93,7 @@ Mappings ready - mp. + map diff --git a/src/swiftgui_standard/swiftguistd.cpp b/src/swiftgui_standard/swiftguistd.cpp index e2394d008..b18a97c09 100644 --- a/src/swiftgui_standard/swiftguistd.cpp +++ b/src/swiftgui_standard/swiftguistd.cpp @@ -71,32 +71,12 @@ void SwiftGuiStd::mousePressEvent(QMouseEvent *event) void SwiftGuiStd::performGracefulShutdown() { - // clean up GUI - this->ui->comp_MainInfoArea->dockAllWidgets(); - this->ui->comp_InvisibleInfoArea->dockAllWidgets(); - - // close info window - if (this->m_compInfoWindow) - { - this->m_compInfoWindow->close(); - this->m_compInfoWindow = nullptr; - } - if (!this->m_init) { return; } this->m_init = false; - // tell GUI components to shut down - emit requestGracefulShutdown(); - // shut down all timers this->stopAllTimers(true); - // tell context GUI is going down - if (this->getIContextApplication()) - { - this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStops); - } - // if we have a context, we shut some things down if (this->m_contextNetworkAvailable) { @@ -111,6 +91,32 @@ void SwiftGuiStd::performGracefulShutdown() this->getIContextNetwork()->disconnect(this); // avoid any status update signals, etc. } } + + // clean up GUI + this->ui->comp_MainInfoArea->dockAllWidgets(); + this->ui->comp_InvisibleInfoArea->dockAllWidgets(); + + // close info window + if (this->m_compInfoWindow) + { + this->m_compInfoWindow->close(); + this->m_compInfoWindow = nullptr; + } + + // allow some other parts to react + QApplication::processEvents(QEventLoop::AllEvents, 100); + + // tell GUI components to shut down + emit requestGracefulShutdown(); + + // tell context GUI is going down + if (this->getIContextApplication()) + { + this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStops); + } + + // allow some other parts to react + QApplication::processEvents(QEventLoop::AllEvents, 100); } void SwiftGuiStd::closeEvent(QCloseEvent *event)