Convert m_pttEnabled to new settings API

This commit is contained in:
Vasily
2020-01-16 00:09:09 +01:00
committed by username223
parent 7be55a2199
commit d873e024ca
4 changed files with 26 additions and 24 deletions
+21 -23
View File
@@ -336,7 +336,7 @@ void AudioTabController::setMicReversePtt( bool value, bool notify )
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
if ( m_pttEnabled )
if ( pttEnabled() )
{
if ( m_pttActive )
{
@@ -1318,7 +1318,7 @@ void AudioTabController::shutdown()
bool AudioTabController::pttEnabled() const
{
return m_pttEnabled;
return settings::getSetting( settings::BoolSetting::AUDIO_pttEnabled );
}
bool AudioTabController::pttActive() const
@@ -1336,8 +1336,6 @@ void AudioTabController::reloadPttConfig()
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
auto settings = OverlayController::appSettings();
settings->beginGroup( getSettingsName() );
setPttEnabled(
settings->value( "pttEnabled", false ).toBool(), true, false );
setPttShowNotification(
settings->value( "pttShowNotification", true ).toBool(), true, false );
settings->endGroup();
@@ -1347,7 +1345,6 @@ void AudioTabController::savePttConfig()
{
auto settings = OverlayController::appSettings();
settings->beginGroup( getSettingsName() );
settings->setValue( "pttEnabled", pttEnabled() );
settings->setValue( "pttShowNotification", pttShowNotification() );
settings->endGroup();
}
@@ -1379,25 +1376,26 @@ void AudioTabController::stopPtt()
void AudioTabController::setPttEnabled( bool value, bool notify, bool save )
{
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
if ( value != m_pttEnabled )
settings::setSetting( settings::BoolSetting::AUDIO_pttEnabled, value );
if ( value )
{
m_pttEnabled = value;
if ( value )
{
onPttEnabled();
}
else
{
onPttDisabled();
}
if ( notify )
{
emit pttEnabledChanged( value );
}
if ( save )
{
savePttConfig();
}
onPttEnabled();
}
else
{
onPttDisabled();
}
if ( notify )
{
emit pttEnabledChanged( value );
}
if ( save )
{
savePttConfig();
}
}
-1
View File
@@ -87,7 +87,6 @@ private:
unsigned settingsUpdateCounter = 0;
bool m_pttEnabled = false;
bool m_pttActive = false;
bool m_pttShowNotification = false;