Convert m_dragBounds to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 89699825bf
commit ba30e0054f
2 changed files with 8 additions and 16 deletions
+8 -15
View File
@@ -39,8 +39,6 @@ namespace advsettings
{ {
void MoveCenterTabController::initStage1() void MoveCenterTabController::initStage1()
{ {
m_dragBounds
= settings::getSetting( settings::BoolSetting::PLAYSPACE_dragBounds );
m_turnBounds m_turnBounds
= settings::getSetting( settings::BoolSetting::PLAYSPACE_turnBounds ); = settings::getSetting( settings::BoolSetting::PLAYSPACE_turnBounds );
@@ -607,30 +605,25 @@ void MoveCenterTabController::setTurnBindRight( bool value, bool notify )
bool MoveCenterTabController::dragBounds() const bool MoveCenterTabController::dragBounds() const
{ {
return m_dragBounds; return settings::getSetting( settings::BoolSetting::PLAYSPACE_dragBounds );
} }
void MoveCenterTabController::setDragBounds( bool value, bool notify ) void MoveCenterTabController::setDragBounds( bool value, bool notify )
{ {
// detect deactivate // detect deactivate
if ( m_dragBounds && !value ) if ( dragBounds() && !value )
{ {
// set force bounds back to default on deactivate // set force bounds back to default on deactivate
vr::VRChaperone()->ForceBoundsVisible( vr::VRChaperone()->ForceBoundsVisible(
parent->m_chaperoneTabController.forceBounds() ); parent->m_chaperoneTabController.forceBounds() );
} }
m_dragBounds = value;
auto settings = OverlayController::appSettings(); settings::setSetting( settings::BoolSetting::PLAYSPACE_dragBounds, value );
settings->beginGroup( "playspaceSettings" );
settings->setValue( "dragBounds", m_dragBounds );
settings->endGroup();
settings->sync();
if ( notify ) if ( notify )
{ {
emit dragBoundsChanged( m_dragBounds ); emit dragBoundsChanged( value );
} }
LOG( INFO ) << "CHANGED SETTINGS: Space Drag Force Bounds set: "
<< m_dragBounds;
} }
bool MoveCenterTabController::turnBounds() const bool MoveCenterTabController::turnBounds() const
@@ -2982,7 +2975,7 @@ void MoveCenterTabController::eventLoopTick(
} }
// force chaperone bounds visible if turn or drag settings require // force chaperone bounds visible if turn or drag settings require
if ( m_dragBounds if ( dragBounds()
&& m_activeDragHand != vr::TrackedControllerRole_Invalid ) && m_activeDragHand != vr::TrackedControllerRole_Invalid )
{ {
vr::VRChaperone()->ForceBoundsVisible( true ); vr::VRChaperone()->ForceBoundsVisible( true );
@@ -2993,7 +2986,7 @@ void MoveCenterTabController::eventLoopTick(
vr::VRChaperone()->ForceBoundsVisible( true ); vr::VRChaperone()->ForceBoundsVisible( true );
} }
// only set back to default every frame if setting is enabled // only set back to default every frame if setting is enabled
else if ( m_turnBounds || m_dragBounds ) else if ( m_turnBounds || dragBounds() )
{ {
vr::VRChaperone()->ForceBoundsVisible( vr::VRChaperone()->ForceBoundsVisible(
parent->m_chaperoneTabController.forceBounds() ); parent->m_chaperoneTabController.forceBounds() );
@@ -127,7 +127,6 @@ private:
float m_lastControllerPosition[3]; float m_lastControllerPosition[3];
unsigned m_dragComfortFactor = 0; unsigned m_dragComfortFactor = 0;
unsigned m_turnComfortFactor = 0; unsigned m_turnComfortFactor = 0;
bool m_dragBounds = false;
bool m_turnBounds = false; bool m_turnBounds = false;
bool m_heightToggle = false; bool m_heightToggle = false;
float m_heightToggleOffset = -1.0f; float m_heightToggleOffset = -1.0f;