mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Added value for notification volume in sound setting
This commit is contained in:
@@ -449,7 +449,9 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_notificationPlayer.play(notification, 90);
|
int volume = 90;
|
||||||
|
if (considerSettings) { volume = qMax(25, settings.getNotificationVolume()); }
|
||||||
|
m_notificationPlayer.play(notification, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudio::enableAudioLoopback(bool enable)
|
void CContextAudio::enableAudioLoopback(bool enable)
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
// sound
|
// sound
|
||||||
const bool playSound = !m_usedAsOverlayWidget && sGui && !sGui->isShuttingDown() && sGui->getIContextAudio();
|
const bool playSound = !m_usedAsOverlayWidget && sGui && !sGui->isShuttingDown() && sGui->getIContextAudio();
|
||||||
if (playSound)
|
if (sGui && sGui->getIContextAudio() && playSound)
|
||||||
{
|
{
|
||||||
const CSettings settings = m_audioSettings.get();
|
const CSettings settings = m_audioSettings.get();
|
||||||
if (textMessage.isSupervisorMessage() && settings.textMessageSupervisor())
|
if (textMessage.isSupervisorMessage() && settings.textMessageSupervisor())
|
||||||
|
|||||||
@@ -55,15 +55,24 @@ namespace BlackMisc
|
|||||||
m_notificationSoundDir = d;
|
m_notificationSoundDir = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettings::setNotificationVolume(int volume)
|
||||||
|
{
|
||||||
|
m_notificationVolume = volume;
|
||||||
|
if (m_notificationVolume < 0) { m_notificationVolume = 0; }
|
||||||
|
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
||||||
|
}
|
||||||
|
|
||||||
QString CSettings::convertToQString(bool i18n) const
|
QString CSettings::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
return u"Notification flags: " % CNotificationSounds::toString(this->getNotification());
|
return u"Notification flags: " % CNotificationSounds::toString(this->getNotification()) %
|
||||||
|
u" volume: " % QString::number(m_notificationVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettings::initDefaultValues()
|
void CSettings::initDefaultValues()
|
||||||
{
|
{
|
||||||
this->setNotification(CNotificationSounds::AllNotifications);
|
this->setNotification(CNotificationSounds::AllNotifications);
|
||||||
|
m_notificationVolume = 90;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ namespace BlackMisc
|
|||||||
//! Notification directory
|
//! Notification directory
|
||||||
const QString &getNotificationSoundDirectory() const { return m_notificationSoundDir; }
|
const QString &getNotificationSoundDirectory() const { return m_notificationSoundDir; }
|
||||||
|
|
||||||
|
//! Set volume
|
||||||
|
void setNotificationVolume(int volume);
|
||||||
|
|
||||||
|
//! Get volume
|
||||||
|
int getNotificationVolume() const { return m_notificationVolume; }
|
||||||
|
|
||||||
//! Init with meaningful default values
|
//! Init with meaningful default values
|
||||||
void initDefaultValues();
|
void initDefaultValues();
|
||||||
|
|
||||||
@@ -72,12 +78,14 @@ namespace BlackMisc
|
|||||||
private:
|
private:
|
||||||
QString m_notificationSoundDir;
|
QString m_notificationSoundDir;
|
||||||
int m_notification = static_cast<int>(CNotificationSounds::DefaultNotifications); //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
|
int m_notification = static_cast<int>(CNotificationSounds::DefaultNotifications); //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
|
||||||
|
int m_notificationVolume = 90; //!< 0-100;
|
||||||
void initNotificationFlags(); //!< init flags
|
void initNotificationFlags(); //!< init flags
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CSettings,
|
CSettings,
|
||||||
BLACK_METAMEMBER(notificationSoundDir),
|
BLACK_METAMEMBER(notificationSoundDir),
|
||||||
BLACK_METAMEMBER(notification)
|
BLACK_METAMEMBER(notification),
|
||||||
|
BLACK_METAMEMBER(notificationVolume)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user