From 25032c6210ba8964b8f273c4d523e153a0674968 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 10 Feb 2019 01:23:32 +0100 Subject: [PATCH] Ref T535, settings for supervisor message --- .../components/audiosetupcomponent.cpp | 24 ++++++++++++------- .../components/audiosetupcomponent.ui | 20 +++++++++++----- src/blackmisc/audio/audiosettings.h | 3 ++- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/blackgui/components/audiosetupcomponent.cpp b/src/blackgui/components/audiosetupcomponent.cpp index 7a1117862..b2115872d 100644 --- a/src/blackgui/components/audiosetupcomponent.cpp +++ b/src/blackgui/components/audiosetupcomponent.cpp @@ -93,6 +93,8 @@ namespace BlackGui Q_ASSERT(c); c = connect(ui->cb_SetupAudioNotificationTextMessagePrivate, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled); Q_ASSERT(c); + c = connect(ui->cb_SetupAudioNotificationTextMessageSupervisor, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled); + Q_ASSERT(c); c = connect(ui->cb_SetupAudioNotificationTextCallsignMentioned, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled); Q_ASSERT(c); } @@ -105,7 +107,8 @@ namespace BlackGui bool CAudioSetupComponent::playNotificationSounds() const { if (!this->hasAudio()) { return false; } - return ui->cb_SetupAudioPTTClick->isChecked() || ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked() || + return ui->cb_SetupAudioPTTClick->isChecked() || + ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked() || ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked() || ui->cb_SetupAudioNotificationVoiceRoomLeft->isChecked() || ui->cb_SetupAudioNotificationVoiceRoomJoined->isChecked() || ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked(); } @@ -117,6 +120,7 @@ namespace BlackGui 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)); } @@ -137,16 +141,17 @@ namespace BlackGui if (!cb) { return CNotificationSounds::NoNotifications; } if (cb == ui->cb_SetupAudioPTTClick) { return CNotificationSounds::PTTClick; } - if (cb == ui->cb_SetupAudioNotificationVoiceRoomJoined) { return CNotificationSounds::NotificationVoiceRoomJoined; } - if (cb == ui->cb_SetupAudioNotificationVoiceRoomLeft) { return CNotificationSounds::NotificationVoiceRoomLeft; } + 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_SetupAudioNotificationTextMessagePrivate) { return CNotificationSounds::NotificationTextMessagePrivate; } + if (cb == ui->cb_SetupAudioNotificationTextMessageSupervisor) { return CNotificationSounds::NotificationTextMessageSupervisor; } return CNotificationSounds::NoNotifications; } void CAudioSetupComponent::onAudioDeviceSelected(int index) { - if (!sGui->getIContextAudio()) return; + if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } if (index < 0) { return; } CAudioDeviceInfoList devices = sGui->getIContextAudio()->getAudioDevices(); @@ -213,10 +218,11 @@ namespace BlackGui { if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; } CSettings as(m_audioSettings.getThreadLocal()); - as.setNotificationFlag(CNotificationSounds::PTTClick, ui->cb_SetupAudioPTTClick->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::PTTClick, ui->cb_SetupAudioPTTClick->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()); const CStatusMessage msg = m_audioSettings.set(as); CLogMessage(this).preformatted(msg); diff --git a/src/blackgui/components/audiosetupcomponent.ui b/src/blackgui/components/audiosetupcomponent.ui index 8996f7cbd..152d3f317 100644 --- a/src/blackgui/components/audiosetupcomponent.ui +++ b/src/blackgui/components/audiosetupcomponent.ui @@ -117,7 +117,7 @@ - + Notifications @@ -127,41 +127,48 @@ - + notification for private text messages - + notfication for text msg. with my callsign - + notification joining a voice room - + PTT click - + notification leaving a voice room + + + + supervisor messages + + + @@ -185,6 +192,7 @@ cb_SetupAudioOutputDevice cb_SetupAudioLoopback cb_SetupAudioNotificationTextMessagePrivate + cb_SetupAudioNotificationTextMessageSupervisor cb_SetupAudioNotificationTextCallsignMentioned cb_SetupAudioNotificationVoiceRoomJoined cb_SetupAudioNotificationVoiceRoomLeft diff --git a/src/blackmisc/audio/audiosettings.h b/src/blackmisc/audio/audiosettings.h index 607131c2d..cccf3d908 100644 --- a/src/blackmisc/audio/audiosettings.h +++ b/src/blackmisc/audio/audiosettings.h @@ -47,7 +47,8 @@ namespace BlackMisc void setNotification(CNotificationSounds::Notification notification) { m_notification = static_cast(notification); } //! Simplified functions @{ - bool textMessagePrivate() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate); } + bool textMessagePrivate() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate); } + bool textMessageSupervisor() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor); } bool textCallsignMentioned() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned); } bool pttClick() const { return this->isNotificationFlagSet(CNotificationSounds::PTTClick); } //! @}