Convert m_snapTurnAngle to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 065c5da456
commit 22b52d403c
2 changed files with 9 additions and 17 deletions
+9 -16
View File
@@ -44,8 +44,6 @@ void MoveCenterTabController::initStage1()
m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting(
settings::IntSetting::PLAYSPACE_turnComfortFactor ) );
m_snapTurnAngle
= settings::getSetting( settings::IntSetting::PLAYSPACE_snapTurnAngle );
m_smoothTurnRate = settings::getSetting(
settings::IntSetting::PLAYSPACE_smoothTurnRate );
@@ -460,23 +458,18 @@ void MoveCenterTabController::setTempRotation( int value, bool notify )
int MoveCenterTabController::snapTurnAngle() const
{
return m_snapTurnAngle;
return settings::getSetting(
settings::IntSetting::PLAYSPACE_snapTurnAngle );
}
void MoveCenterTabController::setSnapTurnAngle( int value, bool notify )
{
if ( m_snapTurnAngle != value )
settings::setSetting( settings::IntSetting::PLAYSPACE_snapTurnAngle,
value );
if ( notify )
{
m_snapTurnAngle = value;
auto settings = OverlayController::appSettings();
settings->beginGroup( "playspaceSettings" );
settings->setValue( "snapTurnAngle", m_snapTurnAngle );
settings->endGroup();
settings->sync();
if ( notify )
{
emit snapTurnAngleChanged( m_snapTurnAngle );
}
emit snapTurnAngleChanged( value );
}
}
@@ -2010,7 +2003,7 @@ void MoveCenterTabController::snapTurnLeft( bool snapTurnLeftJustPressed )
return;
}
int newRotationAngleDeg = m_rotation - m_snapTurnAngle;
int newRotationAngleDeg = m_rotation - snapTurnAngle();
// Keep angle within -18000 ~ 18000 centidegrees
if ( newRotationAngleDeg > 18000 )
{
@@ -2031,7 +2024,7 @@ void MoveCenterTabController::snapTurnRight( bool snapTurnRightJustPressed )
return;
}
int newRotationAngleDeg = m_rotation + m_snapTurnAngle;
int newRotationAngleDeg = m_rotation + snapTurnAngle();
// Keep angle within -18000 ~ 18000 centidegrees
if ( newRotationAngleDeg > 18000 )
{
@@ -119,7 +119,6 @@ private:
int m_rotation = 0;
int m_oldRotation = 0;
int m_tempRotation = 0;
int m_snapTurnAngle = 4500;
int m_smoothTurnRate = 100;
bool m_moveShortcutRightPressed = false;
bool m_moveShortcutLeftPressed = false;