Convert m_pttShowNotification to new settings API
This commit is contained in:
@@ -288,6 +288,10 @@ private:
|
|||||||
SettingCategory::Audio,
|
SettingCategory::Audio,
|
||||||
QtInfo{ "pttEnabled" },
|
QtInfo{ "pttEnabled" },
|
||||||
false },
|
false },
|
||||||
|
BoolSettingValue{ BoolSetting::AUDIO_pttShowNotification,
|
||||||
|
SettingCategory::Audio,
|
||||||
|
QtInfo{ "pttShowNotification" },
|
||||||
|
false },
|
||||||
BoolSettingValue{ BoolSetting::AUDIO_micProximitySensorCanMute,
|
BoolSettingValue{ BoolSetting::AUDIO_micProximitySensorCanMute,
|
||||||
SettingCategory::Audio,
|
SettingCategory::Audio,
|
||||||
QtInfo{ "micProximitySensorCanMute" },
|
QtInfo{ "micProximitySensorCanMute" },
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ enum class BoolSetting
|
|||||||
APPLICATION_enableDebug,
|
APPLICATION_enableDebug,
|
||||||
|
|
||||||
AUDIO_pttEnabled,
|
AUDIO_pttEnabled,
|
||||||
|
AUDIO_pttShowNotification,
|
||||||
AUDIO_micProximitySensorCanMute,
|
AUDIO_micProximitySensorCanMute,
|
||||||
AUDIO_micReversePtt,
|
AUDIO_micReversePtt,
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ void AudioTabController::initStage1()
|
|||||||
findMicDeviceIndex( audioManager->getMicDevId(), false );
|
findMicDeviceIndex( audioManager->getMicDevId(), false );
|
||||||
m_micVolume = audioManager->getMicVolume();
|
m_micVolume = audioManager->getMicVolume();
|
||||||
m_micMuted = audioManager->getMicMuted();
|
m_micMuted = audioManager->getMicMuted();
|
||||||
reloadPttConfig();
|
|
||||||
// Temporarily disabled audio profiles for 1.8.19 until api is clear.
|
// Temporarily disabled audio profiles for 1.8.19 until api is clear.
|
||||||
// reloadAudioProfiles();
|
// reloadAudioProfiles();
|
||||||
reloadAudioSettings();
|
reloadAudioSettings();
|
||||||
@@ -1328,32 +1327,15 @@ bool AudioTabController::pttActive() const
|
|||||||
|
|
||||||
bool AudioTabController::pttShowNotification() const
|
bool AudioTabController::pttShowNotification() const
|
||||||
{
|
{
|
||||||
return m_pttShowNotification;
|
return settings::getSetting(
|
||||||
}
|
settings::BoolSetting::AUDIO_pttShowNotification );
|
||||||
|
|
||||||
void AudioTabController::reloadPttConfig()
|
|
||||||
{
|
|
||||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
|
||||||
auto settings = OverlayController::appSettings();
|
|
||||||
settings->beginGroup( getSettingsName() );
|
|
||||||
setPttShowNotification(
|
|
||||||
settings->value( "pttShowNotification", true ).toBool(), true, false );
|
|
||||||
settings->endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioTabController::savePttConfig()
|
|
||||||
{
|
|
||||||
auto settings = OverlayController::appSettings();
|
|
||||||
settings->beginGroup( getSettingsName() );
|
|
||||||
settings->setValue( "pttShowNotification", pttShowNotification() );
|
|
||||||
settings->endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioTabController::startPtt()
|
void AudioTabController::startPtt()
|
||||||
{
|
{
|
||||||
m_pttActive = true;
|
m_pttActive = true;
|
||||||
onPttStart();
|
onPttStart();
|
||||||
if ( m_pttShowNotification
|
if ( pttShowNotification()
|
||||||
&& getNotificationOverlayHandle() != vr::k_ulOverlayHandleInvalid )
|
&& getNotificationOverlayHandle() != vr::k_ulOverlayHandleInvalid )
|
||||||
{
|
{
|
||||||
vr::VROverlay()->ShowOverlay( getNotificationOverlayHandle() );
|
vr::VROverlay()->ShowOverlay( getNotificationOverlayHandle() );
|
||||||
@@ -1365,7 +1347,7 @@ void AudioTabController::stopPtt()
|
|||||||
{
|
{
|
||||||
m_pttActive = false;
|
m_pttActive = false;
|
||||||
onPttStop();
|
onPttStop();
|
||||||
if ( m_pttShowNotification
|
if ( pttShowNotification()
|
||||||
&& getNotificationOverlayHandle() != vr::k_ulOverlayHandleInvalid )
|
&& getNotificationOverlayHandle() != vr::k_ulOverlayHandleInvalid )
|
||||||
{
|
{
|
||||||
vr::VROverlay()->HideOverlay( getNotificationOverlayHandle() );
|
vr::VROverlay()->HideOverlay( getNotificationOverlayHandle() );
|
||||||
@@ -1373,7 +1355,7 @@ void AudioTabController::stopPtt()
|
|||||||
emit pttActiveChanged( m_pttActive );
|
emit pttActiveChanged( m_pttActive );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioTabController::setPttEnabled( bool value, bool notify, bool save )
|
void AudioTabController::setPttEnabled( bool value, bool notify )
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||||
|
|
||||||
@@ -1392,29 +1374,18 @@ void AudioTabController::setPttEnabled( bool value, bool notify, bool save )
|
|||||||
{
|
{
|
||||||
emit pttEnabledChanged( value );
|
emit pttEnabledChanged( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( save )
|
|
||||||
{
|
|
||||||
savePttConfig();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioTabController::setPttShowNotification( bool value,
|
void AudioTabController::setPttShowNotification( bool value, bool notify )
|
||||||
bool notify,
|
|
||||||
bool save )
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||||
if ( value != m_pttShowNotification )
|
|
||||||
|
settings::setSetting( settings::BoolSetting::AUDIO_pttShowNotification,
|
||||||
|
value );
|
||||||
|
|
||||||
|
if ( notify )
|
||||||
{
|
{
|
||||||
m_pttShowNotification = value;
|
emit pttShowNotificationChanged( value );
|
||||||
if ( notify )
|
|
||||||
{
|
|
||||||
emit pttShowNotificationChanged( value );
|
|
||||||
}
|
|
||||||
if ( save )
|
|
||||||
{
|
|
||||||
savePttConfig();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ private:
|
|||||||
unsigned settingsUpdateCounter = 0;
|
unsigned settingsUpdateCounter = 0;
|
||||||
|
|
||||||
bool m_pttActive = false;
|
bool m_pttActive = false;
|
||||||
bool m_pttShowNotification = false;
|
|
||||||
|
|
||||||
std::unique_ptr<AudioManager> audioManager;
|
std::unique_ptr<AudioManager> audioManager;
|
||||||
std::vector<std::pair<std::string, std::string>> m_recordingDevices;
|
std::vector<std::pair<std::string, std::string>> m_recordingDevices;
|
||||||
@@ -185,9 +184,6 @@ public:
|
|||||||
void startPtt();
|
void startPtt();
|
||||||
void stopPtt();
|
void stopPtt();
|
||||||
|
|
||||||
void reloadPttConfig();
|
|
||||||
void savePttConfig();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setMirrorVolume( float value, bool notify = true );
|
void setMirrorVolume( float value, bool notify = true );
|
||||||
void setMirrorMuted( bool value, bool notify = true );
|
void setMirrorMuted( bool value, bool notify = true );
|
||||||
@@ -210,10 +206,8 @@ public slots:
|
|||||||
|
|
||||||
void setAudioProfileDefault( bool value, bool notify = true );
|
void setAudioProfileDefault( bool value, bool notify = true );
|
||||||
|
|
||||||
void setPttEnabled( bool value, bool notify = true, bool save = true );
|
void setPttEnabled( bool value, bool notify = true );
|
||||||
void setPttShowNotification( bool value,
|
void setPttShowNotification( bool value, bool notify = true );
|
||||||
bool notify = true,
|
|
||||||
bool save = true );
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playbackDeviceIndexChanged( int index );
|
void playbackDeviceIndexChanged( int index );
|
||||||
|
|||||||
Reference in New Issue
Block a user