Convert m_settingsRightHandDragEnabled to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 289de29d69
commit a81eb2cbf4
2 changed files with 11 additions and 20 deletions
+11 -19
View File
@@ -39,8 +39,6 @@ namespace advsettings
{ {
void MoveCenterTabController::initStage1() void MoveCenterTabController::initStage1()
{ {
m_settingsRightHandDragEnabled = settings::getSetting(
settings::BoolSetting::PLAYSPACE_moveShortcutRight );
m_settingsLeftHandDragEnabled = settings::getSetting( m_settingsLeftHandDragEnabled = settings::getSetting(
settings::BoolSetting::PLAYSPACE_moveShortcutLeft ); settings::BoolSetting::PLAYSPACE_moveShortcutLeft );
m_settingsLeftHandTurnEnabled m_settingsLeftHandTurnEnabled
@@ -220,10 +218,6 @@ void MoveCenterTabController::deleteOffsetProfile( unsigned index )
void MoveCenterTabController::outputLogSettings() void MoveCenterTabController::outputLogSettings()
{ {
if ( m_settingsRightHandDragEnabled )
{
LOG( INFO ) << "LOADED SETTINGS: Right Hand Space-Drag Bind Enabled";
}
if ( m_settingsLeftHandDragEnabled ) if ( m_settingsLeftHandDragEnabled )
{ {
LOG( INFO ) << "LOADED SETTINGS: Left Hand Space-Drag Bind Enabled"; LOG( INFO ) << "LOADED SETTINGS: Left Hand Space-Drag Bind Enabled";
@@ -608,23 +602,18 @@ void MoveCenterTabController::setAdjustChaperone( bool value, bool notify )
bool MoveCenterTabController::moveShortcutRight() const bool MoveCenterTabController::moveShortcutRight() const
{ {
return m_settingsRightHandDragEnabled; return settings::getSetting(
settings::BoolSetting::PLAYSPACE_moveShortcutRight );
} }
void MoveCenterTabController::setMoveShortcutRight( bool value, bool notify ) void MoveCenterTabController::setMoveShortcutRight( bool value, bool notify )
{ {
m_settingsRightHandDragEnabled = value; settings::setSetting( settings::BoolSetting::PLAYSPACE_moveShortcutRight,
auto settings = OverlayController::appSettings(); value );
settings->beginGroup( "playspaceSettings" );
settings->setValue( "moveShortcutRight", m_settingsRightHandDragEnabled );
settings->endGroup();
settings->sync();
if ( notify ) if ( notify )
{ {
emit moveShortcutRightChanged( m_settingsRightHandDragEnabled ); emit moveShortcutRightChanged( value );
} }
LOG( INFO ) << "CHANGED SETTINGS: Right Hand Space-Drag Bind Enable Set: "
<< m_settingsRightHandDragEnabled;
} }
bool MoveCenterTabController::moveShortcutLeft() const bool MoveCenterTabController::moveShortcutLeft() const
@@ -1599,7 +1588,8 @@ void MoveCenterTabController::leftHandSpaceDrag( bool leftHandDragActive )
void MoveCenterTabController::rightHandSpaceDrag( bool rightHandDragActive ) void MoveCenterTabController::rightHandSpaceDrag( bool rightHandDragActive )
{ {
if ( !m_settingsRightHandDragEnabled ) if ( !settings::getSetting(
settings::BoolSetting::PLAYSPACE_moveShortcutRight ) )
{ {
return; return;
} }
@@ -1705,7 +1695,8 @@ void MoveCenterTabController::optionalOverrideLeftHandSpaceDrag(
void MoveCenterTabController::optionalOverrideRightHandSpaceDrag( void MoveCenterTabController::optionalOverrideRightHandSpaceDrag(
bool overrideRightHandDragActive ) bool overrideRightHandDragActive )
{ {
if ( !m_settingsRightHandDragEnabled ) if ( !settings::getSetting(
settings::BoolSetting::PLAYSPACE_moveShortcutRight ) )
{ {
return; return;
} }
@@ -1835,7 +1826,8 @@ void MoveCenterTabController::swapSpaceDragToLeftHandOverride(
void MoveCenterTabController::swapSpaceDragToRightHandOverride( void MoveCenterTabController::swapSpaceDragToRightHandOverride(
bool swapDragToRightHand ) bool swapDragToRightHand )
{ {
if ( !m_settingsRightHandDragEnabled ) if ( !settings::getSetting(
settings::BoolSetting::PLAYSPACE_moveShortcutRight ) )
{ {
return; return;
} }
@@ -125,7 +125,6 @@ private:
bool m_moveShortcutLeftPressed = false; bool m_moveShortcutLeftPressed = false;
vr::TrackedDeviceIndex_t m_activeMoveController; vr::TrackedDeviceIndex_t m_activeMoveController;
float m_lastControllerPosition[3]; float m_lastControllerPosition[3];
bool m_settingsRightHandDragEnabled = false;
bool m_settingsLeftHandDragEnabled = false; bool m_settingsLeftHandDragEnabled = false;
bool m_settingsLeftHandTurnEnabled = false; bool m_settingsLeftHandTurnEnabled = false;
bool m_settingsRightHandTurnEnabled = false; bool m_settingsRightHandTurnEnabled = false;