From f2722d78f7bf61b744f5c42153a87675eab8d788 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 7 Jan 2019 19:56:43 +0100 Subject: [PATCH] Ref T506, only use displayInInfoWindow if not an overlay text message widget --- src/blackgui/components/textmessagecomponent.cpp | 10 ++++++++-- src/blackgui/components/textmessagecomponent.h | 6 +++++- src/swiftguistandard/swiftguistdinit.cpp | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/blackgui/components/textmessagecomponent.cpp b/src/blackgui/components/textmessagecomponent.cpp index 573857318..d5e547448 100644 --- a/src/blackgui/components/textmessagecomponent.cpp +++ b/src/blackgui/components/textmessagecomponent.cpp @@ -191,7 +191,7 @@ namespace BlackGui if (msgSettings.popupSelcalMessages()) { - emit this->displayInInfoWindow(CLogMessage(this).info(u"SELCAL received"), 3 * 1000); + this->emitDisplayInInfoWindow(CLogMessage(this).info(u"SELCAL received"), 3 * 1000); } continue; } @@ -246,7 +246,7 @@ namespace BlackGui { if (msgSettings.popup(message, ownAircraft)) { - emit this->displayInInfoWindow(CVariant::from(message), 5 * 1000); + this->emitDisplayInInfoWindow(CVariant::from(message), 15 * 1000); } } } // message @@ -537,6 +537,12 @@ namespace BlackGui return m_usedAsOverlayWidget ? true : this->isVisibleWidget(); } + void CTextMessageComponent::emitDisplayInInfoWindow(const CVariant &message, int displayDurationMs) + { + if (m_usedAsOverlayWidget) { return; } + emit this->displayInInfoWindow(message, displayDurationMs); + } + void CTextMessageComponent::handleEnteredTextMessage(const QString &textMessage) { if (!this->isVisibleWidgetHack()) { return; } diff --git a/src/blackgui/components/textmessagecomponent.h b/src/blackgui/components/textmessagecomponent.h index 0636ae4c5..d77c61833 100644 --- a/src/blackgui/components/textmessagecomponent.h +++ b/src/blackgui/components/textmessagecomponent.h @@ -103,7 +103,8 @@ namespace BlackGui void updateAtcStationsButtons(); signals: - //! Message to be displayed in info window + //! Message to be displayed in central info window + //! \remark do not emit in overlay messages void displayInInfoWindow(const BlackMisc::CVariant &message, int displayDurationMs); //! Command line was entered @@ -213,6 +214,9 @@ namespace BlackGui //! Visible widget hack bool isVisibleWidgetHack() const; + + //! Emit the display in info window signal + void emitDisplayInInfoWindow(const BlackMisc::CVariant &message, int displayDurationMs); }; } // ns } // ns diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index d08971429..4aa003722 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -232,6 +232,8 @@ void SwiftGuiStd::initGuiSignals() connect(m_navigator.data(), &CNavigatorDialog::navigatorClosed, this, &SwiftGuiStd::onNavigatorClosed); // command line / text messages + // here we display SUP messages and such in a central window + ui->fr_CentralFrameInside->activateTextMessages(true); connect(ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, ui->fr_CentralFrameInside, &COverlayMessagesFrame::showOverlayVariant); // settings (GUI component), styles