Convert m_micReversePtt to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent c96b531ee1
commit a014de8368
2 changed files with 16 additions and 18 deletions
+16 -17
View File
@@ -145,7 +145,7 @@ bool AudioTabController::micProximitySensorCanMute() const
bool AudioTabController::micReversePtt() const bool AudioTabController::micReversePtt() const
{ {
return m_micReversePtt; return settings::getSetting( settings::BoolSetting::AUDIO_micReversePtt );
} }
bool AudioTabController::audioProfileDefault() const bool AudioTabController::audioProfileDefault() const
@@ -211,7 +211,7 @@ bool AudioTabController::pttChangeValid()
void AudioTabController::onPttStart() void AudioTabController::onPttStart()
{ {
if ( m_micReversePtt ) if ( micReversePtt() )
{ {
setMicMuted( true ); setMicMuted( true );
} }
@@ -223,7 +223,7 @@ void AudioTabController::onPttStart()
void AudioTabController::onPttEnabled() void AudioTabController::onPttEnabled()
{ {
if ( m_micReversePtt ) if ( micReversePtt() )
{ {
setMicMuted( false ); setMicMuted( false );
} }
@@ -235,7 +235,7 @@ void AudioTabController::onPttEnabled()
void AudioTabController::onPttStop() void AudioTabController::onPttStop()
{ {
if ( m_micReversePtt ) if ( micReversePtt() )
{ {
setMicMuted( false ); setMicMuted( false );
} }
@@ -335,25 +335,24 @@ void AudioTabController::setMicProximitySensorCanMute( bool value, bool notify )
void AudioTabController::setMicReversePtt( bool value, bool notify ) void AudioTabController::setMicReversePtt( bool value, bool notify )
{ {
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex ); std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
if ( value != m_micReversePtt )
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
if ( m_pttEnabled )
{ {
m_micReversePtt = value; if ( m_pttActive )
if ( m_pttEnabled )
{ {
if ( m_pttActive ) setMicMuted( value );
{
setMicMuted( value );
}
else
{
setMicMuted( !value );
}
} }
if ( notify ) else
{ {
emit micReversePttChanged( value ); setMicMuted( !value );
} }
} }
if ( notify )
{
emit micReversePttChanged( value );
}
} }
void AudioTabController::setAudioProfileDefault( bool value, bool notify ) void AudioTabController::setAudioProfileDefault( bool value, bool notify )
-1
View File
@@ -71,7 +71,6 @@ private:
int m_recordingDeviceIndex = -1; int m_recordingDeviceIndex = -1;
float m_micVolume = 1.0; float m_micVolume = 1.0;
bool m_micMuted = false; bool m_micMuted = false;
bool m_micReversePtt = false;
bool m_isDefaultAudioProfile = false; bool m_isDefaultAudioProfile = false;
bool m_isPlaybackOverride = false; bool m_isPlaybackOverride = false;
bool m_isRecordingOverride = false; bool m_isRecordingOverride = false;