diff --git a/src/blackcore/context/contextownaircraftimpl.cpp b/src/blackcore/context/contextownaircraftimpl.cpp index 5b84e8a17..7e4fdb4b6 100644 --- a/src/blackcore/context/contextownaircraftimpl.cpp +++ b/src/blackcore/context/contextownaircraftimpl.cpp @@ -81,7 +81,7 @@ namespace BlackCore CContextOwnAircraft *CContextOwnAircraft::registerWithDBus(CDBusServer *server) { - if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) return this; + if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) { return this; } server->addObject(IContextOwnAircraft::ObjectPath(), this); return this; } @@ -418,7 +418,8 @@ namespace BlackCore void CContextOwnAircraft::setAudioOutputVolume(int outputVolume) { if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << outputVolume; } - if (this->getIContextAudio()) this->getIContextAudio()->setVoiceOutputVolume(outputVolume); + CContextAudioBase *audio = qobject_cast(this->getIContextAudio()); + if (audio) { audio->setVoiceOutputVolume(outputVolume); } } void CContextOwnAircraft::xCtxChangedAtcStationOnlineConnectionStatus(const CAtcStation &atcStation, bool connected) diff --git a/src/blackgui/components/audiodevicevolumesetupcomponent.cpp b/src/blackgui/components/audiodevicevolumesetupcomponent.cpp index dc8a1c693..c07de4f31 100644 --- a/src/blackgui/components/audiodevicevolumesetupcomponent.cpp +++ b/src/blackgui/components/audiodevicevolumesetupcomponent.cpp @@ -77,7 +77,7 @@ namespace BlackGui void CAudioDeviceVolumeSetupComponent::init() { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } + if (!sGui || sGui->isShuttingDown() || !sGui->getCContextAudioBase()) { return; } // audio is optional const bool audio = this->hasAudio(); @@ -91,14 +91,14 @@ namespace BlackGui if (audio) { - const QString ai = audio ? sGui->getIContextAudio()->audioRunsWhereInfo() : "No audio, cannot change."; + const QString ai = sGui->getCContextAudioBase()->audioRunsWhereInfo(); ui->le_Info->setText(ai); ui->le_Info->setPlaceholderText(ai); this->initAudioDeviceLists(); // default - ui->cb_SetupAudioLoopback->setChecked(sGui->getIContextAudio()->isAudioLoopbackEnabled()); + ui->cb_SetupAudioLoopback->setChecked(sGui->getCContextAudioBase()->isAudioLoopbackEnabled()); // the connects depend on initAudioDeviceLists c = connect(ui->cb_SetupAudioInputDevice, qOverload(&QComboBox::currentIndexChanged), this, &CAudioDeviceVolumeSetupComponent::onAudioDeviceSelected); @@ -107,21 +107,21 @@ namespace BlackGui Q_ASSERT(c); // context - c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioDeviceVolumeSetupComponent::onAudioDevicesChanged, Qt::QueuedConnection); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedAudioDevices, this, &CAudioDeviceVolumeSetupComponent::onAudioDevicesChanged, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::startedAudio, this, &CAudioDeviceVolumeSetupComponent::onAudioStarted, Qt::QueuedConnection); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::startedAudio, this, &CAudioDeviceVolumeSetupComponent::onAudioStarted, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::outputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onOutputVU, Qt::QueuedConnection); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::outputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onOutputVU, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::inputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onInputVU, Qt::QueuedConnection); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::inputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onInputVU, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::receivingCallsignsChanged, this, &CAudioDeviceVolumeSetupComponent::onReceivingCallsignsChanged, Qt::QueuedConnection); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::receivingCallsignsChanged, this, &CAudioDeviceVolumeSetupComponent::onReceivingCallsignsChanged, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::updatedFromOwnAircraftCockpit, this, &CAudioDeviceVolumeSetupComponent::onUpdatedClientWithCockpitData, Qt::QueuedConnection); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::updatedFromOwnAircraftCockpit, this, &CAudioDeviceVolumeSetupComponent::onUpdatedClientWithCockpitData, Qt::QueuedConnection); Q_ASSERT(c); this->onUpdatedClientWithCockpitData(); @@ -194,11 +194,11 @@ namespace BlackGui void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient() { if (!this->hasAudio()) { return; } - const bool com1Enabled = sGui->getIContextAudio()->isEnabledComUnit(CComSystem::Com1); - const bool com2Enabled = sGui->getIContextAudio()->isEnabledComUnit(CComSystem::Com2); + const bool com1Enabled = sGui->getCContextAudioBase()->isEnabledComUnit(CComSystem::Com1); + const bool com2Enabled = sGui->getCContextAudioBase()->isEnabledComUnit(CComSystem::Com2); - const bool com1Tx = com1Enabled && sGui->getIContextAudio()->isTransmittingComUnit(CComSystem::Com1); - const bool com2Tx = com2Enabled && sGui->getIContextAudio()->isTransmittingComUnit(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 const bool com1Rx = com1Enabled; @@ -218,14 +218,14 @@ namespace BlackGui void CAudioDeviceVolumeSetupComponent::initAudioDeviceLists() { if (!this->hasAudio()) { return; } - this->onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices()); - const CAudioDeviceInfoList currentDevices = sGui->getIContextAudio()->getCurrentAudioDevices(); + this->onAudioDevicesChanged(sGui->getCContextAudioBase()->getAudioDevices()); + const CAudioDeviceInfoList currentDevices = sGui->getCContextAudioBase()->getCurrentAudioDevices(); this->onAudioStarted(currentDevices.getInputDevices().frontOrDefault(), currentDevices.getOutputDevices().frontOrDefault()); } bool CAudioDeviceVolumeSetupComponent::hasAudio() const { - return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject(); + return sGui && sGui->getCContextAudioBase(); } void CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged(int v) @@ -261,7 +261,7 @@ namespace BlackGui this->initAudioDeviceLists(); const CAudioDeviceInfo i = this->getSelectedInputDevice(); const CAudioDeviceInfo o = this->getSelectedInputDevice(); - sGui->getIContextAudio()->setCurrentAudioDevices(i, o); + sGui->getCContextAudioBase()->setCurrentAudioDevices(i, o); } void CAudioDeviceVolumeSetupComponent::onResetVolumeIn() @@ -287,14 +287,14 @@ namespace BlackGui CAudioDeviceInfo CAudioDeviceVolumeSetupComponent::getSelectedInputDevice() const { if (!hasAudio()) { return CAudioDeviceInfo(); } - const CAudioDeviceInfoList devices = sGui->getIContextAudio()->getAudioInputDevices(); + const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioInputDevices(); return devices.findByName(ui->cb_SetupAudioInputDevice->currentText()); } CAudioDeviceInfo CAudioDeviceVolumeSetupComponent::getSelectedOutputDevice() const { if (!hasAudio()) { return CAudioDeviceInfo(); } - const CAudioDeviceInfoList devices = sGui->getIContextAudio()->getAudioOutputDevices(); + const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioOutputDevices(); return devices.findByName(ui->cb_SetupAudioOutputDevice->currentText()); } @@ -305,7 +305,7 @@ namespace BlackGui const CAudioDeviceInfo in = this->getSelectedInputDevice(); const CAudioDeviceInfo out = this->getSelectedOutputDevice(); - sGui->getIContextAudio()->setCurrentAudioDevices(in, out); + sGui->getCContextAudioBase()->setCurrentAudioDevices(in, out); } void CAudioDeviceVolumeSetupComponent::onAudioStarted(const CAudioDeviceInfo &input, const CAudioDeviceInfo &output) @@ -341,8 +341,8 @@ namespace BlackGui void CAudioDeviceVolumeSetupComponent::onLoopbackToggled(bool loopback) { if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } - if (sGui->getIContextAudio()->isAudioLoopbackEnabled() == loopback) { return; } - sGui->getIContextAudio()->enableAudioLoopback(loopback); + if (sGui->getCContextAudioBase()->isAudioLoopbackEnabled() == loopback) { return; } + sGui->getCContextAudioBase()->enableAudioLoopback(loopback); } void CAudioDeviceVolumeSetupComponent::onDisableAudioEffectsToggled(bool disabled) diff --git a/src/blackgui/components/audionotificationcomponent.cpp b/src/blackgui/components/audionotificationcomponent.cpp index 042c32b42..7847b831a 100644 --- a/src/blackgui/components/audionotificationcomponent.cpp +++ b/src/blackgui/components/audionotificationcomponent.cpp @@ -150,10 +150,10 @@ namespace BlackGui CLogMessage(this).preformatted(msg); const QCheckBox *sender = qobject_cast(QObject::sender()); - if (checked && sGui && sGui->getIContextAudio() && sender) + if (checked && sGui && sGui->getCContextAudioBase() && sender) { const CNotificationSounds::NotificationFlag f = this->checkBoxToFlag(sender); - sGui->getIContextAudio()->playNotification(f, false, as.getNotificationVolume()); + sGui->getCContextAudioBase()->playNotification(f, false, as.getNotificationVolume()); } } diff --git a/src/blackgui/components/audiovolumecomponent.cpp b/src/blackgui/components/audiovolumecomponent.cpp index 738f430c3..488bc961a 100644 --- a/src/blackgui/components/audiovolumecomponent.cpp +++ b/src/blackgui/components/audiovolumecomponent.cpp @@ -35,7 +35,7 @@ namespace BlackGui { ui->setupUi(this); const int volume = sGui && sGui->getIContextAudio() ? - sGui->getIContextAudio()->getVoiceOutputVolume() : + sGui->getCContextAudioBase()->getVoiceOutputVolume() : 100; ui->hs_Volume->setValue(volumeToSliderValue(volume)); ui->sb_Volume->setValue(volume); @@ -53,15 +53,15 @@ namespace BlackGui Q_ASSERT(c); Q_UNUSED(c) - c = connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CAudioVolumeComponent::onMuteChanged); + c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedMute, this, &CAudioVolumeComponent::onMuteChanged); Q_ASSERT(c); Q_UNUSED(c) - connect(sGui->getIContextAudio(), &IContextAudio::changedAudioVolume, this, &CAudioVolumeComponent::onOutputVolumeChanged); + connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedAudioVolume, this, &CAudioVolumeComponent::onOutputVolumeChanged); Q_ASSERT(c); Q_UNUSED(c) // to audio audio context - c = connect(ui->pb_Mute, &QPushButton::toggled, sGui->getIContextAudio(), &IContextAudio::setMute); + c = connect(ui->pb_Mute, &QPushButton::toggled, sGui->getCContextAudioBase(), &CContextAudioBase::setMute); Q_ASSERT(c); Q_UNUSED(c) @@ -129,9 +129,9 @@ namespace BlackGui } ui->hs_Volume->setToolTip(QString::number(volume)); - if (sGui->getIContextAudio()->getVoiceOutputVolume() != volume) + if (sGui->getCContextAudioBase()->getVoiceOutputVolume() != volume) { - sGui->getIContextAudio()->setVoiceOutputVolume(volume); + sGui->getCContextAudioBase()->setVoiceOutputVolume(volume); } } @@ -140,9 +140,9 @@ namespace BlackGui if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } ui->sb_Volume->setToolTip(QString::number(volume)); Q_ASSERT(sGui->getIContextAudio()); - if (sGui->getIContextAudio()->getVoiceOutputVolume() != volume) + if (sGui->getCContextAudioBase()->getVoiceOutputVolume() != volume) { - sGui->getIContextAudio()->setVoiceOutputVolume(volume); + sGui->getCContextAudioBase()->setVoiceOutputVolume(volume); } } diff --git a/src/blackgui/components/cockpitcomcomponent.cpp b/src/blackgui/components/cockpitcomcomponent.cpp index 900570a6b..162260e0d 100644 --- a/src/blackgui/components/cockpitcomcomponent.cpp +++ b/src/blackgui/components/cockpitcomcomponent.cpp @@ -141,9 +141,9 @@ namespace BlackGui { CLogMessage().validationWarning(u"Invalid SELCAL code"); } - else if (sGui->getIContextAudio()) + else if (sGui->getCContextAudioBase()) { - sGui->getIContextAudio()->playSelcalTone(selcal); + sGui->getCContextAudioBase()->playSelcalTone(selcal); } else { diff --git a/src/blackgui/components/infobarstatuscomponent.cpp b/src/blackgui/components/infobarstatuscomponent.cpp index ad0af48b1..2a684d992 100644 --- a/src/blackgui/components/infobarstatuscomponent.cpp +++ b/src/blackgui/components/infobarstatuscomponent.cpp @@ -78,10 +78,10 @@ namespace BlackGui ui->led_DBus->setOn(sGui->getIContextApplication()->isUsingImplementingObject()); } - if (sGui->getIContextAudio()) + if (sGui->getCContextAudioBase()) { - ui->led_Audio->setOn(!sGui->getIContextAudio()->isMuted()); - connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CInfoBarStatusComponent::onMuteChanged); + ui->led_Audio->setOn(!sGui->getCContextAudioBase()->isMuted()); + connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedMute, this, &CInfoBarStatusComponent::onMuteChanged); } QPointer myself(this); @@ -224,7 +224,7 @@ namespace BlackGui const QList actions = menuAudio.actions(); if (selectedItem == actions.at(0)) { - sGui->getIContextAudio()->setMute(!sGui->getIContextAudio()->isMuted()); + sGui->getCContextAudioBase()->setMute(!sGui->getCContextAudioBase()->isMuted()); } else if (actions.size() > 1 && selectedItem == actions.at(1)) { @@ -280,8 +280,8 @@ namespace BlackGui { if (!sGui || sGui->isShuttingDown()) { return; } - IContextSimulator *simCon = sGui->getIContextSimulator(); - if (sGui->getIContextSimulator()) + const IContextSimulator *simCon = sGui->getIContextSimulator(); + if (simCon) { this->onSimulatorStatusChanged(simCon->getSimulatorStatus()); @@ -302,9 +302,9 @@ namespace BlackGui } // audio context can be empty depending on which side it is called - if (sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject()) + if (sGui->getCContextAudioBase()) { - ui->led_Audio->setOn(!sGui->getIContextAudio()->isMuted()); + ui->led_Audio->setOn(!sGui->getCContextAudioBase()->isMuted()); } else { diff --git a/src/blackgui/components/loginadvcomponent.cpp b/src/blackgui/components/loginadvcomponent.cpp index 16f3cc1f5..a6acd5d38 100644 --- a/src/blackgui/components/loginadvcomponent.cpp +++ b/src/blackgui/components/loginadvcomponent.cpp @@ -217,9 +217,9 @@ namespace BlackGui } // Login - if (sGui && sGui->getIContextAudio()) + if (sGui && sGui->getCContextAudioBase()) { - sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup()); + sGui->getCContextAudioBase()->setVoiceSetup(currentServer.getVoiceSetup()); } msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, values.ownLiverySend, values.useLivery, values.ownAircraftModelStringSend, values.useModelString, partnerCs, mode); diff --git a/src/blackgui/components/logincomponent.cpp b/src/blackgui/components/logincomponent.cpp index 8d299c6c2..fde91b2b6 100644 --- a/src/blackgui/components/logincomponent.cpp +++ b/src/blackgui/components/logincomponent.cpp @@ -317,9 +317,9 @@ namespace BlackGui ownAircraft = sGui->getIContextOwnAircraft()->getOwnAircraft(); // Login - if (sGui->getIContextAudio()) + if (sGui->getCContextAudioBase()) { - sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup()); + sGui->getCContextAudioBase()->setVoiceSetup(currentServer.getVoiceSetup()); } msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, {}, true, {}, true, {}, mode); diff --git a/src/blackgui/components/mainkeypadareacomponent.cpp b/src/blackgui/components/mainkeypadareacomponent.cpp index 078dadf3d..bc269c256 100644 --- a/src/blackgui/components/mainkeypadareacomponent.cpp +++ b/src/blackgui/components/mainkeypadareacomponent.cpp @@ -71,9 +71,9 @@ namespace BlackGui connect(ui->lep_CommandLineInput, &CCommandInput::commandEntered, this, &CMainKeypadAreaComponent::commandEntered); connect(ui->lep_CommandLineInput, &CCommandInput::textEntered, this, &CMainKeypadAreaComponent::textEntered); - connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::connectionStatusChanged); + connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::connectionStatusChanged); connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ownAircraftCockpitChanged); - connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::muteChanged); + connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedMute, this, &CMainKeypadAreaComponent::muteChanged); connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine); QPointer myself(this); @@ -138,12 +138,12 @@ namespace BlackGui } else if (senderButton == ui->pb_SoundMaxVolume && sGui->getIContextAudio()) { - sGui->getIContextAudio()->setVoiceOutputVolume(100); + sGui->getCContextAudioBase()->setVoiceOutputVolume(100); } else if (senderButton == ui->pb_SoundMute && sGui->getIContextAudio()) { - const bool mute = sGui->getIContextAudio()->isMuted(); - sGui->getIContextAudio()->setMute(!mute); + const bool mute = sGui->getCContextAudioBase()->isMuted(); + sGui->getCContextAudioBase()->setMute(!mute); } else if (senderButton == ui->pb_Connect) { @@ -176,7 +176,7 @@ namespace BlackGui void CMainKeypadAreaComponent::ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator) { - Q_UNUSED(originator); + Q_UNUSED(originator) bool ident = aircraft.getTransponder().getTransponderMode() == CTransponder::StateIdent; //check state to avoid undelibarate signals @@ -268,9 +268,9 @@ namespace BlackGui void CMainKeypadAreaComponent::update() { if (!sGui || sGui->isShuttingDown() || !sGui->supportsContexts()) { return; } - if (sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject()) + if (sGui->getCContextAudioBase()) { - this->muteChanged(sGui->getIContextAudio()->isMuted()); + this->muteChanged(sGui->getCContextAudioBase()->isMuted()); } if (sGui->getIContextNetwork() && sGui->getIContextNetwork()->isConnected()) diff --git a/src/blackgui/components/textmessagecomponent.cpp b/src/blackgui/components/textmessagecomponent.cpp index b5e143723..d9e4e33ee 100644 --- a/src/blackgui/components/textmessagecomponent.cpp +++ b/src/blackgui/components/textmessagecomponent.cpp @@ -196,7 +196,7 @@ namespace BlackGui // this is SELCAL for me if (playNotification) { - sGui->getIContextAudio()->playSelcalTone(message.getSelcalCode()); + sGui->getCContextAudioBase()->playSelcalTone(message.getSelcalCode()); } if (msgSettings.popupSelcalMessages()) @@ -231,7 +231,7 @@ namespace BlackGui // callsign mentioned notification if (relevantForMe && audioCsMentioned && ownAircraft.hasCallsign() && message.mentionsCallsign(ownAircraft.getCallsign())) { - sGui->getIContextAudio()->playNotification(CNotificationSounds::NotificationTextCallsignMentioned, false); + sGui->getCContextAudioBase()->playNotification(CNotificationSounds::NotificationTextCallsignMentioned, false); } } else if (message.isPrivateMessage() && !message.isServerMessage()) @@ -536,11 +536,11 @@ namespace BlackGui const CSettings settings = m_audioSettings.get(); if (textMessage.isSupervisorMessage() && settings.textMessageSupervisor()) { - sGui->getIContextAudio()->playNotification(CNotificationSounds::NotificationTextMessageSupervisor, true); + sGui->getCContextAudioBase()->playNotification(CNotificationSounds::NotificationTextMessageSupervisor, true); } else if (textMessage.isPrivateMessage() && settings.textMessagePrivate()) { - sGui->getIContextAudio()->playNotification(CNotificationSounds::NotificationTextMessagePrivate, true); + sGui->getCContextAudioBase()->playNotification(CNotificationSounds::NotificationTextMessagePrivate, true); } } } diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index 44b306c1f..5ca8c826e 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -520,7 +520,7 @@ void SwiftGuiStd::playNotifcationSound(CNotificationSounds::NotificationFlag not if (!m_contextAudioAvailable) { return; } if (!ui->comp_MainInfoArea->getSettingsComponent()->playNotificationSounds()) { return; } if (!sGui || sGui->isShuttingDown()) { return; } - sGui->getIContextAudio()->playNotification(notification, true); + sGui->getCContextAudioBase()->playNotification(notification, true); } void SwiftGuiStd::displayConsole()