mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T604, remember last audio volume
* adjust setting * save setting
This commit is contained in:
committed by
Mat Sutcliffe
parent
56d72b94c1
commit
d509b1eb09
@@ -62,6 +62,13 @@ namespace BlackMisc
|
||||
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
||||
}
|
||||
|
||||
void CSettings::setAudioVolume(int volume)
|
||||
{
|
||||
m_audioVolume = volume;
|
||||
if (m_audioVolume < 0) { m_audioVolume = 0; }
|
||||
else if (m_audioVolume > MaxAudioVolume) { m_audioVolume = MaxAudioVolume; }
|
||||
}
|
||||
|
||||
QString CSettings::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
|
||||
@@ -63,29 +63,39 @@ namespace BlackMisc
|
||||
//! Notification directory
|
||||
const QString &getNotificationSoundDirectory() const { return m_notificationSoundDir; }
|
||||
|
||||
//! Set volume
|
||||
//! Set volume (notifications)
|
||||
void setNotificationVolume(int volume);
|
||||
|
||||
//! Get volume
|
||||
//! Get volume (notifications)
|
||||
int getNotificationVolume() const { return m_notificationVolume; }
|
||||
|
||||
//! Set volume (audio)
|
||||
void setAudioVolume(int volume);
|
||||
|
||||
//! Get volume (audio)
|
||||
int getAudioVolume() const { return m_audioVolume; }
|
||||
|
||||
//! Init with meaningful default values
|
||||
void initDefaultValues();
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
static constexpr int MaxAudioVolume = 300; //!< Max.audio volume 0..300
|
||||
|
||||
private:
|
||||
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_notificationVolume = 90; //!< 0-100;
|
||||
int m_notificationVolume = 90; //!< 0-100
|
||||
int m_audioVolume = 100; //!< 0-300
|
||||
void initNotificationFlags(); //!< init flags
|
||||
|
||||
BLACK_METACLASS(
|
||||
CSettings,
|
||||
BLACK_METAMEMBER(notificationSoundDir),
|
||||
BLACK_METAMEMBER(notification),
|
||||
BLACK_METAMEMBER(notificationVolume)
|
||||
BLACK_METAMEMBER(notificationVolume),
|
||||
BLACK_METAMEMBER(audioVolume)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user