From 076813e8665d8bb57221318b722a8fd8c46365cd Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 3 Nov 2019 17:01:17 +0100 Subject: [PATCH] [PTT] Make sure the "other" PTT keys light the LEDs and play notification Remark: Eventually it would be best to really hook up with audio to display the PTT key really consumed (instead directly consuming the action) --- .../components/infobarstatuscomponent.cpp | 21 +++++++++++++++++++ .../components/infobarstatuscomponent.h | 12 +++++++++-- src/swiftguistandard/swiftguistd.h | 4 +++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/blackgui/components/infobarstatuscomponent.cpp b/src/blackgui/components/infobarstatuscomponent.cpp index 2a684d992..59d61c40d 100644 --- a/src/blackgui/components/infobarstatuscomponent.cpp +++ b/src/blackgui/components/infobarstatuscomponent.cpp @@ -82,6 +82,10 @@ namespace BlackGui { ui->led_Audio->setOn(!sGui->getCContextAudioBase()->isMuted()); connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedMute, this, &CInfoBarStatusComponent::onMuteChanged); + + // PTT as received on audio + // that also would need to be reconnected if audio is disabled/enabled + // connect(sGui->getCContextAudioBase(), &CContextAudioBase::ptt, this, &CInfoBarStatusComponent::onPttChanged, Qt::QueuedConnection); } QPointer myself(this); @@ -262,6 +266,23 @@ namespace BlackGui ui->led_Ptt->setOn(enabled); } + void CInfoBarStatusComponent::onAudioPtt(bool active, PTTCOM pttcom, const CIdentifier &identifier) + { + // those here come directly from AUDIO client, + // we display COM1/2 directly, but COM is directly hooked up with onPttChanged + + Q_UNUSED(identifier) + Q_UNUSED(active) + Q_UNUSED(pttcom) + + /** + if (pttcom == COM1 || pttcom == COM2) + { + this->onPttChanged(active); + } + **/ + } + void CInfoBarStatusComponent::onInternetAccessibleChanged(bool access) { if (access) diff --git a/src/blackgui/components/infobarstatuscomponent.h b/src/blackgui/components/infobarstatuscomponent.h index b6f56f155..81deac097 100644 --- a/src/blackgui/components/infobarstatuscomponent.h +++ b/src/blackgui/components/infobarstatuscomponent.h @@ -13,6 +13,8 @@ #include "blackcore/actionbind.h" #include "blackgui/blackguiexport.h" + +#include "blackmisc/audio/ptt.h" #include "blackmisc/input/actionhotkeydefs.h" #include "blackmisc/network/connectionstatus.h" @@ -59,7 +61,10 @@ namespace BlackGui private: QScopedPointer ui; - BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CInfoBarStatusComponent::onPttChanged }; + BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CInfoBarStatusComponent::onPttChanged }; + BlackCore::CActionBind m_actionPtt1 { BlackMisc::Input::pttCom1HotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CInfoBarStatusComponent::onPttChanged }; + BlackCore::CActionBind m_actionPtt2 { BlackMisc::Input::pttCom2HotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CInfoBarStatusComponent::onPttChanged }; + BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 50 }; //! Init the LEDs @@ -83,9 +88,12 @@ namespace BlackGui //! Mapper is ready void onMapperReady(); - //! Ptt button changed + //! PTT button changed void onPttChanged(bool enabled); + //! PTT, as received in in audio + void onAudioPtt(bool active, BlackMisc::Audio::PTTCOM pttcom, const BlackMisc::CIdentifier &identifier); + //! Internet accessible? void onInternetAccessibleChanged(bool access); diff --git a/src/swiftguistandard/swiftguistd.h b/src/swiftguistandard/swiftguistd.h index 45546e45f..6831b069f 100644 --- a/src/swiftguistandard/swiftguistd.h +++ b/src/swiftguistandard/swiftguistd.h @@ -122,7 +122,9 @@ private: QScopedPointer m_mapDialog; //!< map dialog QScopedPointer m_validationDialog; //!< aircraft model validation dialog BlackMisc::CData m_lastAutoPublish { this }; - BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::CIcons::StandardIconRadio16, this, &SwiftGuiStd::onPttChanged }; + BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::CIcons::StandardIconRadio16, this, &SwiftGuiStd::onPttChanged }; + BlackCore::CActionBind m_actionPtt1 { BlackMisc::Input::pttCom1HotkeyAction(), BlackMisc::CIcons::StandardIconRadio16, this, &SwiftGuiStd::onPttChanged }; + BlackCore::CActionBind m_actionPtt2 { BlackMisc::Input::pttCom2HotkeyAction(), BlackMisc::CIcons::StandardIconRadio16, this, &SwiftGuiStd::onPttChanged }; BlackCore::CActionBindings m_menuHotkeyHandlers; BlackGui::CManagedStatusBar m_statusBar; BlackMisc::CLogSubscriber m_logSubscriber { this, &SwiftGuiStd::displayStatusMessageInGui };