Refactoring.

Use Visualization::AngleToUser method to show angle values in a tooltip.
This commit is contained in:
Roman Telezhynskyi 2022-08-24 19:52:47 +03:00
parent f9bc111159
commit b5ec1e61b8
7 changed files with 17 additions and 36 deletions

View File

@ -169,22 +169,14 @@ void VisToolMove::RefreshGeometry()
{ {
SetToolTip(tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, " SetToolTip(tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, "
"<b>Mouse click</b> - finish selecting a position") "<b>Mouse click</b> - finish selecting a position")
.arg(VAbstractApplication::VApp()->TrVars()->FormulaToUser( .arg(LengthToUser(tempLength), prefix, AngleToUser(tempAngle), VModifierKey::Shift()));
QString::number(VAbstractValApplication::VApp()->fromPixel(tempLength)),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()), prefix)
.arg(tempAngle)
.arg(VModifierKey::Shift()));
} }
else else
{ {
SetToolTip(tr("Length = %1%2, angle = %3°, rotation angle = %4°, <b>%5</b> - sticking angle, " SetToolTip(tr("Length = %1%2, angle = %3°, rotation angle = %4°, <b>%5</b> - sticking angle, "
"<b>%6</b> - change rotation origin point, <b>Mouse click</b> - finish creating") "<b>%6</b> - change rotation origin point, <b>Mouse click</b> - finish creating")
.arg(VAbstractApplication::VApp()->TrVars()->FormulaToUser( .arg(LengthToUser(tempLength), prefix, AngleToUser(tempAngle), AngleToUser(tempRoationAngle),
QString::number(VAbstractValApplication::VApp()->fromPixel(tempLength)), VModifierKey::Shift(), VModifierKey::Control()));
VAbstractApplication::VApp()->Settings()->GetOsSeparator()), prefix)
.arg(tempAngle)
.arg(tempRoationAngle)
.arg(VModifierKey::Shift(), VModifierKey::Control()));
} }
CreateMovedRotatedObjects(iPoint, iCurve, tempLength, tempAngle, tempRoationAngle, origin); CreateMovedRotatedObjects(iPoint, iCurve, tempLength, tempAngle, tempRoationAngle, origin);

View File

@ -114,8 +114,7 @@ void VisToolRotation::RefreshGeometry()
SetToolTip(tr("Rotating angle = %1°, <b>%2</b> - sticking angle, " SetToolTip(tr("Rotating angle = %1°, <b>%2</b> - sticking angle, "
"<b>Mouse click</b> - finish creation") "<b>Mouse click</b> - finish creation")
.arg(tempAngle) .arg(AngleToUser(tempAngle), VModifierKey::Shift()));
.arg(VModifierKey::Shift()));
} }
int iPoint = -1; int iPoint = -1;

View File

@ -92,8 +92,7 @@ void VisToolCurveIntersectAxis::RefreshGeometry()
SetToolTip(tr("<b>Intersection curve and axis</b>: angle = %1°; <b>%2</b> - " SetToolTip(tr("<b>Intersection curve and axis</b>: angle = %1°; <b>%2</b> - "
"sticking angle, <b>%3</b> - finish creation") "sticking angle, <b>%3</b> - finish creation")
.arg(this->line().angle()) .arg(AngleToUser(this->line().angle()), VModifierKey::Shift(), VModifierKey::EnterKey()));
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
} }
} }
} }

View File

