From 197854e7deb914293c3ffc7e351b8c952dec24cc Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 28 Sep 2019 19:33:21 +0200 Subject: [PATCH] Ref T731, removed unused UI components --- src/blackgui/components/audiocomponent.cpp | 28 -- src/blackgui/components/audiocomponent.h | 44 --- src/blackgui/components/audiocomponent.ui | 109 ------- .../components/audiosetupcomponent.cpp | 296 ------------------ src/blackgui/components/audiosetupcomponent.h | 91 ------ .../components/audiosetupcomponent.ui | 274 ---------------- .../components/voiceroomscomponent.cpp | 151 --------- src/blackgui/components/voiceroomscomponent.h | 60 ---- .../components/voiceroomscomponent.ui | 217 ------------- 9 files changed, 1270 deletions(-) delete mode 100644 src/blackgui/components/audiocomponent.cpp delete mode 100644 src/blackgui/components/audiocomponent.h delete mode 100644 src/blackgui/components/audiocomponent.ui delete mode 100644 src/blackgui/components/audiosetupcomponent.cpp delete mode 100644 src/blackgui/components/audiosetupcomponent.h delete mode 100644 src/blackgui/components/audiosetupcomponent.ui delete mode 100644 src/blackgui/components/voiceroomscomponent.cpp delete mode 100644 src/blackgui/components/voiceroomscomponent.h delete mode 100644 src/blackgui/components/voiceroomscomponent.ui diff --git a/src/blackgui/components/audiocomponent.cpp b/src/blackgui/components/audiocomponent.cpp deleted file mode 100644 index bed06b4da..000000000 --- a/src/blackgui/components/audiocomponent.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, - * or distributed except according to the terms contained in the LICENSE file. - */ - -#include "blackgui/components/audiocomponent.h" -#include "ui_audiocomponent.h" - -namespace BlackGui -{ - namespace Components - { - - CAudioComponent::CAudioComponent(QWidget *parent) : - QFrame(parent), - ui(new Ui::CAudioComponent) - { - ui->setupUi(this); - } - - CAudioComponent::~CAudioComponent() - { } - - } // namespace -} // namespace diff --git a/src/blackgui/components/audiocomponent.h b/src/blackgui/components/audiocomponent.h deleted file mode 100644 index 30e0f1394..000000000 --- a/src/blackgui/components/audiocomponent.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, - * or distributed except according to the terms contained in the LICENSE file. - */ - -//! \file - -#ifndef BLACKGUI_AUDIOCOMPONENT_H -#define BLACKGUI_AUDIOCOMPONENT_H - -#include "blackgui/blackguiexport.h" - -#include -#include -#include - -namespace Ui { class CAudioComponent; } -namespace BlackGui -{ - namespace Components - { - //! Audio component, volume, ... - class BLACKGUI_EXPORT CAudioComponent : public QFrame - { - Q_OBJECT - - public: - //! Constructor - explicit CAudioComponent(QWidget *parent = nullptr); - - //! Destructor - virtual ~CAudioComponent() override; - - private: - QScopedPointer ui; - }; - } // namespace -} // namespace - - -#endif // guard diff --git a/src/blackgui/components/audiocomponent.ui b/src/blackgui/components/audiocomponent.ui deleted file mode 100644 index 70bd2e463..000000000 --- a/src/blackgui/components/audiocomponent.ui +++ /dev/null @@ -1,109 +0,0 @@ - - - CAudioComponent - - - Audio - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - - - 0 - 0 - 68 - 68 - - - - - 0 - - - QLayout::SetMaximumSize - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::Plain - - - - 2 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - - - - - - - - BlackGui::Components::CAudioSetupComponent - QFrame -
blackgui/components/audiosetupcomponent.h
- 1 -
- - BlackGui::Components::CAudioVolumeComponent - QFrame -
blackgui/components/audiovolumecomponent.h
- 1 -
-
- - -
diff --git a/src/blackgui/components/audiosetupcomponent.cpp b/src/blackgui/components/audiosetupcomponent.cpp deleted file mode 100644 index db82d79f6..000000000 --- a/src/blackgui/components/audiosetupcomponent.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, - * or distributed except according to the terms contained in the LICENSE file. - */ - -#include "blackcore/context/contextaudio.h" -#include "blackgui/components/audiosetupcomponent.h" -#include "blackgui/guiapplication.h" -#include "blackmisc/audio/audiodeviceinfo.h" -#include "blackmisc/audio/notificationsounds.h" -#include "blackmisc/audio/audiosettings.h" -#include "blackmisc/sequence.h" -#include "ui_audiosetupcomponent.h" - -#include -#include -#include -#include -#include -#include - -using namespace BlackCore; -using namespace BlackCore::Context; -using namespace BlackMisc; -using namespace BlackMisc::Aviation; -using namespace BlackMisc::Audio; -using namespace BlackMisc::PhysicalQuantities; - -namespace BlackGui -{ - namespace Components - { - CAudioSetupComponent::CAudioSetupComponent(QWidget *parent) : - QFrame(parent), - ui(new Ui::CAudioSetupComponent) - { - ui->setupUi(this); - - // 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 - QPointer myself(this); - QTimer::singleShot(2500, this, [ = ] - { - if (!myself || !sGui || sGui->isShuttingDown()) { return; } - this->init(); - }); - } - - void CAudioSetupComponent::init() - { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } - - // audio is optional - const bool audio = this->hasAudio(); - this->setEnabled(audio); - this->reloadSettings(); - - bool c = connect(ui->cb_SetupAudioLoopback, &QCheckBox::toggled, this, &CAudioSetupComponent::onLoopbackToggled); - Q_ASSERT(c); - - if (audio) - { - ui->le_ExtraInfo->setText(audio ? sGui->getIContextAudio()->audioRunsWhereInfo() : "No audio, cannot change."); - - this->initAudioDeviceLists(); - - // default - ui->cb_SetupAudioLoopback->setChecked(sGui->getIContextAudio()->isAudioLoopbackEnabled()); - - // the connects depend on initAudioDeviceLists - c = connect(ui->cb_SetupAudioInputDevice, qOverload(&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::onAudioDeviceSelected); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioOutputDevice, qOverload(&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::onAudioDeviceSelected); - Q_ASSERT(c); - - // context - c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioSetupComponent::onAudioDevicesChanged, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioSetupComponent::onCurrentAudioDevicesChanged, Qt::QueuedConnection); - Q_ASSERT(c); - - // checkboxes for notifications - c = connect(ui->cb_SetupAudioPTTClickDown, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioPTTClickUp, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationVoiceRoomLeft, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationVoiceRoomJoined, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationTextMessagePrivate, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationTextMessageSupervisor, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationTextCallsignMentioned, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNoTransmission, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->pb_SoundReset, &QPushButton::released, this, &CAudioSetupComponent::resetNotificationSoundsDir, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->pb_SoundDir, &QPushButton::released, this, &CAudioSetupComponent::selectNotificationSoundsDir, Qt::QueuedConnection); - Q_ASSERT(c); - - // volumes - c = connect(ui->sb_NotificationValueVolume, qOverload(&QSpinBox::valueChanged), this, &CAudioSetupComponent::onNotificationVolumeChanged); - Q_ASSERT(c); - } - Q_UNUSED(c) - } - - CAudioSetupComponent::~CAudioSetupComponent() - { } - - bool CAudioSetupComponent::playNotificationSounds() const - { - if (!this->hasAudio()) { return false; } - return ui->cb_SetupAudioPTTClickDown->isChecked() || ui->cb_SetupAudioPTTClickUp->isChecked() || - ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked() || ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked() || - ui->cb_SetupAudioNotificationVoiceRoomLeft->isChecked() || ui->cb_SetupAudioNotificationVoiceRoomJoined->isChecked() || - ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked() || ui->cb_SetupAudioNoTransmission->isChecked(); - } - - void CAudioSetupComponent::reloadSettings() - { - const CSettings as(m_audioSettings.getThreadLocal()); - - ui->cb_SetupAudioPTTClickDown->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTClickKeyDown)); - ui->cb_SetupAudioPTTClickUp->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTClickKeyUp)); - - ui->cb_SetupAudioNotificationVoiceRoomLeft->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationVoiceRoomLeft)); - ui->cb_SetupAudioNotificationVoiceRoomJoined->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationVoiceRoomJoined)); - ui->cb_SetupAudioNotificationTextMessagePrivate->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate)); - ui->cb_SetupAudioNotificationTextMessageSupervisor->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor)); - ui->cb_SetupAudioNotificationTextCallsignMentioned->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned)); - ui->cb_SetupAudioNoTransmission->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission)); - - ui->le_SoundDir->setText(as.getNotificationSoundDirectory()); - ui->sb_NotificationValueVolume->setValue(as.getNotificationVolume()); - } - - void CAudioSetupComponent::initAudioDeviceLists() - { - if (!this->hasAudio()) { return; } - this->onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices()); - this->onCurrentAudioDevicesChanged(sGui->getIContextAudio()->getCurrentAudioDevices()); - } - - bool CAudioSetupComponent::hasAudio() const - { - return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject(); - } - - void CAudioSetupComponent::onNotificationVolumeChanged(int volume) - { - volume = qMax(25, qMin(100, volume)); - CSettings as(m_audioSettings.getThreadLocal()); - if (as.getNotificationVolume() == volume) { return; } - as.setNotificationVolume(volume); - m_audioSettings.set(as); - } - - CNotificationSounds::NotificationFlag CAudioSetupComponent::checkBoxToFlag(const QCheckBox *cb) const - { - if (!cb) { return CNotificationSounds::NoNotifications; } - - if (cb == ui->cb_SetupAudioPTTClickDown) { return CNotificationSounds::PTTClickKeyDown; } - if (cb == ui->cb_SetupAudioPTTClickUp) { return CNotificationSounds::PTTClickKeyUp; } - - if (cb == ui->cb_SetupAudioNotificationVoiceRoomJoined) { return CNotificationSounds::NotificationVoiceRoomJoined; } - if (cb == ui->cb_SetupAudioNotificationVoiceRoomLeft) { return CNotificationSounds::NotificationVoiceRoomLeft; } - if (cb == ui->cb_SetupAudioNotificationTextCallsignMentioned) { return CNotificationSounds::NotificationTextCallsignMentioned; } - if (cb == ui->cb_SetupAudioNotificationTextMessagePrivate) { return CNotificationSounds::NotificationTextMessagePrivate; } - if (cb == ui->cb_SetupAudioNotificationTextMessageSupervisor) { return CNotificationSounds::NotificationTextMessageSupervisor; } - if (cb == ui->cb_SetupAudioNoTransmission) { return CNotificationSounds::NotificationNoAudioTransmission; } - return CNotificationSounds::NoNotifications; - } - - void CAudioSetupComponent::onAudioDeviceSelected(int index) - { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } - if (index < 0) { return; } - - CAudioDeviceInfoList devices = sGui->getIContextAudio()->getAudioDevices(); - if (devices.isEmpty()) { return; } - CAudioDeviceInfo selectedDevice; - const QObject *sender = QObject::sender(); - if (sender == ui->cb_SetupAudioInputDevice) - { - const CAudioDeviceInfoList inputDevices = devices.getInputDevices(); - if (index >= inputDevices.size()) { return; } - selectedDevice = inputDevices[index]; - // sGui->getIContextAudio()->setCurrentAudioDevices(selectedDevice); - } - else if (sender == ui->cb_SetupAudioOutputDevice) - { - const CAudioDeviceInfoList outputDevices = devices.getOutputDevices(); - if (index >= outputDevices.size()) { return; } - selectedDevice = outputDevices[index]; - // sGui->getIContextAudio()->setCurrentAudioDevices(selectedDevice); - } - } - - void CAudioSetupComponent::onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices) - { - for (auto &device : devices) - { - if (device.getType() == CAudioDeviceInfo::InputDevice) - { - ui->cb_SetupAudioInputDevice->setCurrentText(device.toQString(true)); - } - else if (device.getType() == CAudioDeviceInfo::OutputDevice) - { - ui->cb_SetupAudioOutputDevice->setCurrentText(device.toQString(true)); - } - } - } - - void CAudioSetupComponent::onAudioDevicesChanged(const CAudioDeviceInfoList &devices) - { - ui->cb_SetupAudioOutputDevice->clear(); - ui->cb_SetupAudioInputDevice->clear(); - - for (const CAudioDeviceInfo &device : devices) - { - if (device.getType() == CAudioDeviceInfo::InputDevice) - { - ui->cb_SetupAudioInputDevice->addItem(device.toQString(true)); - } - else if (device.getType() == CAudioDeviceInfo::OutputDevice) - { - ui->cb_SetupAudioOutputDevice->addItem(device.toQString(true)); - } - } - } - - void CAudioSetupComponent::onLoopbackToggled(bool loopback) - { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } - if (sGui->getIContextAudio()->isAudioLoopbackEnabled() == loopback) { return; } - sGui->getIContextAudio()->enableAudioLoopback(loopback); - } - - void CAudioSetupComponent::onNotificationsToggled(bool checked) - { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } - CSettings as(m_audioSettings.getThreadLocal()); - - as.setNotificationFlag(CNotificationSounds::PTTClickKeyDown, ui->cb_SetupAudioPTTClickDown->isChecked()); - as.setNotificationFlag(CNotificationSounds::PTTClickKeyUp, ui->cb_SetupAudioPTTClickUp->isChecked()); - - as.setNotificationFlag(CNotificationSounds::NotificationVoiceRoomLeft, ui->cb_SetupAudioNotificationVoiceRoomLeft->isChecked()); - as.setNotificationFlag(CNotificationSounds::NotificationVoiceRoomJoined, ui->cb_SetupAudioNotificationVoiceRoomJoined->isChecked()); - as.setNotificationFlag(CNotificationSounds::NotificationTextMessagePrivate, ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked()); - as.setNotificationFlag(CNotificationSounds::NotificationTextMessageSupervisor, ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked()); - as.setNotificationFlag(CNotificationSounds::NotificationTextCallsignMentioned, ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked()); - as.setNotificationFlag(CNotificationSounds::NotificationNoAudioTransmission, ui->cb_SetupAudioNoTransmission->isChecked()); - - const CStatusMessage msg = m_audioSettings.set(as); - CLogMessage(this).preformatted(msg); - - const QCheckBox *sender = qobject_cast(QObject::sender()); - if (checked && this->hasAudio() && sender) - { - const CNotificationSounds::NotificationFlag f = this->checkBoxToFlag(sender); - sGui->getIContextAudio()->playNotification(f, false, as.getNotificationVolume()); - } - } - - void CAudioSetupComponent::selectNotificationSoundsDir() - { - CSettings s = m_audioSettings.get(); - const QString dir = QFileDialog::getExistingDirectory(this, QStringLiteral("Open directory"), s.getNotificationSoundDirectory(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - const QDir d(dir); - if (d.exists()) - { - s.setNotificationSoundDirectory(dir); - ui->le_SoundDir->setText(s.getNotificationSoundDirectory()); - const CStatusMessage m = m_audioSettings.setAndSave(s); - CLogMessage::preformatted(m); - } - } - - void CAudioSetupComponent::resetNotificationSoundsDir() - { - CSettings s = m_audioSettings.get(); - s.setNotificationSoundDirectory(""); - const CStatusMessage m = m_audioSettings.setAndSave(s); - CLogMessage::preformatted(m); - ui->le_SoundDir->clear(); - } - } // namespace -} // namespace diff --git a/src/blackgui/components/audiosetupcomponent.h b/src/blackgui/components/audiosetupcomponent.h deleted file mode 100644 index 7a6fa196f..000000000 --- a/src/blackgui/components/audiosetupcomponent.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, - * or distributed except according to the terms contained in the LICENSE file. - */ - -//! \file - -#ifndef BLACKGUI_AUDIOSETUPCOMPONENT_H -#define BLACKGUI_AUDIOSETUPCOMPONENT_H - -#include "blackgui/blackguiexport.h" -#include "blackmisc/audio/audiosettings.h" -#include "blackmisc/audio/audiodeviceinfolist.h" -#include "blackmisc/settingscache.h" - -#include -#include -#include -#include - -namespace Ui { class CAudioSetupComponent; } -namespace BlackGui -{ - namespace Components - { - //! Audio setup such as input / output devices - class BLACKGUI_EXPORT CAudioSetupComponent : public QFrame - { - Q_OBJECT - - public: - //! Constructor - explicit CAudioSetupComponent(QWidget *parent = nullptr); - - //! Destructor - virtual ~CAudioSetupComponent() override; - - //! Play any sounds? - bool playNotificationSounds() const; - - private: - //! Init - void init(); - - //! Reload settings - void reloadSettings(); - - //! Audio device selected - //! \param index audio device index (COM1, COM2) - void onAudioDeviceSelected(int index); - - //! Current audio devices changed - void onCurrentAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices); - - //! Audio devices changed - void onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices); - - //! Loopback toggled - void onLoopbackToggled(bool loopback); - - //! Notification flags toggled - void onNotificationsToggled(bool checked); - - //! Notification sounds dir - void selectNotificationSoundsDir(); - - //! Notification sounds dir - void resetNotificationSoundsDir(); - - //! Audio device lists from settings - void initAudioDeviceLists(); - - //! Audio is optional, check if available - bool hasAudio() const; - - //! Volume has been changed - void onNotificationVolumeChanged(int volume); - - //! CheckBox to flag - BlackMisc::Audio::CNotificationSounds::NotificationFlag checkBoxToFlag(const QCheckBox *cb) const; - - QScopedPointer ui; - BlackMisc::CSetting m_audioSettings { this, &CAudioSetupComponent::reloadSettings }; - }; - } // namespace -} // namespace - -#endif // guard diff --git a/src/blackgui/components/audiosetupcomponent.ui b/src/blackgui/components/audiosetupcomponent.ui deleted file mode 100644 index 76261abc0..000000000 --- a/src/blackgui/components/audiosetupcomponent.ui +++ /dev/null @@ -1,274 +0,0 @@ - - - CAudioSetupComponent - - - - 0 - 0 - 277 - 464 - - - - Audio setup - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QLayout::SetDefaultConstraint - - - QFormLayout::AllNonFixedFieldsGrow - - - 2 - - - 4 - - - 2 - - - 2 - - - - - Info - - - - - - - true - - - extra info goes here - - - - - - - In - - - - - - - QComboBox::AdjustToMinimumContentsLength - - - true - - - - - - - Out - - - - - - - QComboBox::AdjustToMinimumContentsLength - - - - - - - Test - - - - - - - Loopback, test sound in- to output - - - - - - - Dir.: - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - your private sound directory - - - - - - - reset - - - - - - - [...] - - - - - - - - - - Notifications - - - Not.: - - - - - - - volume 25-100 (notifications) - - - 25 - - - 100 - - - 90 - - - - - - - notification for private text messages - - - - - - - supervisor messages - - - - - - - notfication for text msg. with my callsign - - - - - - - notification joining a voice room - - - - - - - notification leaving a voice room - - - - - - - No audio transmission warning - - - - - - - PTT click (key down) - - - - - - - PTT click (key up) - - - - - - - - - Qt::Vertical - - - - 20 - 143 - - - - - - - - le_ExtraInfo - cb_SetupAudioInputDevice - cb_SetupAudioOutputDevice - cb_SetupAudioLoopback - le_SoundDir - pb_SoundReset - pb_SoundDir - cb_SetupAudioNotificationTextMessageSupervisor - cb_SetupAudioNotificationTextCallsignMentioned - cb_SetupAudioNotificationVoiceRoomJoined - cb_SetupAudioNotificationVoiceRoomLeft - cb_SetupAudioNoTransmission - cb_SetupAudioPTTClickDown - cb_SetupAudioPTTClickUp - - - - diff --git a/src/blackgui/components/voiceroomscomponent.cpp b/src/blackgui/components/voiceroomscomponent.cpp deleted file mode 100644 index 068fe7ee1..000000000 --- a/src/blackgui/components/voiceroomscomponent.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, - * or distributed except according to the terms contained in the LICENSE file. - */ - -#include "ui_voiceroomscomponent.h" -#include "blackgui/components/voiceroomscomponent.h" -#include "blackgui/views/userview.h" -#include "blackgui/guiapplication.h" -#include "blackgui/guiutility.h" -#include "blackcore/context/contextaudio.h" -#include "blackcore/context/contextownaircraft.h" -#include "blackmisc/audio/notificationsounds.h" -#include "blackmisc/audio/voiceroom.h" -#include "blackmisc/aviation/comsystem.h" -#include "blackmisc/sequence.h" - - -#include -#include -#include -#include - -using namespace BlackCore; -using namespace BlackCore::Context; -using namespace BlackMisc::Audio; -using namespace BlackMisc::Aviation; - -namespace BlackGui -{ - namespace Components - { - CVoiceRoomsComponent::CVoiceRoomsComponent(QWidget *parent) : - QFrame(parent), - ui(new Ui::CVoiceRoomsComponent) - { - Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui"); - ui->setupUi(this); - this->setVoiceRoomUrlFieldsReadOnlyState(); - connect(ui->cb_CockpitVoiceRoom1Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::onVoiceRoomOverrideChanged); - connect(ui->cb_CockpitVoiceRoom2Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::onVoiceRoomOverrideChanged); - connect(ui->le_CockpitVoiceRoomCom1, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed); - connect(ui->le_CockpitVoiceRoomCom2, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed); - // connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRooms, this, &CVoiceRoomsComponent::updateAudioVoiceRoomsFromContext, Qt::QueuedConnection); - // connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRoomMembers, this, &CVoiceRoomsComponent::updateVoiceRoomMembers, Qt::QueuedConnection); - } - - CVoiceRoomsComponent::~CVoiceRoomsComponent() - { } - - void CVoiceRoomsComponent::onVoiceRoomOverrideChanged(bool checked) - { - Q_UNUSED(checked); - this->setVoiceRoomUrlFieldsReadOnlyState(); - this->onVoiceRoomUrlsReturnPressed(); // use this function to update voicerooms - } - - void CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed() - { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return; } - QString url1; - QString url2; - if (ui->cb_CockpitVoiceRoom1Override->isChecked()) { url1 = ui->le_CockpitVoiceRoomCom1->text().trimmed(); } - if (ui->cb_CockpitVoiceRoom2Override->isChecked()) { url2 = ui->le_CockpitVoiceRoomCom2->text().trimmed(); } - sGui->getIContextOwnAircraft()->setAudioVoiceRoomOverrideUrls(url1, url2); - } - - void CVoiceRoomsComponent::setVoiceRoomUrlFieldsReadOnlyState() - { - const bool c1 = ui->cb_CockpitVoiceRoom1Override->isChecked(); - const bool c2 = ui->cb_CockpitVoiceRoom2Override->isChecked(); - ui->le_CockpitVoiceRoomCom1->setReadOnly(!c1); - ui->le_CockpitVoiceRoomCom2->setReadOnly(!c2); - CGuiUtility::forceStyleSheetUpdate(this); - } - - void CVoiceRoomsComponent::updateAudioVoiceRoomsFromContext(const CVoiceRoomList &selectedVoiceRooms, bool connected) - { - if (!sGui || sGui->isShuttingDown()) { return; } - - Q_ASSERT(selectedVoiceRooms.size() == 2); - const CVoiceRoom room1 = selectedVoiceRooms[0]; - const CVoiceRoom room2 = selectedVoiceRooms[1]; - - // remark: - // isAudioPlaying() is not set, as this is only a temporary value when really "something is playing" - - const bool changedUrl1 = (room1.getVoiceRoomUrl() != ui->le_CockpitVoiceRoomCom1->text()); - ui->le_CockpitVoiceRoomCom1->setText(room1.getVoiceRoomUrl()); - if (room1.isConnected()) - { - ui->le_CockpitVoiceRoomCom1->setStyleSheet("background: green"); - } - else - { - ui->le_CockpitVoiceRoomCom1->setStyleSheet(""); - ui->tvp_CockpitVoiceRoom1->clear(); - } - - const bool changedUrl2 = (room2.getVoiceRoomUrl() != ui->le_CockpitVoiceRoomCom2->text()); - ui->le_CockpitVoiceRoomCom2->setText(room2.getVoiceRoomUrl()); - if (room2.isConnected()) - { - ui->le_CockpitVoiceRoomCom2->setStyleSheet("background: green"); - } - else - { - ui->le_CockpitVoiceRoomCom2->setStyleSheet(""); - ui->tvp_CockpitVoiceRoom2->clear(); - } - - // for unconnected we already - if (connected) { this->updateVoiceRoomMembers(); } - - if (changedUrl1 || changedUrl2) - { - // notify - if (sGui->getIContextAudio()) - { - const CNotificationSounds::NotificationFlag sound = connected ? CNotificationSounds::NotificationVoiceRoomJoined : CNotificationSounds::NotificationVoiceRoomLeft; - sGui->getIContextAudio()->playNotification(sound, true); - } - } - } - - void CVoiceRoomsComponent::updateVoiceRoomMembers() - { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } - if (!ui->le_CockpitVoiceRoomCom1->text().trimmed().isEmpty()) - { - // ui->tvp_CockpitVoiceRoom1->updateContainer(sGui->getIContextAudio()->getRoomUsers(CComSystem::Com1)); - } - else - { - ui->tvp_CockpitVoiceRoom1->clear(); - } - - if (!ui->le_CockpitVoiceRoomCom2->text().trimmed().isEmpty()) - { - // ui->tvp_CockpitVoiceRoom2->updateContainer(sGui->getIContextAudio()->getRoomUsers(CComSystem::Com2)); - } - else - { - ui->tvp_CockpitVoiceRoom2->clear(); - } - } - } // namespace -} // namespace diff --git a/src/blackgui/components/voiceroomscomponent.h b/src/blackgui/components/voiceroomscomponent.h deleted file mode 100644 index 31d137c7b..000000000 --- a/src/blackgui/components/voiceroomscomponent.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, - * or distributed except according to the terms contained in the LICENSE file. - */ - -//! \file - -#ifndef BLACKGUI_VOICEROOMSCOMPONENT_H -#define BLACKGUI_VOICEROOMSCOMPONENT_H - -#include "blackgui/blackguiexport.h" -#include "blackmisc/audio/voiceroomlist.h" - -#include -#include -#include - -namespace Ui { class CVoiceRoomsComponent; } -namespace BlackGui -{ - namespace Components - { - //! Displays the voice rooms - class BLACKGUI_EXPORT CVoiceRoomsComponent : public QFrame - { - Q_OBJECT - - public: - //! Constructor - explicit CVoiceRoomsComponent(QWidget *parent = nullptr); - - //! Destructor - virtual ~CVoiceRoomsComponent(); - - private: - //! Override for voice was changed - void onVoiceRoomOverrideChanged(bool checked); - - //! Return pressed - void onVoiceRoomUrlsReturnPressed(); - - //! Set the voice room url fields (checkboxes, line edits) - void updateAudioVoiceRoomsFromContext(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms, bool connected); - - //! Update voice room views - void updateVoiceRoomMembers(); - - //! Set the URL fields - void setVoiceRoomUrlFieldsReadOnlyState(); - - QScopedPointer ui; - }; - - } // namespace -} // namespace - -#endif // guard diff --git a/src/blackgui/components/voiceroomscomponent.ui b/src/blackgui/components/voiceroomscomponent.ui deleted file mode 100644 index 4f7c870a6..000000000 --- a/src/blackgui/components/voiceroomscomponent.ui +++ /dev/null @@ -1,217 +0,0 @@ - - - CVoiceRoomsComponent - - - - 0 - 0 - 522 - 226 - - - - Voice rooms - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 75 - false - true - - - - true - - - voice room - - - - - - - - 0 - 0 - - - - override voice room - - - Ovr. - - - - - - - - - - - 0 - 0 - - - - - 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 75 - false - true - - - - true - - - voice room - - - - - - - override voice room - - - Ovr. - - - - - - - - - - - 0 - 0 - - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - - - - - - 0 - 0 - - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - - - - - - - - BlackGui::Views::CUserView - QTableView -
blackgui/views/userview.h
-
-
- - -