Check pointer instead of QSharedPointer object.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-12-19 14:25:00 +02:00
parent 2b9a50bf3a
commit 2d55423e8e

View file

@ -270,25 +270,25 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::Spline: case Tool::Spline:
{ {
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId()); const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
SCASSERT(spl != nullptr); SCASSERT(not spl.isNull());
return spl->NameForHistory(tr("Curve")); return spl->NameForHistory(tr("Curve"));
} }
case Tool::CubicBezier: case Tool::CubicBezier:
{ {
const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId()); const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId());
SCASSERT(spl != nullptr); SCASSERT(not spl.isNull());
return spl->NameForHistory(tr("Cubic bezier curve")); return spl->NameForHistory(tr("Cubic bezier curve"));
} }
case Tool::Arc: case Tool::Arc:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(arc != nullptr); SCASSERT(not arc.isNull());
return arc->NameForHistory(tr("Arc")); return arc->NameForHistory(tr("Arc"));
} }
case Tool::ArcWithLength: case Tool::ArcWithLength:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(arc != nullptr); SCASSERT(not arc.isNull());
return tr("%1 with length %2") return tr("%1 with length %2")
.arg(arc->NameForHistory(tr("Arc"))) .arg(arc->NameForHistory(tr("Arc")))
.arg(arc->GetLength()); .arg(arc->GetLength());
@ -296,13 +296,13 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::SplinePath: case Tool::SplinePath:
{ {
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId()); const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
SCASSERT(splPath != nullptr); SCASSERT(not splPath.isNull());
return splPath->NameForHistory(tr("Spline path")); return splPath->NameForHistory(tr("Spline path"));
} }
case Tool::CubicBezierPath: case Tool::CubicBezierPath:
{ {
const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId()); const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId());
SCASSERT(splPath != nullptr); SCASSERT(not splPath.isNull());
return splPath->NameForHistory(tr("Cubic bezier curve path")); return splPath->NameForHistory(tr("Cubic bezier curve path"));
} }
case Tool::PointOfContact: case Tool::PointOfContact:
@ -330,7 +330,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::CutArc: case Tool::CutArc:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc)); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
SCASSERT(arc != nullptr); SCASSERT(not arc.isNull());
return tr("%1 - cut %2") return tr("%1 - cut %2")
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(arc->NameForHistory(tr("arc"))); .arg(arc->NameForHistory(tr("arc")));
@ -339,7 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
{ {
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline); const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId); const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId);
SCASSERT(spl != nullptr); SCASSERT(not spl.isNull());
return tr("%1 - cut %2") return tr("%1 - cut %2")
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(spl->NameForHistory(tr("curve"))); .arg(spl->NameForHistory(tr("curve")));
@ -349,7 +349,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath); const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
const QSharedPointer<VAbstractCubicBezierPath> splPath = const QSharedPointer<VAbstractCubicBezierPath> splPath =
data->GeometricObject<VAbstractCubicBezierPath>(splinePathId); data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
SCASSERT(splPath != nullptr); SCASSERT(not splPath.isNull());
return tr("%1 - cut %2") return tr("%1 - cut %2")
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(splPath->NameForHistory(tr("curve path"))); .arg(splPath->NameForHistory(tr("curve path")));