Convert m_momentumSave to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 500fe0a98f
commit 363a9f4990
2 changed files with 7 additions and 12 deletions
+7 -11
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_momentumSave
= settings::getSetting( settings::BoolSetting::PLAYSPACE_momentumSave );
m_showLogMatricesButton = settings::getSetting( m_showLogMatricesButton = settings::getSetting(
settings::BoolSetting::PLAYSPACE_showLogMatricesButton ); settings::BoolSetting::PLAYSPACE_showLogMatricesButton );
m_allowExternalEdits = settings::getSetting( m_allowExternalEdits = settings::getSetting(
@@ -798,7 +796,7 @@ void MoveCenterTabController::setGravityActive( bool value, bool notify )
if ( !m_gravityActive && value ) if ( !m_gravityActive && value )
{ {
// zero out velocity if we aren't saving previous momentum // zero out velocity if we aren't saving previous momentum
if ( !m_momentumSave ) if ( !momentumSave() )
{ {
m_velocity[0] = 0.0; m_velocity[0] = 0.0;
m_velocity[1] = 0.0; m_velocity[1] = 0.0;
@@ -817,20 +815,18 @@ void MoveCenterTabController::setGravityActive( bool value, bool notify )
bool MoveCenterTabController::momentumSave() const bool MoveCenterTabController::momentumSave() const
{ {
return m_momentumSave; return settings::getSetting(
settings::BoolSetting::PLAYSPACE_momentumSave );
} }
void MoveCenterTabController::setMomentumSave( bool value, bool notify ) void MoveCenterTabController::setMomentumSave( bool value, bool notify )
{ {
m_momentumSave = value; settings::setSetting( settings::BoolSetting::PLAYSPACE_momentumSave,
auto settings = OverlayController::appSettings(); value );
settings->beginGroup( "playspaceSettings" );
settings->setValue( "momentumSave", m_momentumSave );
settings->endGroup();
settings->sync();
if ( notify ) if ( notify )
{ {
emit momentumSaveChanged( m_momentumSave ); emit momentumSaveChanged( value );
} }
} }
@@ -132,7 +132,6 @@ private:
float m_gravityFloor = 0.0f; float m_gravityFloor = 0.0f;
float m_gravityStrength = 9.8f; float m_gravityStrength = 9.8f;
float m_flingStrength = 1.0f; float m_flingStrength = 1.0f;
bool m_momentumSave = false;
// Set lastHandQuaternion.w to -1000.0 when last hand is invalid. // Set lastHandQuaternion.w to -1000.0 when last hand is invalid.
vr::HmdQuaternion_t m_lastHandQuaternion vr::HmdQuaternion_t m_lastHandQuaternion
= { k_quaternionInvalidValue, 0.0, 0.0, 0.0 }; = { k_quaternionInvalidValue, 0.0, 0.0, 0.0 };