Refactoring.
Rename Visualization::NumberToUser to Visualization::LengthToUser to avoid confusion. Add Visualization::AngleToUser.
This commit is contained in:
parent
1c0885e766
commit
5262d8afb7
|
@ -34,14 +34,12 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "vabstractcurve.h"
|
||||
#include "vellipticalarc_p.h"
|
||||
#include "vspline.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -116,7 +116,7 @@ void VisToolAlongLine::RefreshGeometry()
|
|||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ void VisToolBisector::RefreshGeometry()
|
|||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ void VisToolNormal::RefreshGeometry()
|
|||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
|||
SetToolTip(tr("Radius = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the radius, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
|||
SetToolTip(tr("Radius = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the second radius, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
|||
SetToolTip(tr("Radius = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the first radius, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ void VisToolShoulderPoint::RefreshGeometry()
|
|||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(len), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ void VisToolArc::RefreshGeometry()
|
|||
|
||||
SetToolTip(tr("<b>Arc</b>: radius = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the radius, "
|
||||
"<b>%3</b> - skip").arg(NumberToUser(r.length()), prefix, VModifierKey::EnterKey()));
|
||||
"<b>%3</b> - skip").arg(LengthToUser(r.length()), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
else if (m_f1 < 0)
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ void VisToolArc::RefreshGeometry()
|
|||
"<b>Mouse click</b> - finish selecting the first angle, "
|
||||
"<b>%4</b> - sticking angle, "
|
||||
"<b>%5</b> - skip")
|
||||
.arg(NumberToUser(m_radius), prefix)
|
||||
.arg(LengthToUser(m_radius), prefix)
|
||||
.arg(f1Angle)
|
||||
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void VisToolArc::RefreshGeometry()
|
|||
"<b>%5</b> - sticking angle, "
|
||||
"<b>%6</b> - sticking end, "
|
||||
"<b>%7</b> - skip")
|
||||
.arg(NumberToUser(m_radius), prefix)
|
||||
.arg(LengthToUser(m_radius), prefix)
|
||||
.arg(m_f1)
|
||||
.arg(f2Angle)
|
||||
.arg(VModifierKey::Shift(), VModifierKey::Control(), VModifierKey::EnterKey()));
|
||||
|
|
|
@ -89,7 +89,7 @@ void VisToolArcWithLength::RefreshGeometry()
|
|||
|
||||
SetToolTip(tr("<b>Arc</b>: radius = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the radius, "
|
||||
"<b>%3</b> - skip").arg(NumberToUser(r.length()), prefix, VModifierKey::EnterKey()));
|
||||
"<b>%3</b> - skip").arg(LengthToUser(r.length()), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
else if (m_f1 < 0)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ void VisToolArcWithLength::RefreshGeometry()
|
|||
"<b>Mouse click</b> - finish selecting the first angle, "
|
||||
"<b>%4</b> - sticking angle, "
|
||||
"<b>%5</b> - skip")
|
||||
.arg(NumberToUser(m_radius), prefix)
|
||||
.arg(LengthToUser(m_radius), prefix)
|
||||
.arg(f1Angle)
|
||||
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
|
||||
}
|
||||
|
@ -123,9 +123,9 @@ void VisToolArcWithLength::RefreshGeometry()
|
|||
SetToolTip(tr("<b>Arc</b>: radius = %1%2, first angle = %3°, arc length = %4%2; "
|
||||
"<b>Mouse click</b> - finish creating, "
|
||||
"<b>%5</b> - skip")
|
||||
.arg(NumberToUser(m_radius), prefix)
|
||||
.arg(LengthToUser(m_radius), prefix)
|
||||
.arg(m_f1)
|
||||
.arg(NumberToUser(arc.GetLength()), VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(arc.GetLength()), VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -86,7 +86,7 @@ void VisToolCutArc::RefreshGeometry()
|
|||
const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip").arg(NumberToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
"<b>%3</b> - skip").arg(LengthToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ void VisToolCutSpline::RefreshGeometry()
|
|||
const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip").arg(NumberToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
"<b>%3</b> - skip").arg(LengthToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ void VisToolCutSplinePath::RefreshGeometry()
|
|||
SetToolTip(tr("Length = %1%2; "
|
||||
"<b>Mouse click</b> - finish selecting the length, "
|
||||
"<b>%3</b> - skip")
|
||||
.arg(NumberToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
.arg(LengthToUser(length), prefix, VModifierKey::EnterKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,13 +308,20 @@ auto Visualization::GetCurveItem(QVector<VCurvePathItem *> &curves, quint32 i, c
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto Visualization::NumberToUser(qreal value) -> QString
|
||||
auto Visualization::LengthToUser(qreal value) -> QString
|
||||
{
|
||||
return VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(QString::number(VAbstractValApplication::VApp()->fromPixel(value)),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto Visualization::AngleToUser(qreal value) -> QString
|
||||
{
|
||||
return VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(QString::number(value), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void Visualization::SetColor(VColor type, const QColor& color)
|
||||
{
|
||||
|
|
|
@ -119,7 +119,8 @@ protected:
|
|||
static auto GetCurveItem(QVector<VCurvePathItem *> &curves, quint32 i, const QColor &color,
|
||||
QGraphicsItem *parent) -> VCurvePathItem *;
|
||||
|
||||
static auto NumberToUser(qreal value) -> QString;
|
||||
static auto LengthToUser(qreal value) -> QString;
|
||||
static auto AngleToUser(qreal value) -> QString;
|
||||
|
||||
void SetColor(VColor type, const QColor& color);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user