Convert m_chaperoneAlarmSoundDistance to new settings API
This commit is contained in:
@@ -374,7 +374,7 @@ private:
|
|||||||
0.5 },
|
0.5 },
|
||||||
DoubleSettingValue{ DoubleSetting::CHAPERONE_alarmSoundDistance,
|
DoubleSettingValue{ DoubleSetting::CHAPERONE_alarmSoundDistance,
|
||||||
SettingCategory::Video,
|
SettingCategory::Video,
|
||||||
QtInfo{ "alarmSoundDistance" },
|
QtInfo{ "chaperoneAlarmSoundDistance" },
|
||||||
0.5 },
|
0.5 },
|
||||||
DoubleSettingValue{ DoubleSetting::CHAPERONE_showDashboardDistance,
|
DoubleSettingValue{ DoubleSetting::CHAPERONE_showDashboardDistance,
|
||||||
SettingCategory::Video,
|
SettingCategory::Video,
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ void ChaperoneTabController::initStage1()
|
|||||||
{
|
{
|
||||||
auto settings = OverlayController::appSettings();
|
auto settings = OverlayController::appSettings();
|
||||||
settings->beginGroup( "chaperoneSettings" );
|
settings->beginGroup( "chaperoneSettings" );
|
||||||
m_chaperoneAlarmSoundDistance
|
|
||||||
= settings->value( "chaperoneAlarmSoundDistance", 0.5f ).toFloat();
|
|
||||||
m_chaperoneShowDashboardDistance
|
m_chaperoneShowDashboardDistance
|
||||||
= settings->value( "chaperoneShowDashboardDistance", 0.5f ).toFloat();
|
= settings->value( "chaperoneShowDashboardDistance", 0.5f ).toFloat();
|
||||||
m_fadeDistanceRemembered
|
m_fadeDistanceRemembered
|
||||||
@@ -482,7 +480,7 @@ void ChaperoneTabController::handleChaperoneWarnings( float distance )
|
|||||||
if ( isChaperoneAlarmSoundEnabled() )
|
if ( isChaperoneAlarmSoundEnabled() )
|
||||||
{
|
{
|
||||||
// LOG(WARNING) << "In alarm";
|
// LOG(WARNING) << "In alarm";
|
||||||
float activationDistance = m_chaperoneAlarmSoundDistance;
|
float activationDistance = chaperoneAlarmSoundDistance();
|
||||||
|
|
||||||
if ( distance <= activationDistance && proxSensorOverrideState )
|
if ( distance <= activationDistance && proxSensorOverrideState )
|
||||||
{
|
{
|
||||||
@@ -875,7 +873,8 @@ bool ChaperoneTabController::disableChaperone() const
|
|||||||
|
|
||||||
float ChaperoneTabController::chaperoneAlarmSoundDistance() const
|
float ChaperoneTabController::chaperoneAlarmSoundDistance() const
|
||||||
{
|
{
|
||||||
return m_chaperoneAlarmSoundDistance;
|
return static_cast<float>( settings::getSetting(
|
||||||
|
settings::DoubleSetting::CHAPERONE_alarmSoundDistance ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChaperoneTabController::isChaperoneShowDashboardEnabled() const
|
bool ChaperoneTabController::isChaperoneShowDashboardEnabled() const
|
||||||
@@ -1085,20 +1084,16 @@ void ChaperoneTabController::setChaperoneAlarmSoundAdjustVolume( bool value,
|
|||||||
void ChaperoneTabController::setChaperoneAlarmSoundDistance( float value,
|
void ChaperoneTabController::setChaperoneAlarmSoundDistance( float value,
|
||||||
bool notify )
|
bool notify )
|
||||||
{
|
{
|
||||||
if ( fabs( static_cast<double>( m_chaperoneAlarmSoundDistance - value ) )
|
if ( fabs( static_cast<double>( chaperoneAlarmSoundDistance() - value ) )
|
||||||
> 0.005 )
|
> 0.005 )
|
||||||
{
|
{
|
||||||
m_chaperoneAlarmSoundDistance = value;
|
settings::setSetting(
|
||||||
auto settings = OverlayController::appSettings();
|
settings::DoubleSetting::CHAPERONE_alarmSoundDistance,
|
||||||
settings->beginGroup( "chaperoneSettings" );
|
static_cast<double>( value ) );
|
||||||
settings->setValue( "chaperoneAlarmSoundDistance",
|
|
||||||
m_chaperoneAlarmSoundDistance );
|
|
||||||
settings->endGroup();
|
|
||||||
settings->sync();
|
|
||||||
if ( notify )
|
if ( notify )
|
||||||
{
|
{
|
||||||
emit chaperoneAlarmSoundDistanceChanged(
|
emit chaperoneAlarmSoundDistanceChanged( value );
|
||||||
m_chaperoneAlarmSoundDistance );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1351,7 +1346,7 @@ void ChaperoneTabController::addChaperoneProfile(
|
|||||||
profile->chaperoneAlarmSoundLooping = isChaperoneAlarmSoundLooping();
|
profile->chaperoneAlarmSoundLooping = isChaperoneAlarmSoundLooping();
|
||||||
profile->chaperoneAlarmSoundAdjustVolume
|
profile->chaperoneAlarmSoundAdjustVolume
|
||||||
= isChaperoneAlarmSoundAdjustVolume();
|
= isChaperoneAlarmSoundAdjustVolume();
|
||||||
profile->chaperoneAlarmSoundDistance = m_chaperoneAlarmSoundDistance;
|
profile->chaperoneAlarmSoundDistance = chaperoneAlarmSoundDistance();
|
||||||
profile->enableChaperoneShowDashboard
|
profile->enableChaperoneShowDashboard
|
||||||
= isChaperoneShowDashboardEnabled();
|
= isChaperoneShowDashboardEnabled();
|
||||||
profile->chaperoneShowDashboardDistance
|
profile->chaperoneShowDashboardDistance
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ private:
|
|||||||
bool m_chaperoneHapticFeedbackActive = false;
|
bool m_chaperoneHapticFeedbackActive = false;
|
||||||
std::thread m_chaperoneHapticFeedbackThread;
|
std::thread m_chaperoneHapticFeedbackThread;
|
||||||
|
|
||||||
float m_chaperoneAlarmSoundDistance = 0.5f;
|
|
||||||
bool m_chaperoneAlarmSoundActive = false;
|
bool m_chaperoneAlarmSoundActive = false;
|
||||||
|
|
||||||
float m_chaperoneShowDashboardDistance = 0.5f;
|
float m_chaperoneShowDashboardDistance = 0.5f;
|
||||||
|
|||||||
Reference in New Issue
Block a user