From 1fe2109a893cbdf72d7d61def2ad78aa2c0010fb Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 17 Oct 2019 19:58:48 +0200 Subject: [PATCH] [AFV] Ref T730, allow to set AFV notifcation sounds in AFV settings --- .../components/audionotificationcomponent.cpp | 19 ++- .../components/audionotificationcomponent.ui | 112 ++++++++++-------- src/blacksound/notificationplayer.cpp | 6 +- 3 files changed, 85 insertions(+), 52 deletions(-) diff --git a/src/blackgui/components/audionotificationcomponent.cpp b/src/blackgui/components/audionotificationcomponent.cpp index 7847b831a..e634c1632 100644 --- a/src/blackgui/components/audionotificationcomponent.cpp +++ b/src/blackgui/components/audionotificationcomponent.cpp @@ -70,6 +70,10 @@ namespace BlackGui Q_ASSERT(c); c = connect(ui->cb_SetupAudioNoTransmission, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); + c = connect(ui->cb_SetupAfvBlocked, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); + Q_ASSERT(c); + c = connect(ui->cb_SetupAfvClicked, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); + Q_ASSERT(c); c = connect(ui->pb_SoundReset, &QPushButton::released, this, &CAudioNotificationComponent::resetNotificationSoundsDir, Qt::QueuedConnection); Q_ASSERT(c); c = connect(ui->pb_SoundDir, &QPushButton::released, this, &CAudioNotificationComponent::selectNotificationSoundsDir, Qt::QueuedConnection); @@ -88,7 +92,8 @@ namespace BlackGui return ui->cb_SetupAudioPTTClickDown->isChecked() || ui->cb_SetupAudioPTTClickUp->isChecked() || ui->cb_SetupAudioPTTBlocked->isChecked() || ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked() || ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked() || - ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked() || ui->cb_SetupAudioNoTransmission->isChecked(); + ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked() || ui->cb_SetupAudioNoTransmission->isChecked() || + ui->cb_SetupAfvBlocked->isChecked() || ui->cb_SetupAfvClicked->isChecked(); } void CAudioNotificationComponent::reloadSettings() @@ -104,6 +109,9 @@ namespace BlackGui ui->cb_SetupAudioNotificationTextCallsignMentioned->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned)); ui->cb_SetupAudioNoTransmission->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission)); + ui->cb_SetupAfvBlocked->setChecked(as.isNotificationFlagSet(CNotificationSounds::AFVBlocked)); + ui->cb_SetupAfvClicked->setChecked(as.isNotificationFlagSet(CNotificationSounds::AFVClicked)); + ui->le_SoundDir->setText(as.getNotificationSoundDirectory()); ui->sb_NotificationValueVolume->setValue(as.getNotificationVolume()); } @@ -123,12 +131,16 @@ namespace BlackGui if (cb == ui->cb_SetupAudioPTTClickDown) { return CNotificationSounds::PTTClickKeyDown; } if (cb == ui->cb_SetupAudioPTTClickUp) { return CNotificationSounds::PTTClickKeyUp; } - if (cb == ui->cb_SetupAudioPTTBlocked) { return CNotificationSounds::PTTBlocked; } + if (cb == ui->cb_SetupAudioPTTBlocked) { return CNotificationSounds::PTTBlocked; } 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; } + + if (cb == ui->cb_SetupAfvBlocked) { return CNotificationSounds::AFVBlocked; } + if (cb == ui->cb_SetupAfvClicked) { return CNotificationSounds::AFVClicked; } + return CNotificationSounds::NoNotifications; } @@ -146,6 +158,9 @@ namespace BlackGui as.setNotificationFlag(CNotificationSounds::NotificationTextCallsignMentioned, ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked()); as.setNotificationFlag(CNotificationSounds::NotificationNoAudioTransmission, ui->cb_SetupAudioNoTransmission->isChecked()); + as.setNotificationFlag(CNotificationSounds::AFVBlocked, ui->cb_SetupAfvBlocked->isChecked()); + as.setNotificationFlag(CNotificationSounds::AFVClicked, ui->cb_SetupAfvClicked->isChecked()); + const CStatusMessage msg = m_audioSettings.set(as); CLogMessage(this).preformatted(msg); diff --git a/src/blackgui/components/audionotificationcomponent.ui b/src/blackgui/components/audionotificationcomponent.ui index bcb64a0ff..287f30d7a 100644 --- a/src/blackgui/components/audionotificationcomponent.ui +++ b/src/blackgui/components/audionotificationcomponent.ui @@ -7,7 +7,7 @@ 0 0 298 - 240 + 297 @@ -46,45 +46,14 @@ 0 0 296 - 238 + 295 - - + + - PTT click (key up) - - - - - - - supervisor messages - - - - - - - No audio transmission warning - - - - - - - PTT click (key down) - - - - - - - Notifications - - - Volume: + PTT blocking @@ -127,10 +96,24 @@ - - + + - PTT blocking + notification for private text messages + + + + + + + AFV click + + + + + + + PTT click (key down) @@ -150,6 +133,44 @@ + + + + Dir.: + + + + + + + supervisor messages + + + + + + + PTT click (key up) + + + + + + + No audio transmission warning + + + + + + + Notifications + + + Volume: + + + @@ -157,17 +178,10 @@ - - + + - notification for private text messages - - - - - - - Dir.: + AFV blocking diff --git a/src/blacksound/notificationplayer.cpp b/src/blacksound/notificationplayer.cpp index 17693d862..bc5297c1b 100644 --- a/src/blacksound/notificationplayer.cpp +++ b/src/blacksound/notificationplayer.cpp @@ -15,6 +15,7 @@ using namespace BlackMisc; using namespace BlackMisc::Audio; +using namespace BlackSound::SampleProvider; namespace BlackSound { @@ -44,7 +45,7 @@ namespace BlackSound // used for too long or hanging sounds QPointer myself(this); - QTimer::singleShot(2000, effect, [ = ] + QTimer::singleShot(3000, effect, [ = ] { if (!myself || !m_playingEffect) { return; } m_playingEffect->stop(); @@ -71,6 +72,9 @@ namespace BlackSound this->updateEffect(CNotificationSounds::PTTBlocked, directory, "pttblocked.wav"); this->updateEffect(CNotificationSounds::PTTClickKeyDown, directory, "pttclick.wav"); this->updateEffect(CNotificationSounds::PTTClickKeyUp, directory, "pttclick.wav"); + + // CNotificationSounds::AFVBlocked is generated + this->updateEffect(CNotificationSounds::AFVClicked, directory, Samples::fnClick()); } void CNotificationPlayer::onPlayingChanged()