Convert m_brightnessValue to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 0710432933
commit a13b901b88
2 changed files with 7 additions and 7 deletions
+7 -6
View File
@@ -224,7 +224,6 @@ void VideoTabController::reloadVideoConfig()
settings->beginGroup( getSettingsName() ); settings->beginGroup( getSettingsName() );
setBrightnessEnabled( setBrightnessEnabled(
settings->value( "brightnessEnabled", false ).toBool(), true ); settings->value( "brightnessEnabled", false ).toBool(), true );
m_brightnessValue = settings->value( "brightnessValue", 1.0f ).toFloat();
setColorOverlayEnabled( setColorOverlayEnabled(
settings->value( "colorOverlayEnabled", false ).toBool(), true ); settings->value( "colorOverlayEnabled", false ).toBool(), true );
setColorOverlayOpacity( setColorOverlayOpacity(
@@ -246,7 +245,6 @@ void VideoTabController::saveVideoConfig()
auto settings = OverlayController::appSettings(); auto settings = OverlayController::appSettings();
settings->beginGroup( getSettingsName() ); settings->beginGroup( getSettingsName() );
settings->setValue( "brightnessEnabled", brightnessEnabled() ); settings->setValue( "brightnessEnabled", brightnessEnabled() );
settings->setValue( "brightnessValue", brightnessValue() );
settings->setValue( "colorOverlayEnabled", colorOverlayEnabled() ); settings->setValue( "colorOverlayEnabled", colorOverlayEnabled() );
settings->setValue( "colorOverlayOpacity", colorOverlayOpacity() ); settings->setValue( "colorOverlayOpacity", colorOverlayOpacity() );
settings->setValue( "colorRedNew", colorRed() ); settings->setValue( "colorRedNew", colorRed() );
@@ -266,7 +264,8 @@ float VideoTabController::brightnessOpacityValue() const
float VideoTabController::brightnessValue() const float VideoTabController::brightnessValue() const
{ {
return m_brightnessValue; return static_cast<float>( settings::getSetting(
settings::DoubleSetting::VIDEO_brightnessValue ) );
} }
bool VideoTabController::brightnessEnabled() const bool VideoTabController::brightnessEnabled() const
@@ -319,7 +318,9 @@ void VideoTabController::setBrightnessValue( float percvalue, bool notify )
if ( fabs( static_cast<double>( realvalue - brightnessOpacityValue() ) ) if ( fabs( static_cast<double>( realvalue - brightnessOpacityValue() ) )
> .005 ) > .005 )
{ {
m_brightnessValue = percvalue; settings::setSetting( settings::DoubleSetting::VIDEO_brightnessValue,
static_cast<double>( percvalue ) );
if ( realvalue <= 1.0f && realvalue >= 0.0f ) if ( realvalue <= 1.0f && realvalue >= 0.0f )
{ {
settings::setSetting( settings::setSetting(
@@ -361,7 +362,7 @@ void VideoTabController::setBrightnessOpacityValue()
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( << vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError ); overlayError );
} }
emit brightnessValueChanged( m_brightnessValue ); emit brightnessValueChanged( brightnessValue() );
} }
/* /*
@@ -874,7 +875,7 @@ void VideoTabController::addVideoProfile( const QString name )
profile->colorGreen = m_colorGreen; profile->colorGreen = m_colorGreen;
profile->colorBlue = m_colorBlue; profile->colorBlue = m_colorBlue;
profile->brightnessToggle = m_brightnessEnabled; profile->brightnessToggle = m_brightnessEnabled;
profile->brightnessValue = m_brightnessValue; profile->brightnessValue = brightnessValue();
profile->opacity = m_colorOverlayOpacity; profile->opacity = m_colorOverlayOpacity;
profile->overlayMethodState = m_isOverlayMethodActive; profile->overlayMethodState = m_isOverlayMethodActive;
-1
View File
@@ -82,7 +82,6 @@ private:
vr::VROverlayHandle_t m_colorOverlayHandle = vr::k_ulOverlayHandleInvalid; vr::VROverlayHandle_t m_colorOverlayHandle = vr::k_ulOverlayHandleInvalid;
float m_brightnessValue = 1.0f;
bool m_brightnessEnabled = false; bool m_brightnessEnabled = false;
float m_colorRed = 0.0f; float m_colorRed = 0.0f;