mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T644, audio volume for notification sounds can be set
This commit is contained in:
@@ -104,6 +104,8 @@ namespace BlackGui
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->pb_SoundDir, &QPushButton::released, this, &CAudioSetupComponent::selectNotificationSoundsDir, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->sb_NotificationValueVolume, qOverload<int>(&QSpinBox::valueChanged), this, &CAudioSetupComponent::onVolumeChanged);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
@@ -135,6 +137,7 @@ namespace BlackGui
|
||||
ui->cb_SetupAudioNoTransmission->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission));
|
||||
|
||||
ui->le_SoundDir->setText(as.getNotificationSoundDirectory());
|
||||
ui->sb_NotificationValueVolume->setValue(as.getNotificationVolume());
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::initAudioDeviceLists()
|
||||
@@ -149,6 +152,15 @@ namespace BlackGui
|
||||
return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject();
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onVolumeChanged(int volume)
|
||||
{
|
||||
volume = qMax(25, qMin(100, volume));
|
||||
CSettings as(m_audioSettings.getThreadLocal());
|
||||
if (as.getNotificationVolume() == volume) { return; }
|
||||
as.setNotificationVolume(volume);
|
||||
m_audioSettings.set(as);
|
||||
}
|
||||
|
||||
CNotificationSounds::NotificationFlag CAudioSetupComponent::checkBoxToFlag(const QCheckBox *cb) const
|
||||
{
|
||||
if (!cb) { return CNotificationSounds::NoNotifications; }
|
||||
@@ -252,7 +264,7 @@ namespace BlackGui
|
||||
if (checked && this->hasAudio() && sender)
|
||||
{
|
||||
const CNotificationSounds::NotificationFlag f = this->checkBoxToFlag(sender);
|
||||
sGui->getIContextAudio()->playNotification(f, false);
|
||||
sGui->getIContextAudio()->playNotification(f, false, as.getNotificationVolume());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@ namespace BlackGui
|
||||
//! Audio is optional, check if available
|
||||
bool hasAudio() const;
|
||||
|
||||
//! Volume has been changed
|
||||
void onVolumeChanged(int volume);
|
||||
|
||||
//! CheckBox to flag
|
||||
BlackMisc::Audio::CNotificationSounds::NotificationFlag checkBoxToFlag(const QCheckBox *cb) const;
|
||||
|
||||
|
||||
@@ -108,14 +108,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbl_SoundDirectory">
|
||||
<property name="text">
|
||||
<string>Dir.:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QWidget" name="wi_SoundDir" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_SoundDir" stretch="0,0,0">
|
||||
<property name="leftMargin">
|
||||
@@ -154,7 +154,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbl_Notifications">
|
||||
<property name="toolTip">
|
||||
<string>Notifications</string>
|
||||
@@ -164,6 +164,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="sb_NotificationValueVolume">
|
||||
<property name="suffix">
|
||||
<string> volume 25-100 (notifications)</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>90</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessagePrivate">
|
||||
<property name="text">
|
||||
@@ -245,7 +261,6 @@
|
||||
<tabstop>le_SoundDir</tabstop>
|
||||
<tabstop>pb_SoundReset</tabstop>
|
||||
<tabstop>pb_SoundDir</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextMessagePrivate</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextMessageSupervisor</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextCallsignMentioned</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationVoiceRoomJoined</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user