mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Ref T567, PTT click also on key up
* added sound * UI component
This commit is contained in:
committed by
Mat Sutcliffe
parent
754f70a4ed
commit
8c83020b92
@@ -443,7 +443,7 @@ namespace BlackCore
|
||||
const CSettings settings = m_audioSettings.getThreadLocal();
|
||||
const bool play = !considerSettings || settings.isNotificationFlagSet(notification);
|
||||
if (!play) { return; }
|
||||
if (notification == CNotificationSounds::PTTClick && (considerSettings && settings.noAudioTransmission()))
|
||||
if (notification == CNotificationSounds::PTTClickKeyDown && (considerSettings && settings.noAudioTransmission()))
|
||||
{
|
||||
if (!this->canTalk())
|
||||
{
|
||||
@@ -451,6 +451,7 @@ namespace BlackCore
|
||||
notification = CNotificationSounds::NotificationNoAudioTransmission;
|
||||
}
|
||||
}
|
||||
|
||||
CSoundGenerator::playNotificationSound(90, notification);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,9 @@ namespace BlackGui
|
||||
Q_ASSERT(c);
|
||||
|
||||
// checkboxes for notifications
|
||||
c = connect(ui->cb_SetupAudioPTTClick, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled);
|
||||
c = connect(ui->cb_SetupAudioPTTClickDown, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioPTTClickUp, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNotificationVoiceRoomLeft, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled);
|
||||
Q_ASSERT(c);
|
||||
@@ -108,7 +110,7 @@ namespace BlackGui
|
||||
bool CAudioSetupComponent::playNotificationSounds() const
|
||||
{
|
||||
if (!this->hasAudio()) { return false; }
|
||||
return ui->cb_SetupAudioPTTClick->isChecked() ||
|
||||
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();
|
||||
@@ -117,7 +119,10 @@ namespace BlackGui
|
||||
void CAudioSetupComponent::reloadSettings()
|
||||
{
|
||||
const CSettings as(m_audioSettings.getThreadLocal());
|
||||
ui->cb_SetupAudioPTTClick->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTClick));
|
||||
|
||||
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));
|
||||
@@ -142,7 +147,9 @@ namespace BlackGui
|
||||
{
|
||||
if (!cb) { return CNotificationSounds::NoNotifications; }
|
||||
|
||||
if (cb == ui->cb_SetupAudioPTTClick) { return CNotificationSounds::PTTClick; }
|
||||
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; }
|
||||
@@ -221,13 +228,17 @@ 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::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);
|
||||
|
||||
|
||||
@@ -149,9 +149,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClick">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickDown">
|
||||
<property name="text">
|
||||
<string>PTT click</string>
|
||||
<string>PTT click (key down)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -176,6 +176,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickUp">
|
||||
<property name="text">
|
||||
<string>PTT click (key up)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -204,7 +211,7 @@
|
||||
<tabstop>cb_SetupAudioNotificationVoiceRoomJoined</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationVoiceRoomLeft</tabstop>
|
||||
<tabstop>cb_SetupAudioNoTransmission</tabstop>
|
||||
<tabstop>cb_SetupAudioPTTClick</tabstop>
|
||||
<tabstop>cb_SetupAudioPTTClickDown</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace BlackMisc
|
||||
bool textMessageSupervisor() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor); }
|
||||
bool textCallsignMentioned() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned); }
|
||||
bool noAudioTransmission() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission); }
|
||||
bool pttClick() const { return this->isNotificationFlagSet(CNotificationSounds::PTTClick); }
|
||||
bool pttClickDown() const { return this->isNotificationFlagSet(CNotificationSounds::PTTClickKeyDown); }
|
||||
bool pttClickUp() const { return this->isNotificationFlagSet(CNotificationSounds::PTTClickKeyUp); }
|
||||
//! @}
|
||||
|
||||
//! Settings value
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackMisc
|
||||
case NotificationVoiceRoomJoined: return joined;
|
||||
case NotificationVoiceRoomLeft: return left;
|
||||
case NotificationNoAudioTransmission: return noaudiotx;
|
||||
case PTTClick: return ptt;
|
||||
case PTTClickKeyDown: return ptt;
|
||||
case LoadSounds: return load;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -46,14 +46,15 @@ namespace BlackMisc
|
||||
NotificationVoiceRoomJoined = 1 << 6,
|
||||
NotificationVoiceRoomLeft = 1 << 7,
|
||||
NotificationNoAudioTransmission = 1 << 8,
|
||||
PTTClick = 1 << 9,
|
||||
LoadSounds = 1 << 10, //!< end marker and force loading of sounds, keep as last element
|
||||
PTTClickKeyDown = 1 << 9,
|
||||
PTTClickKeyUp = 1 << 10,
|
||||
LoadSounds = 1 << 11, //!< end marker and force loading of sounds, keep as last element
|
||||
AllTextNotifications = NotificationTextMessagePrivate | NotificationTextCallsignMentioned | NotificationTextMessageSupervisor,
|
||||
AllLoginNotifications = NotificationLogin | NotificationLogoff,
|
||||
AllVoiceRoomNotifications = NotificationVoiceRoomJoined | NotificationVoiceRoomLeft | NotificationNoAudioTransmission,
|
||||
AllNotifications = NotificationError | AllTextNotifications | AllLoginNotifications | AllVoiceRoomNotifications,
|
||||
DefaultNotifications = NotificationError | AllTextNotifications | AllLoginNotifications | AllVoiceRoomNotifications,
|
||||
All = AllNotifications | PTTClick
|
||||
All = AllNotifications | PTTClickKeyDown | PTTClickKeyUp
|
||||
};
|
||||
Q_DECLARE_FLAGS(Notification, NotificationFlag)
|
||||
|
||||
|
||||
@@ -505,6 +505,7 @@ namespace BlackSound
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/voiceroomleft.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/noaudiotransmission.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/pttclick.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/pttclick.wav")) && success;
|
||||
|
||||
Q_ASSERT(success);
|
||||
playlist->setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
|
||||
|
||||
@@ -489,9 +489,10 @@ void SwiftGuiStd::displayLog()
|
||||
|
||||
void SwiftGuiStd::onPttChanged(bool enabled)
|
||||
{
|
||||
if (!enabled) { return; }
|
||||
if (!sGui || !sGui->getIContextAudio()) { return; }
|
||||
sGui->getIContextAudio()->playNotification(CNotificationSounds::PTTClick, true);
|
||||
sGui->getIContextAudio()->playNotification(
|
||||
enabled ? CNotificationSounds::PTTClickKeyDown : CNotificationSounds::PTTClickKeyUp,
|
||||
true);
|
||||
}
|
||||
|
||||
void SwiftGuiStd::displayDBusReconnectDialog()
|
||||
|
||||
Reference in New Issue
Block a user