From 05906994523e53ba1d881e01f0ec390206d16b02 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Thu, 22 Jul 2021 19:18:40 +0100 Subject: [PATCH] Issue #111 New notification sounds --- .../components/audionotificationcomponent.cpp | 23 +++++--- .../components/audionotificationcomponent.ui | 52 +++++++++++++------ src/blackmisc/audio/notificationsounds.cpp | 6 +++ src/blackmisc/audio/notificationsounds.h | 7 ++- src/blacksound/notificationplayer.cpp | 2 + 5 files changed, 64 insertions(+), 26 deletions(-) diff --git a/src/blackgui/components/audionotificationcomponent.cpp b/src/blackgui/components/audionotificationcomponent.cpp index 96ec034c8..cd9e72790 100644 --- a/src/blackgui/components/audionotificationcomponent.cpp +++ b/src/blackgui/components/audionotificationcomponent.cpp @@ -62,19 +62,19 @@ namespace BlackGui Q_ASSERT(c); c = connect(ui->cb_SetupAudioPTTBlocked, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); + c = connect(ui->cb_SetupAudioNotificationTextMessageFrequency, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); + Q_ASSERT(c); c = connect(ui->cb_SetupAudioNotificationTextMessagePrivate, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); c = connect(ui->cb_SetupAudioNotificationTextMessageSupervisor, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); + c = connect(ui->cb_SetupAudioNotificationTextMessageUnicom, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); + Q_ASSERT(c); c = connect(ui->cb_SetupAudioNotificationTextCallsignMentioned, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationTextMessageSupervisor, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); + c = connect(ui->cb_SetupAudioNotificationAtcTunedOut, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationTextMessageSupervisor, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationAtcTunedOut, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); - Q_ASSERT(c); - c = connect(ui->cb_SetupAudioNotificationAtcTunedIn, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); + c = connect(ui->cb_SetupAudioNotificationAtcTunedIn, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); c = connect(ui->cb_SetupAudioNoTransmission, &QCheckBox::toggled, this, &CAudioNotificationComponent::onNotificationsToggled, Qt::QueuedConnection); Q_ASSERT(c); @@ -82,9 +82,9 @@ namespace BlackGui 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); + 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); + c = connect(ui->pb_SoundDir, &QPushButton::released, this, &CAudioNotificationComponent::selectNotificationSoundsDir, Qt::QueuedConnection); Q_ASSERT(c); // volumes @@ -99,6 +99,7 @@ namespace BlackGui { return ui->cb_SetupAudioPTTClickDown->isChecked() || ui->cb_SetupAudioPTTClickUp->isChecked() || ui->cb_SetupAudioPTTBlocked->isChecked() || + ui->cb_SetupAudioNotificationTextMessageFrequency->isChecked() || ui->cb_SetupAudioNotificationTextMessageUnicom->isChecked() || ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked() || ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked() || ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked() || ui->cb_SetupAudioNoTransmission->isChecked() || ui->cb_SetupAfvBlocked->isChecked() || ui->cb_SetupAfvClicked->isChecked() || @@ -113,8 +114,10 @@ namespace BlackGui ui->cb_SetupAudioPTTClickUp->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTClickKeyUp)); ui->cb_SetupAudioPTTBlocked->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTBlocked)); + ui->cb_SetupAudioNotificationTextMessageFrequency->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageFrequency)); ui->cb_SetupAudioNotificationTextMessagePrivate->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate)); ui->cb_SetupAudioNotificationTextMessageSupervisor->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor)); + ui->cb_SetupAudioNotificationTextMessageUnicom->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageUnicom)); ui->cb_SetupAudioNotificationTextCallsignMentioned->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned)); ui->cb_SetupAudioNotificationAtcTunedIn->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationAtcTunedIn)); ui->cb_SetupAudioNotificationAtcTunedOut->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationAtcTunedOut)); @@ -145,8 +148,10 @@ namespace BlackGui if (cb == ui->cb_SetupAudioPTTBlocked) { return CNotificationSounds::PTTBlocked; } if (cb == ui->cb_SetupAudioNotificationTextCallsignMentioned) { return CNotificationSounds::NotificationTextCallsignMentioned; } + if (cb == ui->cb_SetupAudioNotificationTextMessageFrequency) { return CNotificationSounds::NotificationTextMessageFrequency; } if (cb == ui->cb_SetupAudioNotificationTextMessagePrivate) { return CNotificationSounds::NotificationTextMessagePrivate; } if (cb == ui->cb_SetupAudioNotificationTextMessageSupervisor) { return CNotificationSounds::NotificationTextMessageSupervisor; } + if (cb == ui->cb_SetupAudioNotificationTextMessageUnicom) { return CNotificationSounds::NotificationTextMessageUnicom; } if (cb == ui->cb_SetupAudioNotificationAtcTunedIn) { return CNotificationSounds::NotificationAtcTunedIn; } if (cb == ui->cb_SetupAudioNotificationAtcTunedOut) { return CNotificationSounds::NotificationAtcTunedOut; } @@ -167,8 +172,10 @@ namespace BlackGui as.setNotificationFlag(CNotificationSounds::PTTClickKeyUp, ui->cb_SetupAudioPTTClickUp->isChecked()); as.setNotificationFlag(CNotificationSounds::PTTBlocked, ui->cb_SetupAudioPTTBlocked->isChecked()); + as.setNotificationFlag(CNotificationSounds::NotificationTextMessageFrequency, ui->cb_SetupAudioNotificationTextMessageFrequency->isChecked()); as.setNotificationFlag(CNotificationSounds::NotificationTextMessagePrivate, ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked()); as.setNotificationFlag(CNotificationSounds::NotificationTextMessageSupervisor, ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked()); + as.setNotificationFlag(CNotificationSounds::NotificationTextMessageUnicom, ui->cb_SetupAudioNotificationTextMessageUnicom->isChecked()); as.setNotificationFlag(CNotificationSounds::NotificationTextCallsignMentioned, ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked()); as.setNotificationFlag(CNotificationSounds::NotificationNoAudioTransmission, ui->cb_SetupAudioNoTransmission->isChecked()); diff --git a/src/blackgui/components/audionotificationcomponent.ui b/src/blackgui/components/audionotificationcomponent.ui index 28db7c1b3..07b37c6ff 100644 --- a/src/blackgui/components/audionotificationcomponent.ui +++ b/src/blackgui/components/audionotificationcomponent.ui @@ -50,14 +50,14 @@ - + PTT blocking - + AFV click @@ -129,24 +129,38 @@ - - + + - notfication for text msg. with my callsign + Text message on ATC frequency - + + + + Text message on UNICOM + + + + + + + Text message mentions my callsign + + + + AFV blocking - + - notification for private text messages + Private text message @@ -157,42 +171,42 @@ - + ATC frequency selected - + PTT click (key down) - + - supervisor messages + Supervisor text message - + No audio transmission warning - + PTT click (key up) - + ATC frequency deselected @@ -211,13 +225,19 @@ pb_SoundReset pb_SoundDir sb_NotificationValueVolume + cb_SetupAudioNotificationTextMessageFrequency + cb_SetupAudioNotificationTextMessageUnicom + cb_SetupAudioNotificationTextCallsignMentioned cb_SetupAudioNotificationTextMessagePrivate cb_SetupAudioNotificationTextMessageSupervisor - cb_SetupAudioNotificationTextCallsignMentioned cb_SetupAudioNoTransmission cb_SetupAudioPTTClickDown cb_SetupAudioPTTClickUp cb_SetupAudioPTTBlocked + cb_SetupAfvClicked + cb_SetupAfvBlocked + cb_SetupAudioNotificationAtcTunedIn + cb_SetupAudioNotificationAtcTunedOut diff --git a/src/blackmisc/audio/notificationsounds.cpp b/src/blackmisc/audio/notificationsounds.cpp index 58e212d29..1fa14d6b2 100644 --- a/src/blackmisc/audio/notificationsounds.cpp +++ b/src/blackmisc/audio/notificationsounds.cpp @@ -23,8 +23,10 @@ namespace BlackMisc static const QString error("error"); static const QString login("login"); static const QString logoff("logoff"); + static const QString freqMsg("frequency msg."); static const QString privateMsg("private msg."); static const QString supMsg("supervisor msg."); + static const QString unicomMsg("unicom msg."); static const QString mentioned("cs mentioned"); static const QString joined("room joined"); static const QString left("room left"); @@ -43,8 +45,10 @@ namespace BlackMisc case NotificationError: return error; case NotificationLogin: return login; case NotificationLogoff: return logoff; + case NotificationTextMessageFrequency: return freqMsg; case NotificationTextMessagePrivate: return privateMsg; case NotificationTextMessageSupervisor: return supMsg; + case NotificationTextMessageUnicom: return unicomMsg; case NotificationTextCallsignMentioned: return mentioned; case NotificationNoAudioTransmission: return noaudiotx; case NotificationAtcTunedIn: return tunein; @@ -66,8 +70,10 @@ namespace BlackMisc if (notification.testFlag(NotificationError)) n << flagToString(NotificationError); if (notification.testFlag(NotificationLogin)) n << flagToString(NotificationLogin); if (notification.testFlag(NotificationLogoff)) n << flagToString(NotificationLogoff); + if (notification.testFlag(NotificationTextMessageFrequency)) n << flagToString(NotificationTextMessageFrequency); if (notification.testFlag(NotificationTextMessagePrivate)) n << flagToString(NotificationTextMessagePrivate); if (notification.testFlag(NotificationTextMessageSupervisor)) n << flagToString(NotificationTextMessageSupervisor); + if (notification.testFlag(NotificationTextMessageUnicom)) n << flagToString(NotificationTextMessageUnicom); if (notification.testFlag(NotificationTextCallsignMentioned)) n << flagToString(NotificationTextCallsignMentioned); if (notification.testFlag(NotificationNoAudioTransmission)) n << flagToString(NotificationNoAudioTransmission); diff --git a/src/blackmisc/audio/notificationsounds.h b/src/blackmisc/audio/notificationsounds.h index 721166caa..55ae83438 100644 --- a/src/blackmisc/audio/notificationsounds.h +++ b/src/blackmisc/audio/notificationsounds.h @@ -40,8 +40,10 @@ namespace BlackMisc NotificationError = 1 << 0, NotificationLogin = 1 << 1, NotificationLogoff = 1 << 2, + NotificationTextMessageFrequency = 1 << 12, NotificationTextMessagePrivate = 1 << 3, NotificationTextMessageSupervisor = 1 << 4, + NotificationTextMessageUnicom = 1 << 13, NotificationTextCallsignMentioned = 1 << 5, NotificationNoAudioTransmission = 1 << 6, NotificationAtcTunedIn = 1 << 10, @@ -55,7 +57,8 @@ namespace BlackMisc Q_DECLARE_FLAGS(Notification, NotificationFlag) //! All text notification flags - constexpr static Notification AllTextNotifications = Notification(NotificationTextMessagePrivate | NotificationTextCallsignMentioned | NotificationTextMessageSupervisor); + constexpr static Notification AllTextNotifications = Notification( + NotificationTextMessageFrequency | NotificationTextMessagePrivate | NotificationTextCallsignMentioned | NotificationTextMessageSupervisor | NotificationTextMessageUnicom); //! All login notification flags constexpr static Notification AllLoginNotifications = Notification(NotificationLogin | NotificationLogoff); @@ -70,7 +73,7 @@ namespace BlackMisc constexpr static Notification AllNotifications = Notification(NotificationError | AllTextNotifications | AllLoginNotifications | AllPTTNotifications | AllAfv); //! Default notification flags - constexpr static Notification DefaultNotifications = Notification(AllNotifications); + constexpr static Notification DefaultNotifications = Notification(AllNotifications & ~(NotificationTextMessageFrequency | NotificationTextMessageUnicom)); //! As string static const QString &flagToString(NotificationFlag notification); diff --git a/src/blacksound/notificationplayer.cpp b/src/blacksound/notificationplayer.cpp index 3b4b212dd..b07d3f6f4 100644 --- a/src/blacksound/notificationplayer.cpp +++ b/src/blacksound/notificationplayer.cpp @@ -67,8 +67,10 @@ namespace BlackSound this->updateEffect(CNotificationSounds::NotificationError, directory, "error.wav"); this->updateEffect(CNotificationSounds::NotificationLogin, directory, "login.wav"); this->updateEffect(CNotificationSounds::NotificationLogoff, directory, "logoff.wav"); + this->updateEffect(CNotificationSounds::NotificationTextMessageFrequency, directory, "frequencymessage.wav"); this->updateEffect(CNotificationSounds::NotificationTextMessagePrivate, directory, "privatemessage.wav"); this->updateEffect(CNotificationSounds::NotificationTextMessageSupervisor, directory, "supervisormessage.wav"); + this->updateEffect(CNotificationSounds::NotificationTextMessageUnicom, directory, "unicommessage.wav"); this->updateEffect(CNotificationSounds::NotificationTextCallsignMentioned, directory, "callsignmentioned.wav"); this->updateEffect(CNotificationSounds::NotificationNoAudioTransmission, directory, "noaudiotransmission.wav"); this->updateEffect(CNotificationSounds::NotificationAtcTunedIn, directory, "atctunedin.wav");