Convert m_pttEnabled to new settings API
This commit is contained in:
@@ -284,6 +284,10 @@ private:
|
|||||||
QtInfo{ "enableDebug" },
|
QtInfo{ "enableDebug" },
|
||||||
false },
|
false },
|
||||||
|
|
||||||
|
BoolSettingValue{ BoolSetting::AUDIO_pttEnabled,
|
||||||
|
SettingCategory::Audio,
|
||||||
|
QtInfo{ "pttEnabled" },
|
||||||
|
false },
|
||||||
BoolSettingValue{ BoolSetting::AUDIO_micProximitySensorCanMute,
|
BoolSettingValue{ BoolSetting::AUDIO_micProximitySensorCanMute,
|
||||||
SettingCategory::Audio,
|
SettingCategory::Audio,
|
||||||
QtInfo{ "micProximitySensorCanMute" },
|
QtInfo{ "micProximitySensorCanMute" },
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ enum class BoolSetting
|
|||||||
APPLICATION_crashRecoveryDisabled,
|
APPLICATION_crashRecoveryDisabled,
|
||||||
APPLICATION_enableDebug,
|
APPLICATION_enableDebug,
|
||||||
|
|
||||||
|
AUDIO_pttEnabled,
|
||||||
AUDIO_micProximitySensorCanMute,
|
AUDIO_micProximitySensorCanMute,
|
||||||
AUDIO_micReversePtt,
|
AUDIO_micReversePtt,
|
||||||
|
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ void AudioTabController::setMicReversePtt( bool value, bool notify )
|
|||||||
|
|
||||||
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
|
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
|
||||||
|
|
||||||
if ( m_pttEnabled )
|
if ( pttEnabled() )
|
||||||
{
|
{
|
||||||
if ( m_pttActive )
|
if ( m_pttActive )
|
||||||
{
|
{
|
||||||
@@ -1318,7 +1318,7 @@ void AudioTabController::shutdown()
|
|||||||
|
|
||||||
bool AudioTabController::pttEnabled() const
|
bool AudioTabController::pttEnabled() const
|
||||||
{
|
{
|
||||||
return m_pttEnabled;
|
return settings::getSetting( settings::BoolSetting::AUDIO_pttEnabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioTabController::pttActive() const
|
bool AudioTabController::pttActive() const
|
||||||
@@ -1336,8 +1336,6 @@ void AudioTabController::reloadPttConfig()
|
|||||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||||
auto settings = OverlayController::appSettings();
|
auto settings = OverlayController::appSettings();
|
||||||
settings->beginGroup( getSettingsName() );
|
settings->beginGroup( getSettingsName() );
|
||||||
setPttEnabled(
|
|
||||||
settings->value( "pttEnabled", false ).toBool(), true, false );
|
|
||||||
setPttShowNotification(
|
setPttShowNotification(
|
||||||
settings->value( "pttShowNotification", true ).toBool(), true, false );
|
settings->value( "pttShowNotification", true ).toBool(), true, false );
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
@@ -1347,7 +1345,6 @@ void AudioTabController::savePttConfig()
|
|||||||
{
|
{
|
||||||
auto settings = OverlayController::appSettings();
|
auto settings = OverlayController::appSettings();
|
||||||
settings->beginGroup( getSettingsName() );
|
settings->beginGroup( getSettingsName() );
|
||||||
settings->setValue( "pttEnabled", pttEnabled() );
|
|
||||||
settings->setValue( "pttShowNotification", pttShowNotification() );
|
settings->setValue( "pttShowNotification", pttShowNotification() );
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
@@ -1379,25 +1376,26 @@ void AudioTabController::stopPtt()
|
|||||||
void AudioTabController::setPttEnabled( bool value, bool notify, bool save )
|
void AudioTabController::setPttEnabled( bool value, bool notify, bool save )
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||||
if ( value != m_pttEnabled )
|
|
||||||
|
settings::setSetting( settings::BoolSetting::AUDIO_pttEnabled, value );
|
||||||
|
|
||||||
|
if ( value )
|
||||||
{
|
{
|
||||||
m_pttEnabled = value;
|
onPttEnabled();
|
||||||
if ( value )
|
}
|
||||||
{
|
else
|
||||||
onPttEnabled();
|
{
|
||||||
}
|
onPttDisabled();
|
||||||
else
|
}
|
||||||
{
|
|
||||||
onPttDisabled();
|
if ( notify )
|
||||||
}
|
{
|
||||||
if ( notify )
|
emit pttEnabledChanged( value );
|
||||||
{
|
}
|
||||||
emit pttEnabledChanged( value );
|
|
||||||
}
|
if ( save )
|
||||||
if ( save )
|
{
|
||||||
{
|
savePttConfig();
|
||||||
savePttConfig();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ private:
|
|||||||
|
|
||||||
unsigned settingsUpdateCounter = 0;
|
unsigned settingsUpdateCounter = 0;
|
||||||
|
|
||||||
bool m_pttEnabled = false;
|
|
||||||
bool m_pttActive = false;
|
bool m_pttActive = false;
|
||||||
bool m_pttShowNotification = false;
|
bool m_pttShowNotification = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user