From adab73320251f546d184c94282df0c1c34d9fa49 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 7 Nov 2020 16:20:35 +0200 Subject: [PATCH] Use an object name together with alias everywhere where is possible. --- src/libs/vtools/dialogs/tools/dialogtool.cpp | 17 ++-------------- .../dialogs/tools/piece/dialoginsertnode.cpp | 2 +- .../toolcut/vtoolcutsplinepath.cpp | 20 +++++++++++-------- .../toollinepoint/vtoolcurveintersectaxis.cpp | 8 +++++++- .../vtoolpointfromarcandtangent.cpp | 2 +- .../vtoolpointofintersectionarcs.cpp | 2 +- 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 79e6aab56..20616e897 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -397,13 +397,10 @@ quint32 DialogTool::DNumber(const QString &baseName) const QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmarkDetails) const { const QSharedPointer 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 &list, quint32 id) const { const auto obj = data->GeometricObject(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; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp b/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp index ec327bdb1..31ad3295b 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp @@ -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 &) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 83144906c..7fbe7fede 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -165,21 +165,25 @@ VToolCutSplinePath* VToolCutSplinePath::Create(VToolCutInitData &initData) { initData.id = initData.data->AddGObject(p); - initData.data->AddSpline(QSharedPointer(splPath1), NULL_ID, initData.id); - initData.data->AddSpline(QSharedPointer(splPath2), NULL_ID, initData.id); + auto path1 = QSharedPointer(splPath1); + initData.data->AddSpline(path1, NULL_ID, initData.id); + initData.data->RegisterUniqueName(path1); - initData.data->RegisterUniqueName(splPath1); - initData.data->RegisterUniqueName(splPath2); + auto path2 = QSharedPointer(splPath2); + initData.data->AddSpline(path2, NULL_ID, initData.id); + initData.data->RegisterUniqueName(path2); } else { initData.data->UpdateGObject(initData.id, p); - initData.data->AddSpline(QSharedPointer(splPath1), NULL_ID, initData.id); - initData.data->AddSpline(QSharedPointer(splPath2), NULL_ID, initData.id); + auto path1 = QSharedPointer(splPath1); + initData.data->AddSpline(path1, NULL_ID, initData.id); + initData.data->RegisterUniqueName(path1); - initData.data->RegisterUniqueName(splPath1); - initData.data->RegisterUniqueName(splPath2); + auto path2 = QSharedPointer(splPath2); + initData.data->AddSpline(path2, NULL_ID, initData.id); + initData.data->RegisterUniqueName(path2); if (initData.parse != Document::FullParse) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index b8f4b6cb6..cd59ab249 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -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; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index e4004777c..ff1b81a74 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -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; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 36b830b2d..23dc7842e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -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; }