Use an object name together with alias everywhere where is possible.

This commit is contained in:
Roman Telezhynskyi 2020-11-07 16:20:35 +02:00
parent 91da094f2b
commit adab733202
6 changed files with 24 additions and 27 deletions

View File

@ -397,13 +397,10 @@ quint32 DialogTool::DNumber(const QString &baseName) const
QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmarkDetails) const
{
const QSharedPointer<VGObject> obj = data->GetGObject(node.GetId());
QString name = obj->name();
QString name = obj->ObjectName();
if (node.GetTypeTool() != Tool::NodePoint)
{
int bias = 0;
qApp->TrVars()->VariablesToUser(name, 0, obj->name(), bias);
if (node.GetReverse())
{
name = QStringLiteral("- ") + name;
@ -706,17 +703,7 @@ void DialogTool::PrepareList(QMap<QString, quint32> &list, quint32 id) const
{
const auto obj = data->GeometricObject<T>(id);
SCASSERT(obj != nullptr)
QString newName = obj->name();
int bias = 0;
if (qApp->TrVars()->VariablesToUser(newName, 0, obj->name(), bias))
{
list[newName] = id;
}
else
{
list[obj->name()] = id;
}
list[obj->ObjectName()] = id;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -109,7 +109,7 @@ void DialogInsertNode::SetNode(const VPieceNode &node)
QString name = tr("Uknown");
try
{
name = qApp->TrVars()->InternalVarToUser(data->GetGObject(m_node.GetId())->name());
name = data->GetGObject(m_node.GetId())->ObjectName();
}
catch (const VExceptionBadId &)
{

View File

@ -165,21 +165,25 @@ VToolCutSplinePath* VToolCutSplinePath::Create(VToolCutInitData &initData)
{
initData.id = initData.data->AddGObject(p);
initData.data->AddSpline(QSharedPointer<VAbstractBezier>(splPath1), NULL_ID, initData.id);
initData.data->AddSpline(QSharedPointer<VAbstractBezier>(splPath2), NULL_ID, initData.id);
auto path1 = QSharedPointer<VAbstractBezier>(splPath1);
initData.data->AddSpline(path1, NULL_ID, initData.id);
initData.data->RegisterUniqueName(path1);
initData.data->RegisterUniqueName(splPath1);
initData.data->RegisterUniqueName(splPath2);
auto path2 = QSharedPointer<VAbstractBezier>(splPath2);
initData.data->AddSpline(path2, NULL_ID, initData.id);
initData.data->RegisterUniqueName(path2);
}
else
{
initData.data->UpdateGObject(initData.id, p);
initData.data->AddSpline(QSharedPointer<VAbstractBezier>(splPath1), NULL_ID, initData.id);
initData.data->AddSpline(QSharedPointer<VAbstractBezier>(splPath2), NULL_ID, initData.id);
auto path1 = QSharedPointer<VAbstractBezier>(splPath1);
initData.data->AddSpline(path1, NULL_ID, initData.id);
initData.data->RegisterUniqueName(path1);
initData.data->RegisterUniqueName(splPath1);
initData.data->RegisterUniqueName(splPath2);
auto path2 = QSharedPointer<VAbstractBezier>(splPath2);
initData.data->AddSpline(path2, NULL_ID, initData.id);
initData.data->RegisterUniqueName(path2);
if (initData.parse != Document::FullParse)
{

View File

@ -143,7 +143,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(VToolCurveIntersectAxis
{
const QString errorMsg = tr("Error calculating point '%1'. There is no intersection with curve '%2' and axis"
" through point '%3' with angle %4°")
.arg(initData.name, curve->name(), basePoint->name()).arg(angle);
.arg(initData.name, curve->ObjectName(), basePoint->name()).arg(angle);
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}
@ -403,7 +403,10 @@ void VToolCurveIntersectAxis::InitSegments(GOType curveType, qreal segLength, co
delete spl2;
}
data->RegisterUniqueName(spline1);
data->AddSpline(spline1, NULL_ID, p->id());
data->RegisterUniqueName(spline2);
data->AddSpline(spline2, NULL_ID, p->id());
break;
}
@ -448,7 +451,10 @@ void VToolCurveIntersectAxis::InitSegments(GOType curveType, qreal segLength, co
delete splPath2;
}
data->RegisterUniqueName(splP1);
data->AddSpline(splP1, NULL_ID, p->id());
data->RegisterUniqueName(splP2);
data->AddSpline(splP2, NULL_ID, p->id());
break;
}

View File

@ -122,7 +122,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(VToolPointFromA
if (not success)
{
const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found")
.arg(initData.name, arc.name(), tPoint.name());
.arg(initData.name, arc.ObjectName(), tPoint.name());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}

View File

@ -121,7 +121,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(VToolPointOfI
if (not success)
{
const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection")
.arg(initData.name, firstArc->name(), secondArc->name());
.arg(initData.name, firstArc->ObjectName(), secondArc->ObjectName());
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
}