Convert m_snapTurnAngle to new settings API
This commit is contained in:
@@ -44,8 +44,6 @@ void MoveCenterTabController::initStage1()
|
|||||||
m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting(
|
m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting(
|
||||||
settings::IntSetting::PLAYSPACE_turnComfortFactor ) );
|
settings::IntSetting::PLAYSPACE_turnComfortFactor ) );
|
||||||
|
|
||||||
m_snapTurnAngle
|
|
||||||
= settings::getSetting( settings::IntSetting::PLAYSPACE_snapTurnAngle );
|
|
||||||
m_smoothTurnRate = settings::getSetting(
|
m_smoothTurnRate = settings::getSetting(
|
||||||
settings::IntSetting::PLAYSPACE_smoothTurnRate );
|
settings::IntSetting::PLAYSPACE_smoothTurnRate );
|
||||||
|
|
||||||
@@ -460,23 +458,18 @@ void MoveCenterTabController::setTempRotation( int value, bool notify )
|
|||||||
|
|
||||||
int MoveCenterTabController::snapTurnAngle() const
|
int MoveCenterTabController::snapTurnAngle() const
|
||||||
{
|
{
|
||||||
return m_snapTurnAngle;
|
return settings::getSetting(
|
||||||
|
settings::IntSetting::PLAYSPACE_snapTurnAngle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveCenterTabController::setSnapTurnAngle( int value, bool notify )
|
void MoveCenterTabController::setSnapTurnAngle( int value, bool notify )
|
||||||
{
|
{
|
||||||
if ( m_snapTurnAngle != value )
|
settings::setSetting( settings::IntSetting::PLAYSPACE_snapTurnAngle,
|
||||||
|
value );
|
||||||
|
|
||||||
|
if ( notify )
|
||||||
{
|
{
|
||||||
m_snapTurnAngle = value;
|
emit snapTurnAngleChanged( value );
|
||||||
auto settings = OverlayController::appSettings();
|
|
||||||
settings->beginGroup( "playspaceSettings" );
|
|
||||||
settings->setValue( "snapTurnAngle", m_snapTurnAngle );
|
|
||||||
settings->endGroup();
|
|
||||||
settings->sync();
|
|
||||||
if ( notify )
|
|
||||||
{
|
|
||||||
emit snapTurnAngleChanged( m_snapTurnAngle );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2010,7 +2003,7 @@ void MoveCenterTabController::snapTurnLeft( bool snapTurnLeftJustPressed )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newRotationAngleDeg = m_rotation - m_snapTurnAngle;
|
int newRotationAngleDeg = m_rotation - snapTurnAngle();
|
||||||
// Keep angle within -18000 ~ 18000 centidegrees
|
// Keep angle within -18000 ~ 18000 centidegrees
|
||||||
if ( newRotationAngleDeg > 18000 )
|
if ( newRotationAngleDeg > 18000 )
|
||||||
{
|
{
|
||||||
@@ -2031,7 +2024,7 @@ void MoveCenterTabController::snapTurnRight( bool snapTurnRightJustPressed )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newRotationAngleDeg = m_rotation + m_snapTurnAngle;
|
int newRotationAngleDeg = m_rotation + snapTurnAngle();
|
||||||
// Keep angle within -18000 ~ 18000 centidegrees
|
// Keep angle within -18000 ~ 18000 centidegrees
|
||||||
if ( newRotationAngleDeg > 18000 )
|
if ( newRotationAngleDeg > 18000 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ private:
|
|||||||
int m_rotation = 0;
|
int m_rotation = 0;
|
||||||
int m_oldRotation = 0;
|
int m_oldRotation = 0;
|
||||||
int m_tempRotation = 0;
|
int m_tempRotation = 0;
|
||||||
int m_snapTurnAngle = 4500;
|
|
||||||
int m_smoothTurnRate = 100;
|
int m_smoothTurnRate = 100;
|
||||||
bool m_moveShortcutRightPressed = false;
|
bool m_moveShortcutRightPressed = false;
|
||||||
bool m_moveShortcutLeftPressed = false;
|
bool m_moveShortcutLeftPressed = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user