mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
[AFV] Ref T731, added LEDs/text if received on COM1/COM2
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <QtGlobal>
|
||||
#include <QPointer>
|
||||
#include <QFileDialog>
|
||||
#include <QStringLiteral>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Afv::Audio;
|
||||
@@ -45,8 +46,8 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
connect(ui->hs_VolumeIn, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->hs_VolumeOut, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->tb_RefreshInDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_RefreshOutDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_RefreshInDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_RefreshOutDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetInVolume, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeIn, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetOutVolume, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeOut, Qt::QueuedConnection);
|
||||
|
||||
@@ -63,6 +64,13 @@ namespace BlackGui
|
||||
ui->cb_SetupAudioLoopback->setChecked(false);
|
||||
ui->cb_DisableAudioEffects->setChecked(!as.isAudioEffectsEnabled());
|
||||
|
||||
ui->led_AudioConnected->setToolTips("Voice on and authenticated", "Voice off");
|
||||
ui->led_AudioConnected->setShape(CLedWidget::Rounded);
|
||||
ui->led_Rx1->setToolTips("COM1 receiving", "COM1 idle");
|
||||
ui->led_Rx1->setShape(CLedWidget::Rounded);
|
||||
ui->led_Rx2->setToolTips("COM2 receiving", "COM2 idle");
|
||||
ui->led_Rx2->setShape(CLedWidget::Rounded);
|
||||
|
||||
// deferred init, because in a distributed swift system
|
||||
// it takes a moment until the settings are sychronized
|
||||
// this is leading to undesired "save settings" messages and played sounds
|
||||
@@ -74,7 +82,7 @@ namespace BlackGui
|
||||
});
|
||||
|
||||
// all tx/rec checkboxes
|
||||
CGuiUtility::checkBoxesReadOnly(ui->fr_TxRec, true);
|
||||
CGuiUtility::checkBoxesReadOnly(ui->fr_TxRx, true);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::init()
|
||||
@@ -122,7 +130,7 @@ namespace BlackGui
|
||||
c = connect(sGui->getCContextAudioBase()->afvClient(), &CAfvClient::inputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onInputVU, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
|
||||
c = connect(sGui->getCContextAudioBase()->afvClient(), &CAfvClient::receivingCallsignsChanged, this, &CAudioDeviceVolumeSetupComponent::onReceivingCallsignsChanged, Qt::QueuedConnection);
|
||||
c = connect(sGui->getCContextAudioBase()->afvClient(), &CAfvClient::receivedCallsignsChanged, this, &CAudioDeviceVolumeSetupComponent::onReceivingCallsignsChanged, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
|
||||
c = connect(sGui->getCContextAudioBase()->afvClient(), &CAfvClient::updatedFromOwnAircraftCockpit, this, &CAudioDeviceVolumeSetupComponent::onUpdatedClientWithCockpitData, Qt::QueuedConnection);
|
||||
@@ -197,14 +205,22 @@ namespace BlackGui
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient()
|
||||
{
|
||||
if (!this->hasAudio()) { return; }
|
||||
if (!this->hasAudio())
|
||||
{
|
||||
ui->led_AudioConnected->setOn(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool on = sGui->getCContextAudioBase()->isAudioConnected();
|
||||
ui->led_AudioConnected->setOn(on);
|
||||
|
||||
const bool com1Enabled = sGui->getCContextAudioBase()->isEnabledComUnit(CComSystem::Com1);
|
||||
const bool com2Enabled = sGui->getCContextAudioBase()->isEnabledComUnit(CComSystem::Com2);
|
||||
|
||||
const bool com1Tx = com1Enabled && sGui->getCContextAudioBase()->isTransmittingComUnit(CComSystem::Com1);
|
||||
const bool com2Tx = com2Enabled && sGui->getCContextAudioBase()->isTransmittingComUnit(CComSystem::Com2);
|
||||
|
||||
// we do not have receiving
|
||||
// we do not have receiving, so we use enable
|
||||
const bool com1Rx = com1Enabled;
|
||||
const bool com2Rx = com2Enabled;
|
||||
|
||||
@@ -279,9 +295,15 @@ namespace BlackGui
|
||||
ui->hs_VolumeOut->setValue((ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum()) / 2);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onReceivingCallsignsChanged(const TransceiverReceivingCallsignsChangedArgs &args)
|
||||
void CAudioDeviceVolumeSetupComponent::onReceivingCallsignsChanged(const CCallsignSet &com1Callsigns, const CCallsignSet &com2Callsigns)
|
||||
{
|
||||
this->setInfo(args.receivingCallsigns.join(", "));
|
||||
const QString info = (com1Callsigns.isEmpty() ? QString() : QStringLiteral("COM1: ") % com1Callsigns.getCallsignsAsString()) %
|
||||
(!com1Callsigns.isEmpty() && !com2Callsigns.isEmpty() ? QStringLiteral(" | ") : QString()) %
|
||||
(com2Callsigns.isEmpty() ? QString() : QStringLiteral("COM2: ") % com2Callsigns.getCallsignsAsString());
|
||||
|
||||
ui->led_Rx1->setOn(!com1Callsigns.isEmpty());
|
||||
ui->led_Rx2->setOn(!com2Callsigns.isEmpty());
|
||||
this->setInfo(info);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onUpdatedClientWithCockpitData()
|
||||
|
||||
@@ -100,8 +100,9 @@ namespace BlackGui
|
||||
void onReloadDevices();
|
||||
void onResetVolumeIn();
|
||||
void onResetVolumeOut();
|
||||
|
||||
// TODO: Move TransceiverReceivingCallsignsChangedArgs to Blackmisc
|
||||
void onReceivingCallsignsChanged(const BlackCore::Afv::Audio::TransceiverReceivingCallsignsChangedArgs &args);
|
||||
void onReceivingCallsignsChanged(const BlackMisc::Aviation::CCallsignSet &com1Callsigns, const BlackMisc::Aviation::CCallsignSet &com2Callsigns);
|
||||
void onUpdatedClientWithCockpitData();
|
||||
|
||||
BlackMisc::Audio::CAudioDeviceInfo getSelectedInputDevice() const;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>200</width>
|
||||
<width>243</width>
|
||||
<height>267</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -123,8 +123,45 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QFrame" name="fr_TxRec">
|
||||
<widget class="QFrame" name="fr_TxRx">
|
||||
<layout class="QHBoxLayout" name="hl_TxRec">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::CLedWidget" name="led_AudioConnected" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::CLedWidget" name="led_Rx1" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::CLedWidget" name="led_Rx2" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_AudioEffects">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_1Tx">
|
||||
<property name="text">
|
||||
@@ -217,13 +254,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioInputDevice">
|
||||
<property name="text">
|
||||
<string>In</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QSlider" name="hs_VolumeOut">
|
||||
<property name="value">
|
||||
@@ -254,6 +284,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioInputDevice">
|
||||
<property name="text">
|
||||
<string>In</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -263,6 +300,12 @@
|
||||
<header>blackgui/levelmeter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CLedWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/led.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_Info</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user