diff --git a/src/blackcore/afv/clients/afvclient.cpp b/src/blackcore/afv/clients/afvclient.cpp index c0baa2fb9..98b6cdfc6 100644 --- a/src/blackcore/afv/clients/afvclient.cpp +++ b/src/blackcore/afv/clients/afvclient.cpp @@ -144,7 +144,13 @@ namespace BlackCore } const bool integrated = sApp->getIContextSimulator()->getSimulatorSettings().isComIntegrated(); + const bool changed = integrated != m_integratedComUnit; + m_integratedComUnit = integrated; + if (changed) + { + emit this->updatedFromOwnAircraftCockpit(); + } } void CAfvClient::connectTo(const QString &cid, const QString &password, const QString &callsign, const QString &client) diff --git a/src/blackcore/afv/clients/afvclient.h b/src/blackcore/afv/clients/afvclient.h index 6d1deebb9..838e79b8a 100644 --- a/src/blackcore/afv/clients/afvclient.h +++ b/src/blackcore/afv/clients/afvclient.h @@ -129,6 +129,10 @@ namespace BlackCore void restartAudio(); //! @} + //! Is integrated with COM unit + //! \threadsafe + bool isComUnitIntegrated() const { return m_integratedComUnit; } + //! The device's volume 0..1 @{ double getDeviceInputVolume() const; bool setDeviceInputVolume(double volume); diff --git a/src/blackcore/context/contextaudio.cpp b/src/blackcore/context/contextaudio.cpp index 3209502ba..82711772d 100644 --- a/src/blackcore/context/contextaudio.cpp +++ b/src/blackcore/context/contextaudio.cpp @@ -305,6 +305,11 @@ namespace BlackCore return m_voiceClient && m_voiceClient->isStarted(); } + bool CContextAudioBase::isComUnitIntegrated() const + { + return m_voiceClient && m_voiceClient->isComUnitIntegrated(); + } + const QList &CContextAudioBase::getCmdLineOptions() { static const QList opts diff --git a/src/blackcore/context/contextaudio.h b/src/blackcore/context/contextaudio.h index cfb8408ed..45b000c86 100644 --- a/src/blackcore/context/contextaudio.h +++ b/src/blackcore/context/contextaudio.h @@ -218,6 +218,9 @@ namespace BlackCore //! Is audio enabled? bool isAudioEnabled() const { return m_voiceClient; } + //! Integrated with COM unit? + bool isComUnitIntegrated() const; + //! \todo WORKAROUND to hide the "local signals" Afv::Clients::CAfvClient *afvClient() const { return m_voiceClient; } @@ -280,7 +283,7 @@ namespace BlackCore /** Workaround those must be invisible for DBus //! VU levels @{ - void inputVolumePeakVU(double value); + void inputVolumePeakVU (double value); void outputVolumePeakVU(double value); //! @} @@ -290,7 +293,7 @@ namespace BlackCore //! Client updated from own aicraft data void updatedFromOwnAircraftCockpit(); - Workaround **/ + ** Workaround **/ // ------------ local signals ------- diff --git a/src/blackgui/components/audiodevicevolumesetupcomponent.cpp b/src/blackgui/components/audiodevicevolumesetupcomponent.cpp index 36ca4392a..ba0c62e2e 100644 --- a/src/blackgui/components/audiodevicevolumesetupcomponent.cpp +++ b/src/blackgui/components/audiodevicevolumesetupcomponent.cpp @@ -154,6 +154,7 @@ namespace BlackGui { if (!myself || !sGui || sGui->isShuttingDown()) { return; } myself->setTransmitReceiveInUiFromVoiceClient(); + }, ct); Q_ASSERT(c); m_afvConnections.append(c); @@ -216,12 +217,14 @@ namespace BlackGui ui->le_Info->setToolTip(info); } - void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUi(bool tx1, bool rec1, bool tx2, bool rec2) + void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUi(bool tx1, bool rec1, bool tx2, bool rec2, bool integrated) { ui->cb_1Tx->setChecked(tx1); ui->cb_2Tx->setChecked(tx2); ui->cb_1Rec->setChecked(rec1); ui->cb_2Rec->setChecked(rec2); + + ui->cb_IntegratedWithCom->setChecked(integrated); } void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient() @@ -245,7 +248,8 @@ namespace BlackGui const bool com1Rx = com1Enabled; const bool com2Rx = com2Enabled; - this->setTransmitReceiveInUi(com1Tx, com1Rx, com2Tx, com2Rx); + const bool integrated = sGui->getCContextAudioBase()->isComUnitIntegrated(); + this->setTransmitReceiveInUi(com1Tx, com1Rx, com2Tx, com2Rx, integrated); } CAfvClient *CAudioDeviceVolumeSetupComponent::afvClient() diff --git a/src/blackgui/components/audiodevicevolumesetupcomponent.h b/src/blackgui/components/audiodevicevolumesetupcomponent.h index 5cb92cb51..01e245a8d 100644 --- a/src/blackgui/components/audiodevicevolumesetupcomponent.h +++ b/src/blackgui/components/audiodevicevolumesetupcomponent.h @@ -118,10 +118,11 @@ namespace BlackGui BlackMisc::Audio::CAudioDeviceInfo getSelectedOutputDevice() const; //! Transmit and receive state @{ - void setTransmitReceiveInUi(bool tx1, bool rec1, bool tx2, bool rec2); + void setTransmitReceiveInUi(bool tx1, bool rec1, bool tx2, bool rec2, bool integrated); void setTransmitReceiveInUiFromVoiceClient(); //! @} + //! Direct access to client static BlackCore::Afv::Clients::CAfvClient *afvClient(); bool m_init = false; diff --git a/src/blackgui/components/audiodevicevolumesetupcomponent.ui b/src/blackgui/components/audiodevicevolumesetupcomponent.ui index 0d27a24f7..ba81a828a 100644 --- a/src/blackgui/components/audiodevicevolumesetupcomponent.ui +++ b/src/blackgui/components/audiodevicevolumesetupcomponent.ui @@ -6,14 +6,14 @@ 0 0 - 243 - 267 + 340 + 272 Audio setup - + @@ -93,7 +93,7 @@ ... - + :/diagona/icons/diagona/icons/arrow-circle-135.png:/diagona/icons/diagona/icons/arrow-circle-135.png @@ -190,6 +190,16 @@ + + + + integrated with sim. cockpit + + + sync. + + + @@ -221,7 +231,7 @@ ... - + :/diagona/icons/diagona/icons/arrow-circle-135.png:/diagona/icons/diagona/icons/arrow-circle-135.png @@ -313,6 +323,7 @@ cb_1Rec cb_2Tx cb_2Rec + cb_IntegratedWithCom cb_SetupAudioInputDevice tb_RefreshInDevice cb_SetupAudioOutputDevice @@ -324,6 +335,8 @@ hs_VolumeOut tb_ResetOutVolume - + + +