[AFV] Displayed sync. (integrated with COM unit) flag in cockpit

This commit is contained in:
Klaus Basan
2020-03-25 00:33:34 +01:00
committed by Mat Sutcliffe
parent 1b2f470cd6
commit 7d4e897b88
7 changed files with 47 additions and 11 deletions

View File

@@ -144,7 +144,13 @@ namespace BlackCore
} }
const bool integrated = sApp->getIContextSimulator()->getSimulatorSettings().isComIntegrated(); const bool integrated = sApp->getIContextSimulator()->getSimulatorSettings().isComIntegrated();
const bool changed = integrated != m_integratedComUnit;
m_integratedComUnit = integrated; m_integratedComUnit = integrated;
if (changed)
{
emit this->updatedFromOwnAircraftCockpit();
}
} }
void CAfvClient::connectTo(const QString &cid, const QString &password, const QString &callsign, const QString &client) void CAfvClient::connectTo(const QString &cid, const QString &password, const QString &callsign, const QString &client)

View File

@@ -129,6 +129,10 @@ namespace BlackCore
void restartAudio(); void restartAudio();
//! @} //! @}
//! Is integrated with COM unit
//! \threadsafe
bool isComUnitIntegrated() const { return m_integratedComUnit; }
//! The device's volume 0..1 @{ //! The device's volume 0..1 @{
double getDeviceInputVolume() const; double getDeviceInputVolume() const;
bool setDeviceInputVolume(double volume); bool setDeviceInputVolume(double volume);

View File

@@ -305,6 +305,11 @@ namespace BlackCore
return m_voiceClient && m_voiceClient->isStarted(); return m_voiceClient && m_voiceClient->isStarted();
} }
bool CContextAudioBase::isComUnitIntegrated() const
{
return m_voiceClient && m_voiceClient->isComUnitIntegrated();
}
const QList<QCommandLineOption> &CContextAudioBase::getCmdLineOptions() const QList<QCommandLineOption> &CContextAudioBase::getCmdLineOptions()
{ {
static const QList<QCommandLineOption> opts static const QList<QCommandLineOption> opts

View File

@@ -218,6 +218,9 @@ namespace BlackCore
//! Is audio enabled? //! Is audio enabled?
bool isAudioEnabled() const { return m_voiceClient; } bool isAudioEnabled() const { return m_voiceClient; }
//! Integrated with COM unit?
bool isComUnitIntegrated() const;
//! \todo WORKAROUND to hide the "local signals" //! \todo WORKAROUND to hide the "local signals"
Afv::Clients::CAfvClient *afvClient() const { return m_voiceClient; } Afv::Clients::CAfvClient *afvClient() const { return m_voiceClient; }
@@ -280,7 +283,7 @@ namespace BlackCore
/** Workaround those must be invisible for DBus /** Workaround those must be invisible for DBus
//! VU levels @{ //! VU levels @{
void inputVolumePeakVU(double value); void inputVolumePeakVU (double value);
void outputVolumePeakVU(double value); void outputVolumePeakVU(double value);
//! @} //! @}
@@ -290,7 +293,7 @@ namespace BlackCore
//! Client updated from own aicraft data //! Client updated from own aicraft data
void updatedFromOwnAircraftCockpit(); void updatedFromOwnAircraftCockpit();
Workaround **/ ** Workaround **/
// ------------ local signals ------- // ------------ local signals -------

View File

@@ -154,6 +154,7 @@ namespace BlackGui
{ {
if (!myself || !sGui || sGui->isShuttingDown()) { return; } if (!myself || !sGui || sGui->isShuttingDown()) { return; }
myself->setTransmitReceiveInUiFromVoiceClient(); myself->setTransmitReceiveInUiFromVoiceClient();
}, ct); }, ct);
Q_ASSERT(c); Q_ASSERT(c);
m_afvConnections.append(c); m_afvConnections.append(c);
@@ -216,12 +217,14 @@ namespace BlackGui
ui->le_Info->setToolTip(info); 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_1Tx->setChecked(tx1);
ui->cb_2Tx->setChecked(tx2); ui->cb_2Tx->setChecked(tx2);
ui->cb_1Rec->setChecked(rec1); ui->cb_1Rec->setChecked(rec1);
ui->cb_2Rec->setChecked(rec2); ui->cb_2Rec->setChecked(rec2);
ui->cb_IntegratedWithCom->setChecked(integrated);
} }
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient() void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient()
@@ -245,7 +248,8 @@ namespace BlackGui
const bool com1Rx = com1Enabled; const bool com1Rx = com1Enabled;
const bool com2Rx = com2Enabled; 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() CAfvClient *CAudioDeviceVolumeSetupComponent::afvClient()

View File

@@ -118,10 +118,11 @@ namespace BlackGui
BlackMisc::Audio::CAudioDeviceInfo getSelectedOutputDevice() const; BlackMisc::Audio::CAudioDeviceInfo getSelectedOutputDevice() const;
//! Transmit and receive state @{ //! 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(); void setTransmitReceiveInUiFromVoiceClient();
//! @} //! @}
//! Direct access to client
static BlackCore::Afv::Clients::CAfvClient *afvClient(); static BlackCore::Afv::Clients::CAfvClient *afvClient();
bool m_init = false; bool m_init = false;

View File

@@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>243</width> <width>340</width>
<height>267</height> <height>272</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Audio setup</string> <string>Audio setup</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gl_AudioDeviceVolumeSetupComponent">
<item row="9" column="0"> <item row="9" column="0">
<widget class="QToolButton" name="tb_ResetInVolume"> <widget class="QToolButton" name="tb_ResetInVolume">
<property name="text"> <property name="text">
@@ -93,7 +93,7 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="../../blackmisc/blackmisc.qrc">
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</iconset> <normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</iconset>
</property> </property>
</widget> </widget>
@@ -190,6 +190,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="cb_IntegratedWithCom">
<property name="toolTip">
<string>integrated with sim. cockpit</string>
</property>
<property name="text">
<string>sync.</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -221,7 +231,7 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="../../blackmisc/blackmisc.qrc">
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</iconset> <normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</iconset>
</property> </property>
</widget> </widget>
@@ -313,6 +323,7 @@
<tabstop>cb_1Rec</tabstop> <tabstop>cb_1Rec</tabstop>
<tabstop>cb_2Tx</tabstop> <tabstop>cb_2Tx</tabstop>
<tabstop>cb_2Rec</tabstop> <tabstop>cb_2Rec</tabstop>
<tabstop>cb_IntegratedWithCom</tabstop>
<tabstop>cb_SetupAudioInputDevice</tabstop> <tabstop>cb_SetupAudioInputDevice</tabstop>
<tabstop>tb_RefreshInDevice</tabstop> <tabstop>tb_RefreshInDevice</tabstop>
<tabstop>cb_SetupAudioOutputDevice</tabstop> <tabstop>cb_SetupAudioOutputDevice</tabstop>
@@ -324,6 +335,8 @@
<tabstop>hs_VolumeOut</tabstop> <tabstop>hs_VolumeOut</tabstop>
<tabstop>tb_ResetOutVolume</tabstop> <tabstop>tb_ResetOutVolume</tabstop>
</tabstops> </tabstops>
<resources/> <resources>
<include location="../../blackmisc/blackmisc.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>