Convert m_oldStyleMotion to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 48209f6536
commit 24e3081533
2 changed files with 8 additions and 15 deletions
+8 -14
View File
@@ -56,8 +56,6 @@ void MoveCenterTabController::initStage1()
m_flingStrength = static_cast<float>( settings::getSetting( m_flingStrength = static_cast<float>( settings::getSetting(
settings::DoubleSetting::PLAYSPACE_flingStrength ) ); settings::DoubleSetting::PLAYSPACE_flingStrength ) );
m_oldStyleMotion = settings::getSetting(
settings::BoolSetting::PLAYSPACE_oldStyleMotion );
m_universeCenteredRotation = settings::getSetting( m_universeCenteredRotation = settings::getSetting(
settings::BoolSetting::PLAYSPACE_universeCenteredRotation ); settings::BoolSetting::PLAYSPACE_universeCenteredRotation );
m_enableSeatedMotion = settings::getSetting( m_enableSeatedMotion = settings::getSetting(
@@ -905,29 +903,25 @@ void MoveCenterTabController::setAllowExternalEdits( bool value, bool notify )
bool MoveCenterTabController::oldStyleMotion() const bool MoveCenterTabController::oldStyleMotion() const
{ {
return m_oldStyleMotion; return settings::getSetting(
settings::BoolSetting::PLAYSPACE_oldStyleMotion );
} }
void MoveCenterTabController::setOldStyleMotion( bool value, bool notify ) void MoveCenterTabController::setOldStyleMotion( bool value, bool notify )
{ {
// detect incoming change to old style, and hide working set // detect incoming change to old style, and hide working set
if ( value && !m_oldStyleMotion ) if ( value && !oldStyleMotion() )
{ {
vr::VRChaperoneSetup()->HideWorkingSetPreview(); vr::VRChaperoneSetup()->HideWorkingSetPreview();
} }
m_oldStyleMotion = value; settings::setSetting( settings::BoolSetting::PLAYSPACE_oldStyleMotion,
auto settings = OverlayController::appSettings(); value );
settings->beginGroup( "playspaceSettings" );
settings->setValue( "oldStyleMotion", m_oldStyleMotion );
settings->endGroup();
settings->sync();
if ( notify ) if ( notify )
{ {
emit oldStyleMotionChanged( m_oldStyleMotion ); emit oldStyleMotionChanged( value );
} }
LOG( INFO ) << "CHANGED SETTINGS: Old-Style Motion Set: "
<< m_oldStyleMotion;
} }
bool MoveCenterTabController::universeCenteredRotation() const bool MoveCenterTabController::universeCenteredRotation() const
@@ -2774,7 +2768,7 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose( vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(
&offsetUniverseCenter ); &offsetUniverseCenter );
if ( m_oldStyleMotion ) if ( oldStyleMotion() )
{ {
// check if universe center is outside of OpenVR commit bounds (1km) // check if universe center is outside of OpenVR commit bounds (1km)
if ( abs( offsetUniverseCenterXyz[0] ) > k_maxOpenvrCommitOffset ) if ( abs( offsetUniverseCenterXyz[0] ) > k_maxOpenvrCommitOffset )
@@ -170,7 +170,6 @@ private:
bool m_dashWasOpenPreviousFrame = false; bool m_dashWasOpenPreviousFrame = false;
bool m_roomSetupModeDetected = false; bool m_roomSetupModeDetected = false;
bool m_seatedModeDetected = false; bool m_seatedModeDetected = false;
bool m_oldStyleMotion = false;
bool m_universeCenteredRotation = false; bool m_universeCenteredRotation = false;
bool m_enableSeatedMotion = false; bool m_enableSeatedMotion = false;
bool m_simpleRecenter = false; bool m_simpleRecenter = false;