@ -88,12 +88,8 @@ void VisToolEndLine::RefreshGeometry()
static const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true); static const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
SetToolTip(tr("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; " SetToolTip(tr("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; "
"<b>%4</b> - sticking angle, <b>%5</b> - finish creation") "<b>%4</b> - sticking angle, <b>%5</b> - finish creation")
.arg(this->line().angle()) .arg(AngleToUser(this->line().angle()), LengthToUser(this->line().length()), prefix,
.arg(VAbstractApplication::VApp()->TrVars() VModifierKey::Shift(), VModifierKey::EnterKey()));
->FormulaToUser(
QString::number(VAbstractValApplication::VApp()->fromPixel(this->line().length())),
VAbstractApplication::VApp()->Settings()->GetOsSeparator()),
prefix, VModifierKey::Shift(), VModifierKey::EnterKey()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -107,8 +107,8 @@ void VisToolLineIntersectAxis::RefreshGeometry()
SetToolTip(tr("<b>Intersection line and axis</b>: angle = %1°; <b>%2</b> - " SetToolTip(tr("<b>Intersection line and axis</b>: angle = %1°; <b>%2</b> - "
"sticking angle, <b>%3</b> - finish creation") "sticking angle, <b>%3</b> - finish creation")
.arg(this->line().angle()) .arg(AngleToUser(this->line().angle()), VModifierKey::Shift(),
.arg(VModifierKey::Shift(), VModifierKey::EnterKey())); VModifierKey::EnterKey()));
} }
} }
} }

View File

@ -112,9 +112,8 @@ void VisToolArc::RefreshGeometry()
"<b>Mouse click</b> - finish selecting the first angle, " "<b>Mouse click</b> - finish selecting the first angle, "
"<b>%4</b> - sticking angle, " "<b>%4</b> - sticking angle, "
"<b>%5</b> - skip") "<b>%5</b> - skip")
.arg(LengthToUser(m_radius), prefix) .arg(LengthToUser(m_radius), prefix, AngleToUser(f1Angle), VModifierKey::Shift(),
.arg(f1Angle) VModifierKey::EnterKey()));
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
} }
else if (m_f1 >= 0) else if (m_f1 >= 0)
{ {
@ -129,10 +128,8 @@ void VisToolArc::RefreshGeometry()
"<b>%5</b> - sticking angle, " "<b>%5</b> - sticking angle, "
"<b>%6</b> - sticking end, " "<b>%6</b> - sticking end, "
"<b>%7</b> - skip") "<b>%7</b> - skip")
.arg(LengthToUser(m_radius), prefix) .arg(LengthToUser(m_radius), prefix, AngleToUser(m_f1), AngleToUser(f2Angle),
.arg(m_f1) VModifierKey::Shift(), VModifierKey::Control(), VModifierKey::EnterKey()));
.arg(f2Angle)
.arg(VModifierKey::Shift(), VModifierKey::Control(), VModifierKey::EnterKey()));
} }
} }
else else

View File

@ -109,9 +109,8 @@ void VisToolArcWithLength::RefreshGeometry()
"<b>Mouse click</b> - finish selecting the first angle, " "<b>Mouse click</b> - finish selecting the first angle, "
"<b>%4</b> - sticking angle, " "<b>%4</b> - sticking angle, "
"<b>%5</b> - skip") "<b>%5</b> - skip")
.arg(LengthToUser(m_radius), prefix) .arg(LengthToUser(m_radius), prefix, AngleToUser(f1Angle), VModifierKey::Shift(),
.arg(f1Angle) VModifierKey::EnterKey()));
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
} }
else if (m_f1 >= 0) else if (m_f1 >= 0)
{ {
@ -123,9 +122,8 @@ void VisToolArcWithLength::RefreshGeometry()
SetToolTip(tr("<b>Arc</b>: radius = %1%2, first angle = %3°, arc length = %4%2; " SetToolTip(tr("<b>Arc</b>: radius = %1%2, first angle = %3°, arc length = %4%2; "
"<b>Mouse click</b> - finish creating, " "<b>Mouse click</b> - finish creating, "
"<b>%5</b> - skip") "<b>%5</b> - skip")
.arg(LengthToUser(m_radius), prefix) .arg(LengthToUser(m_radius), prefix, AngleToUser(m_f1), LengthToUser(arc.GetLength()),
.arg(m_f1) VModifierKey::EnterKey()));
.arg(LengthToUser(arc.GetLength()), VModifierKey::EnterKey()));
} }
} }
else else