mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T644, allow to set notification sounds directory
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
using namespace BlackCore::Context;
|
using namespace BlackCore::Context;
|
||||||
@@ -51,8 +52,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAudioSetupComponent::init()
|
void CAudioSetupComponent::init()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||||
Q_ASSERT_X(sGui->getIContextAudio(), Q_FUNC_INFO, "Missing Audio context");
|
|
||||||
|
|
||||||
// audio is optional
|
// audio is optional
|
||||||
const bool audio = this->hasAudio();
|
const bool audio = this->hasAudio();
|
||||||
@@ -84,21 +84,25 @@ namespace BlackGui
|
|||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
|
|
||||||
// checkboxes for notifications
|
// 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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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_ASSERT(c);
|
||||||
}
|
}
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
@@ -129,6 +133,8 @@ namespace BlackGui
|
|||||||
ui->cb_SetupAudioNotificationTextMessageSupervisor->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor));
|
ui->cb_SetupAudioNotificationTextMessageSupervisor->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor));
|
||||||
ui->cb_SetupAudioNotificationTextCallsignMentioned->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned));
|
ui->cb_SetupAudioNotificationTextCallsignMentioned->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned));
|
||||||
ui->cb_SetupAudioNoTransmission->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission));
|
ui->cb_SetupAudioNoTransmission->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission));
|
||||||
|
|
||||||
|
ui->le_SoundDir->setText(as.getNotificationSoundDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioSetupComponent::initAudioDeviceLists()
|
void CAudioSetupComponent::initAudioDeviceLists()
|
||||||
@@ -249,5 +255,28 @@ namespace BlackGui
|
|||||||
sGui->getIContextAudio()->playNotification(f, false);
|
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
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace BlackGui
|
|||||||
explicit CAudioSetupComponent(QWidget *parent = nullptr);
|
explicit CAudioSetupComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CAudioSetupComponent();
|
virtual ~CAudioSetupComponent() override;
|
||||||
|
|
||||||
//! Play any sounds?
|
//! Play any sounds?
|
||||||
bool playNotificationSounds() const;
|
bool playNotificationSounds() const;
|
||||||
@@ -64,6 +64,12 @@ namespace BlackGui
|
|||||||
//! Notification flags toggled
|
//! Notification flags toggled
|
||||||
void onNotificationsToggled(bool checked);
|
void onNotificationsToggled(bool checked);
|
||||||
|
|
||||||
|
//! Notification sounds dir
|
||||||
|
void selectNotificationSoundsDir();
|
||||||
|
|
||||||
|
//! Notification sounds dir
|
||||||
|
void resetNotificationSoundsDir();
|
||||||
|
|
||||||
//! Audio device lists from settings
|
//! Audio device lists from settings
|
||||||
void initAudioDeviceLists();
|
void initAudioDeviceLists();
|
||||||
|
|
||||||
|
|||||||
@@ -6,22 +6,13 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>216</width>
|
<width>277</width>
|
||||||
<height>322</height>
|
<height>464</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Audio setup</string>
|
<string>Audio setup</string>
|
||||||
</property>
|
</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">
|
<layout class="QVBoxLayout" name="vl_AudioSetup">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
@@ -118,6 +109,52 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<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">
|
<widget class="QLabel" name="lbl_Notifications">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Notifications</string>
|
<string>Notifications</string>
|
||||||
@@ -127,7 +164,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessagePrivate">
|
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessagePrivate">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>notification for private text messages</string>
|
<string>notification for private text messages</string>
|
||||||
@@ -135,41 +172,34 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<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">
|
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessageSupervisor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>supervisor messages</string>
|
<string>supervisor messages</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<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">
|
<widget class="QCheckBox" name="cb_SetupAudioNoTransmission">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>No audio transmission warning</string>
|
<string>No audio transmission warning</string>
|
||||||
@@ -177,6 +207,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<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">
|
<widget class="QCheckBox" name="cb_SetupAudioPTTClickUp">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PTT click (key up)</string>
|
<string>PTT click (key up)</string>
|
||||||
@@ -205,6 +242,9 @@
|
|||||||
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
||||||
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
||||||
<tabstop>cb_SetupAudioLoopback</tabstop>
|
<tabstop>cb_SetupAudioLoopback</tabstop>
|
||||||
|
<tabstop>le_SoundDir</tabstop>
|
||||||
|
<tabstop>pb_SoundReset</tabstop>
|
||||||
|
<tabstop>pb_SoundDir</tabstop>
|
||||||
<tabstop>cb_SetupAudioNotificationTextMessagePrivate</tabstop>
|
<tabstop>cb_SetupAudioNotificationTextMessagePrivate</tabstop>
|
||||||
<tabstop>cb_SetupAudioNotificationTextMessageSupervisor</tabstop>
|
<tabstop>cb_SetupAudioNotificationTextMessageSupervisor</tabstop>
|
||||||
<tabstop>cb_SetupAudioNotificationTextCallsignMentioned</tabstop>
|
<tabstop>cb_SetupAudioNotificationTextCallsignMentioned</tabstop>
|
||||||
@@ -212,6 +252,7 @@
|
|||||||
<tabstop>cb_SetupAudioNotificationVoiceRoomLeft</tabstop>
|
<tabstop>cb_SetupAudioNotificationVoiceRoomLeft</tabstop>
|
||||||
<tabstop>cb_SetupAudioNoTransmission</tabstop>
|
<tabstop>cb_SetupAudioNoTransmission</tabstop>
|
||||||
<tabstop>cb_SetupAudioPTTClickDown</tabstop>
|
<tabstop>cb_SetupAudioPTTClickDown</tabstop>
|
||||||
|
<tabstop>cb_SetupAudioPTTClickUp</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
Reference in New Issue
Block a user