mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T644, allow to set notification sounds directory
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QtGlobal>
|
||||
#include <QPointer>
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Context;
|
||||
@@ -51,8 +52,7 @@ namespace BlackGui
|
||||
|
||||
void CAudioSetupComponent::init()
|
||||
{
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
||||
Q_ASSERT_X(sGui->getIContextAudio(), Q_FUNC_INFO, "Missing Audio context");
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
|
||||
// audio is optional
|
||||
const bool audio = this->hasAudio();
|
||||
@@ -84,21 +84,25 @@ namespace BlackGui
|
||||
Q_ASSERT(c);
|
||||
|
||||
// checkboxes for notifications
|
||||
c = connect(ui->cb_SetupAudioPTTClickDown, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
Q_UNUSED(c);
|
||||
@@ -129,6 +133,8 @@ namespace BlackGui
|
||||
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());
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::initAudioDeviceLists()
|
||||
@@ -249,5 +255,28 @@ namespace BlackGui
|
||||
sGui->getIContextAudio()->playNotification(f, false);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackGui
|
||||
explicit CAudioSetupComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAudioSetupComponent();
|
||||
virtual ~CAudioSetupComponent() override;
|
||||
|
||||
//! Play any sounds?
|
||||
bool playNotificationSounds() const;
|
||||
@@ -64,6 +64,12 @@ namespace BlackGui
|
||||
//! Notification flags toggled
|
||||
void onNotificationsToggled(bool checked);
|
||||
|
||||
//! Notification sounds dir
|
||||
void selectNotificationSoundsDir();
|
||||
|
||||
//! Notification sounds dir
|
||||
void resetNotificationSoundsDir();
|
||||
|
||||
//! Audio device lists from settings
|
||||
void initAudioDeviceLists();
|
||||
|
||||
|
||||
@@ -6,22 +6,13 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>216</width>
|
||||
<height>322</height>
|
||||
<width>277</width>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Audio setup</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AudioSetup">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
@@ -118,6 +109,52 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbl_SoundDirectory">
|
||||
<property name="text">
|
||||
<string>Dir.:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QWidget" name="wi_SoundDir" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_SoundDir" stretch="0,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_SoundDir">
|
||||
<property name="placeholderText">
|
||||
<string>your private sound directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_SoundReset">
|
||||
<property name="text">
|
||||
<string>reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_SoundDir">
|
||||
<property name="text">
|
||||
<string>[...]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lbl_Notifications">
|
||||
<property name="toolTip">
|
||||
<string>Notifications</string>
|
||||
@@ -127,7 +164,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessagePrivate">
|
||||
<property name="text">
|
||||
<string>notification for private text messages</string>
|
||||
@@ -135,41 +172,34 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextCallsignMentioned">
|
||||
<property name="text">
|
||||
<string>notfication for text msg. with my callsign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoomJoined">
|
||||
<property name="text">
|
||||
<string>notification joining a voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickDown">
|
||||
<property name="text">
|
||||
<string>PTT click (key down)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoomLeft">
|
||||
<property name="text">
|
||||
<string>notification leaving a voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessageSupervisor">
|
||||
<property name="text">
|
||||
<string>supervisor messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextCallsignMentioned">
|
||||
<property name="text">
|
||||
<string>notfication for text msg. with my callsign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoomJoined">
|
||||
<property name="text">
|
||||
<string>notification joining a voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoomLeft">
|
||||
<property name="text">
|
||||
<string>notification leaving a voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNoTransmission">
|
||||
<property name="text">
|
||||
<string>No audio transmission warning</string>
|
||||
@@ -177,6 +207,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickDown">
|
||||
<property name="text">
|
||||
<string>PTT click (key down)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickUp">
|
||||
<property name="text">
|
||||
<string>PTT click (key up)</string>
|
||||
@@ -205,6 +242,9 @@
|
||||
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
||||
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
||||
<tabstop>cb_SetupAudioLoopback</tabstop>
|
||||
<tabstop>le_SoundDir</tabstop>
|
||||
<tabstop>pb_SoundReset</tabstop>
|
||||
<tabstop>pb_SoundDir</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextMessagePrivate</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextMessageSupervisor</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextCallsignMentioned</tabstop>
|
||||
@@ -212,6 +252,7 @@
|
||||
<tabstop>cb_SetupAudioNotificationVoiceRoomLeft</tabstop>
|
||||
<tabstop>cb_SetupAudioNoTransmission</tabstop>
|
||||
<tabstop>cb_SetupAudioPTTClickDown</tabstop>
|
||||
<tabstop>cb_SetupAudioPTTClickUp</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user