diff --git a/src/blackgui/components/dbmappingcomponent.cpp b/src/blackgui/components/dbmappingcomponent.cpp index 757341248..1e9af20c4 100644 --- a/src/blackgui/components/dbmappingcomponent.cpp +++ b/src/blackgui/components/dbmappingcomponent.cpp @@ -134,6 +134,10 @@ namespace BlackGui // vPilot this->initVPilotLoading(); + // overlay + this->showKillButton(false); + + // user changes m_swiftDbUser.setNotifySlot(&CDbMappingComponent::ps_userChanged); } diff --git a/src/blackgui/overlaymessages.cpp b/src/blackgui/overlaymessages.cpp index 6fed63458..77008782e 100644 --- a/src/blackgui/overlaymessages.cpp +++ b/src/blackgui/overlaymessages.cpp @@ -135,8 +135,8 @@ namespace BlackGui void COverlayMessages::showKill(bool show) { - ui->tb_Kill->setVisible(show); - ui->tb_Kill->setEnabled(show); + ui->tb_Kill->setVisible(m_hasKillButton && show); + ui->tb_Kill->setEnabled(m_hasKillButton && show); } bool COverlayMessages::displayTextMessage(const CTextMessage &textMessage) const @@ -289,6 +289,11 @@ namespace BlackGui } } + void COverlayMessages::showKillButton(bool killButton) + { + this->m_hasKillButton = killButton; + } + void COverlayMessages::setModeToMessages(bool withKillButton) { ui->sw_StatusMessagesComponent->setCurrentWidget(ui->pg_StatusMessages); diff --git a/src/blackgui/overlaymessages.h b/src/blackgui/overlaymessages.h index 4a62155d8..1b5020608 100644 --- a/src/blackgui/overlaymessages.h +++ b/src/blackgui/overlaymessages.h @@ -99,6 +99,9 @@ namespace BlackGui //! Display one of the supported types void showOverlayVariant(const BlackMisc::CVariant &variant, int timeOutMs = -1); + //! Allows to globally enable/disable kill button + void showKillButton(bool killButton); + //! Close button clicked void close(); @@ -141,6 +144,7 @@ namespace BlackGui QString m_header; int m_lastConfirmation = QMessageBox::Cancel; bool m_awaitingConfirmation = false; + bool m_hasKillButton = false; std::function m_okLambda; QTimer m_autoCloseTimer { this }; QList> m_pendingMessageCalls; @@ -154,7 +158,8 @@ namespace BlackGui //! Small bool useSmall() const; - //! Show kill button + //! Show kill button? + //! \sa COverlayMessages::showKillButton globally enable/disable kill button void showKill(bool show); //! Display this message (use settings to decide) diff --git a/src/blackgui/overlaymessagesframe.cpp b/src/blackgui/overlaymessagesframe.cpp index 3ec16e9f9..43c856e2b 100644 --- a/src/blackgui/overlaymessagesframe.cpp +++ b/src/blackgui/overlaymessagesframe.cpp @@ -33,6 +33,14 @@ namespace BlackGui this->initInnerFrame(); } + void COverlayMessagesFrame::showKillButton(bool killButton) + { + if (m_overlayMessages) + { + m_overlayMessages->showKillButton(killButton); + } + } + void COverlayMessagesFrame::hideStatusMessagesFrame() { if (!m_overlayMessages) { return; } diff --git a/src/blackgui/overlaymessagesframe.h b/src/blackgui/overlaymessagesframe.h index a1769ca30..91ab2d83a 100644 --- a/src/blackgui/overlaymessagesframe.h +++ b/src/blackgui/overlaymessagesframe.h @@ -52,6 +52,9 @@ namespace BlackGui //! Show the inner frame void showStatusMessagesFrame(); + //! Show kill button + void showKillButton(bool killButton); + //! Hide the inner frame void hideStatusMessagesFrame();