diff --git a/src/blackcore/context/contextaudio.cpp b/src/blackcore/context/contextaudio.cpp index 83ceeaeec..d71fa04f1 100644 --- a/src/blackcore/context/contextaudio.cpp +++ b/src/blackcore/context/contextaudio.cpp @@ -227,19 +227,6 @@ namespace BlackCore::Context QObject::disconnect(this); } - void CContextAudioBase::enableVoiceClientAndStart() - { - this->initVoiceClient(); - if (m_voiceClient) - { - m_voiceClient->startAudio(); - const bool connected = this->connectAudioWithNetworkCredentials(); - Q_UNUSED(connected) - - // one reason for not connecting is NOT using the VATSIM ecosystem - } - } - void CContextAudioBase::setRxTx(bool rx1, bool tx1, bool rx2, bool tx2) { if (m_voiceClient) diff --git a/src/blackcore/context/contextaudio.h b/src/blackcore/context/contextaudio.h index e6805523b..084373b49 100644 --- a/src/blackcore/context/contextaudio.h +++ b/src/blackcore/context/contextaudio.h @@ -140,13 +140,6 @@ namespace BlackCore //! Graceful shutdown void gracefulShutdown(); - //! @{ - //! Enable/disable - void enableVoiceClient() { this->initVoiceClient(); } - void enableVoiceClientAndStart(); - void disableVoiceClient() { this->terminateVoiceClient(); } - //! @} - //! @{ //! Receive/transmit void setRxTx(bool rx1, bool tx1, bool rx2, bool tx2); diff --git a/src/blackgui/components/audioadvanceddistributedcomponent.cpp b/src/blackgui/components/audioadvanceddistributedcomponent.cpp index 38ba707a5..659a6a7c3 100644 --- a/src/blackgui/components/audioadvanceddistributedcomponent.cpp +++ b/src/blackgui/components/audioadvanceddistributedcomponent.cpp @@ -19,57 +19,12 @@ namespace BlackGui::Components { ui->setupUi(this); - connect(sGui->getCContextAudioBase(), &CContextAudioBase::startedAudio, this, &CAudioAdvancedDistributedComponent::onAudioStarted, Qt::QueuedConnection); - connect(sGui->getCContextAudioBase(), &CContextAudioBase::stoppedAudio, this, &CAudioAdvancedDistributedComponent::onAudioStoppend, Qt::QueuedConnection); - connect(ui->pb_EnableDisable, &QPushButton::pressed, this, &CAudioAdvancedDistributedComponent::toggleAudioEnableDisable, Qt::QueuedConnection); - connect(ui->pb_StartStop, &QPushButton::pressed, this, &CAudioAdvancedDistributedComponent::toggleAudioStartStop, Qt::QueuedConnection); connect(ui->pb_ReloadRegistered, &QPushButton::pressed, this, &CAudioAdvancedDistributedComponent::reloadRegisteredDevices, Qt::QueuedConnection); - - this->setButtons(); } CAudioAdvancedDistributedComponent::~CAudioAdvancedDistributedComponent() {} - void CAudioAdvancedDistributedComponent::toggleAudioStartStop() - { - if (!hasContexts()) { return; } - const bool started = sGui->getCContextAudioBase()->isAudioStarted(); - if (started) - { - sGui->getCContextAudioBase()->afvClient()->disconnectFromAndStop(); - } - else - { - sGui->getCContextAudioBase()->afvClient()->startAudio(); - if (sGui->getIContextNetwork()->isConnected()) - { - const bool connected = sGui->getCContextAudioBase()->connectAudioWithNetworkCredentials(); - Q_UNUSED(connected) - - // one reason for not connecting is NOT using the VATSIM ecosystem - } - } - - this->setButtons(2000); - } - - void CAudioAdvancedDistributedComponent::toggleAudioEnableDisable() - { - if (!hasContexts()) { return; } - const bool enabled = sGui->getCContextAudioBase()->isAudioEnabled(); - if (enabled) - { - sGui->getCContextAudioBase()->disableVoiceClient(); - } - else - { - sGui->getCContextAudioBase()->enableVoiceClientAndStart(); - } - - this->setButtons(2000); - } - void CAudioAdvancedDistributedComponent::reloadRegisteredDevices() { if (!hasContexts()) { return; } @@ -77,40 +32,6 @@ namespace BlackGui::Components ui->tvp_RegisteredDevices->updateContainerMaybeAsync(registeredDevices); } - void CAudioAdvancedDistributedComponent::setButtons() - { - if (!hasContexts()) { return; } - const bool started = sGui->getCContextAudioBase()->isAudioStarted(); - const bool enabled = sGui->getCContextAudioBase()->isAudioEnabled(); - ui->pb_StartStop->setText(started ? "stop" : "start"); - ui->pb_StartStop->setEnabled(enabled); - ui->pb_EnableDisable->setText(enabled ? "disable" : "enable"); - } - - void CAudioAdvancedDistributedComponent::setButtons(int delayMs) - { - if (!hasContexts()) { return; } - QPointer myself(this); - QTimer::singleShot(delayMs, this, [=] { - if (!sGui || !myself || sGui->isShuttingDown()) { return; } - this->setButtons(); - }); - } - - void CAudioAdvancedDistributedComponent::onAudioStarted(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice) - { - Q_UNUSED(inputDevice) - Q_UNUSED(outputDevice) - this->setButtons(); - this->reloadRegisteredDevices(); - } - - void CAudioAdvancedDistributedComponent::onAudioStoppend() - { - this->setButtons(); - this->reloadRegisteredDevices(); - } - bool CAudioAdvancedDistributedComponent::hasContexts() { if (!sGui || sGui->isShuttingDown() || !sGui->getCContextAudioBase()) { return false; } diff --git a/src/blackgui/components/audioadvanceddistributedcomponent.h b/src/blackgui/components/audioadvanceddistributedcomponent.h index 583a8b056..e080fa052 100644 --- a/src/blackgui/components/audioadvanceddistributedcomponent.h +++ b/src/blackgui/components/audioadvanceddistributedcomponent.h @@ -35,21 +35,6 @@ namespace BlackGui::Components private: QScopedPointer ui; - //! Audio start/stop - void toggleAudioStartStop(); - - //! Audio enable/disable - void toggleAudioEnableDisable(); - - //! @{ - //! Start/stop button - void setButtons(); - void setButtons(int delayMs); - //! @} - - void onAudioStarted(const BlackMisc::Audio::CAudioDeviceInfo &inputDevice, const BlackMisc::Audio::CAudioDeviceInfo &outputDevice); - void onAudioStoppend(); - //! Contexts static bool hasContexts(); }; diff --git a/src/blackgui/components/audioadvanceddistributedcomponent.ui b/src/blackgui/components/audioadvanceddistributedcomponent.ui index 6edd1ed5d..db26ef5b1 100644 --- a/src/blackgui/components/audioadvanceddistributedcomponent.ui +++ b/src/blackgui/components/audioadvanceddistributedcomponent.ui @@ -14,13 +14,6 @@ Frame - - - - enable - - - @@ -37,20 +30,6 @@ - - - - stop - - - - - - - Audio: - - - @@ -68,8 +47,6 @@ - pb_StartStop - pb_EnableDisable tvp_RegisteredDevices pb_ReloadRegistered diff --git a/src/blackgui/components/cockpitinfoareacomponent.ui b/src/blackgui/components/cockpitinfoareacomponent.ui index b824c4ffa..9a2af6b16 100644 --- a/src/blackgui/components/cockpitinfoareacomponent.ui +++ b/src/blackgui/components/cockpitinfoareacomponent.ui @@ -195,7 +195,7 @@ Qt::BottomDockWidgetArea - Adv./distributed audio + Distributed audio 8