SonarQube warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-09-13 11:52:41 +03:00
parent 851044d37e
commit 39aa43fe8f
64 changed files with 69 additions and 127 deletions

View File

@ -93,7 +93,7 @@ void PreferencesPathPage::DefaultPath()
path = VCommonSettings::GetDefPathTemplate(); path = VCommonSettings::GetDefPathTemplate();
break; break;
case 5: // label templates case 5: // label templates
path = VSettings::GetDefPathLabelTemplate(); path = VCommonSettings::GetDefPathLabelTemplate();
break; break;
default: default:
break; break;

View File

@ -138,12 +138,12 @@ void PreferencesPatternPage::EditDateTimeFormats()
QPushButton *button = qobject_cast<QPushButton *>(sender()); QPushButton *button = qobject_cast<QPushButton *>(sender());
if (button == ui->pushButtonEditDateFormats) if (button == ui->pushButtonEditDateFormats)
{ {
CallDateTimeFormatEditor(QDate::currentDate(), settings->PredefinedDateFormats(), CallDateTimeFormatEditor(QDate::currentDate(), VCommonSettings::PredefinedDateFormats(),
settings->GetUserDefinedDateFormats(), ui->comboBoxDateFormats); settings->GetUserDefinedDateFormats(), ui->comboBoxDateFormats);
} }
else if (button == ui->pushButtonEditTimeFormats) else if (button == ui->pushButtonEditTimeFormats)
{ {
CallDateTimeFormatEditor(QTime::currentTime(), settings->PredefinedTimeFormats(), CallDateTimeFormatEditor(QTime::currentTime(), VCommonSettings::PredefinedTimeFormats(),
settings->GetUserDefinedTimeFormats(), ui->comboBoxTimeFormats); settings->GetUserDefinedTimeFormats(), ui->comboBoxTimeFormats);
} }
} }
@ -166,10 +166,10 @@ void PreferencesPatternPage::InitLabelDateTimeFormats()
VSettings *settings = qApp->ValentinaSettings(); VSettings *settings = qApp->ValentinaSettings();
InitComboBoxFormats(ui->comboBoxDateFormats, InitComboBoxFormats(ui->comboBoxDateFormats,
VSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(), VCommonSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
settings->GetLabelDateFormat()); settings->GetLabelDateFormat());
InitComboBoxFormats(ui->comboBoxTimeFormats, InitComboBoxFormats(ui->comboBoxTimeFormats,
VSettings::PredefinedTimeFormats() + settings->GetUserDefinedTimeFormats(), VCommonSettings::PredefinedTimeFormats() + settings->GetUserDefinedTimeFormats(),
settings->GetLabelTimeFormat()); settings->GetLabelTimeFormat());
connect(ui->pushButtonEditDateFormats, &QPushButton::clicked, this, &PreferencesPatternPage::EditDateTimeFormats); connect(ui->pushButtonEditDateFormats, &QPushButton::clicked, this, &PreferencesPatternPage::EditDateTimeFormats);

View File

@ -191,10 +191,10 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
&DialogPatternProperties::ManagePatternMaterials); &DialogPatternProperties::ManagePatternMaterials);
InitComboBoxFormats(ui->comboBoxDateFormat, InitComboBoxFormats(ui->comboBoxDateFormat,
VSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(), VCommonSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
doc->GetLabelDateFormat()); doc->GetLabelDateFormat());
InitComboBoxFormats(ui->comboBoxTimeFormat, InitComboBoxFormats(ui->comboBoxTimeFormat,
VSettings::PredefinedTimeFormats() + settings->GetUserDefinedTimeFormats(), VCommonSettings::PredefinedTimeFormats() + settings->GetUserDefinedTimeFormats(),
doc->GetLabelTimeFormat()); doc->GetLabelTimeFormat());
connect(ui->comboBoxDateFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxDateFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -824,13 +824,9 @@ void DialogPatternProperties::ChangeImage()
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)"); const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr, const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
QFileDialog::DontUseNativeDialog); QFileDialog::DontUseNativeDialog);
if (not fileName.isEmpty())
{
QImage image; QImage image;
if (fileName.isEmpty())
{
return;
}
else
{
if (not image.load(fileName)) if (not image.load(fileName))
{ {
return; return;

View File

@ -3067,13 +3067,13 @@ void VPattern::GarbageCollector()
{ {
// First get next sibling because later will not have chance to get it // First get next sibling because later will not have chance to get it
QDomElement nextSibling = modNode.nextSibling().toElement(); QDomElement nextSibling = modNode.nextSibling().toElement();
if (modNode.hasAttribute(VAbstractNode::AttrInUse)) if (modNode.hasAttribute(VAbstractTool::AttrInUse))
{ {
const NodeUsage inUse = GetParametrUsage(modNode, VAbstractNode::AttrInUse); const NodeUsage inUse = GetParametrUsage(modNode, VAbstractTool::AttrInUse);
if (inUse == NodeUsage::InUse) if (inUse == NodeUsage::InUse)
{ // It is dangerous to leave object with attribute 'inUse' { // It is dangerous to leave object with attribute 'inUse'
// Each parse should confirm this status. // Each parse should confirm this status.
SetParametrUsage(modNode, VAbstractNode::AttrInUse, NodeUsage::NotInUse); SetParametrUsage(modNode, VAbstractTool::AttrInUse, NodeUsage::NotInUse);
} }
else else
{ // Parent was deleted. We do not need this object anymore { // Parent was deleted. We do not need this object anymore
@ -3082,7 +3082,7 @@ void VPattern::GarbageCollector()
} }
else else
{ // Each parse should confirm his status. { // Each parse should confirm his status.
SetParametrUsage(modNode, VAbstractNode::AttrInUse, NodeUsage::NotInUse); SetParametrUsage(modNode, VAbstractTool::AttrInUse, NodeUsage::NotInUse);
} }
modNode = nextSibling; modNode = nextSibling;

View File

@ -135,10 +135,13 @@ void VPE::VPropertyFormView::dataChanged(const QModelIndex &top_left, const QMod
{ {
Q_UNUSED(top_left) Q_UNUSED(top_left)
Q_UNUSED(bottom_right) Q_UNUSED(bottom_right)
if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->IgnoreDataChangedSignal)
{ // Ucomment when handle data changes
return; // if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->IgnoreDataChangedSignal)
} // {
// return;
// }
// todo: handle data changes // todo: handle data changes
} }

View File

@ -78,8 +78,8 @@ void VPE::VPropertyFormWidget::build()
d_ptr->EditorWidgets.clear(); d_ptr->EditorWidgets.clear();
if (layout()) if (layout())
{ {
QLayoutItem *child; QLayoutItem *child = layout()->takeAt(0);
while (layout()->count() > 0 && (child = layout()->takeAt(0)) != nullptr) while (layout()->count() > 0 && child != nullptr)
{ {
if (child->widget()) if (child->widget())
{ {

View File

@ -221,11 +221,7 @@ bool VPE::VPropertySet::hasProperty(VProperty *property, VProperty *parent) cons
const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties); const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties);
foreach(VProperty* tmpProp, tmpChildrenList) foreach(VProperty* tmpProp, tmpChildrenList)
{ {
if (!tmpProp) if (tmpProp && (tmpProp == property || hasProperty(property, tmpProp)))
{
continue;
}
else if (tmpProp == property || hasProperty(property, tmpProp))
{ {
return true; return true;
} }

View File

@ -222,7 +222,6 @@ void DialogEditWrongFormula::ValChanged(int row)
if (ui->radioButtonFunctions->isChecked()) if (ui->radioButtonFunctions->isChecked())
{ {
ui->labelDescription->setText(item->toolTip()); ui->labelDescription->setText(item->toolTip());
return;
} }
} }

View File

@ -177,7 +177,6 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
emit ToolTip(""); emit ToolTip("");
this->setModal(true); this->setModal(true);
this->show(); this->show();
return;
} }
else else
{ {
@ -185,13 +184,11 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
p1 = 0; p1 = 0;
p2 = 0; p2 = 0;
emit ToolTip(tr("Select a detail")); emit ToolTip(tr("Select a detail"));
return;
} }
} }
else else
{ {
emit ToolTip(tr("Select a point on edge")); emit ToolTip(tr("Select a point on edge"));
return;
} }
} }
} }

View File

@ -124,7 +124,7 @@ VToolFlippingByAxis *VToolFlippingByAxis::Create(const quint32 _id, quint32 orig
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::FlippingByAxis, doc); VAbstractTool::AddRecord(id, Tool::FlippingByAxis, doc);
VToolFlippingByAxis *tool = new VToolFlippingByAxis(doc, data, id, originPointId, axisType, suffix, source, VToolFlippingByAxis *tool = new VToolFlippingByAxis(doc, data, id, originPointId, axisType, suffix, source,
dest, typeCreation); dest, typeCreation);
scene->addItem(tool); scene->addItem(tool);

View File

@ -118,7 +118,7 @@ VToolFlippingByLine *VToolFlippingByLine::Create(const quint32 _id, quint32 firs
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::FlippingByLine, doc); VAbstractTool::AddRecord(id, Tool::FlippingByLine, doc);
VToolFlippingByLine *tool = new VToolFlippingByLine(doc, data, id, firstLinePointId, secondLinePointId, suffix, VToolFlippingByLine *tool = new VToolFlippingByLine(doc, data, id, firstLinePointId, secondLinePointId, suffix,
source, dest, typeCreation); source, dest, typeCreation);
scene->addItem(tool); scene->addItem(tool);

View File

@ -219,7 +219,7 @@ QT_WARNING_POP
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Move, doc); VAbstractTool::AddRecord(id, Tool::Move, doc);
VToolMove *tool = new VToolMove(doc, data, id, formulaAngle, formulaLength, suffix, source, dest, VToolMove *tool = new VToolMove(doc, data, id, formulaAngle, formulaLength, suffix, source, dest,
typeCreation); typeCreation);
scene->addItem(tool); scene->addItem(tool);

View File

@ -236,7 +236,7 @@ QT_WARNING_POP
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Rotation, doc); VAbstractTool::AddRecord(id, Tool::Rotation, doc);
VToolRotation *tool = new VToolRotation(doc, data, id, origin, angle, suffix, source, dest, typeCreation); VToolRotation *tool = new VToolRotation(doc, data, id, origin, angle, suffix, source, dest, typeCreation);
scene->addItem(tool); scene->addItem(tool);
InitOperationToolConnections(scene, tool); InitOperationToolConnections(scene, tool);

View File

@ -172,7 +172,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Arc, doc); VAbstractTool::AddRecord(id, Tool::Arc, doc);
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
scene->addItem(toolArc); scene->addItem(toolArc);
InitArcToolConnections(scene, toolArc); InitArcToolConnections(scene, toolArc);

View File

@ -141,7 +141,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::ArcWithLength, doc); VAbstractTool::AddRecord(id, Tool::ArcWithLength, doc);
VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation); VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation);
scene->addItem(toolArc); scene->addItem(toolArc);
InitArcToolConnections(scene, toolArc); InitArcToolConnections(scene, toolArc);

View File

@ -124,7 +124,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::CubicBezier, doc); VAbstractTool::AddRecord(id, Tool::CubicBezier, doc);
auto _spl = new VToolCubicBezier(doc, data, id, typeCreation); auto _spl = new VToolCubicBezier(doc, data, id, typeCreation);
scene->addItem(_spl); scene->addItem(_spl);
InitSplineToolConnections(scene, _spl); InitSplineToolConnections(scene, _spl);

View File

@ -130,7 +130,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::CubicBezierPath, doc); VAbstractTool::AddRecord(id, Tool::CubicBezierPath, doc);
VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation); VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation);
scene->addItem(spl); scene->addItem(spl);
InitSplinePathToolConnections(scene, spl); InitSplinePathToolConnections(scene, spl);

View File

@ -185,7 +185,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(const quint32 _id, const quint32
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::EllipticalArc, doc); VAbstractTool::AddRecord(id, Tool::EllipticalArc, doc);
VToolEllipticalArc *toolEllipticalArc = new VToolEllipticalArc(doc, data, id, typeCreation); VToolEllipticalArc *toolEllipticalArc = new VToolEllipticalArc(doc, data, id, typeCreation);
scene->addItem(toolEllipticalArc); scene->addItem(toolEllipticalArc);
InitElArcToolConnections(scene, toolEllipticalArc); InitElArcToolConnections(scene, toolEllipticalArc);

View File

@ -200,7 +200,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, VMainGraphi
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Spline, doc); VAbstractTool::AddRecord(id, Tool::Spline, doc);
auto _spl = new VToolSpline(doc, data, id, typeCreation); auto _spl = new VToolSpline(doc, data, id, typeCreation);
scene->addItem(_spl); scene->addItem(_spl);
InitSplineToolConnections(scene, _spl); InitSplineToolConnections(scene, _spl);

View File

@ -211,7 +211,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, V
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::SplinePath, doc); VAbstractTool::AddRecord(id, Tool::SplinePath, doc);
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
scene->addItem(spl); scene->addItem(spl);
InitSplinePathToolConnections(scene, spl); InitSplinePathToolConnections(scene, spl);

View File

@ -191,7 +191,7 @@ VToolTrueDarts *VToolTrueDarts::Create(quint32 _id,
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::TrueDarts, doc); VAbstractTool::AddRecord(id, Tool::TrueDarts, doc);
VToolTrueDarts *points = new VToolTrueDarts(doc, data, id, p1id, p2id, baseLineP1Id, baseLineP2Id, VToolTrueDarts *points = new VToolTrueDarts(doc, data, id, p1id, p2id, baseLineP1Id, baseLineP2Id,
dartP1Id, dartP2Id, dartP3Id, typeCreation); dartP1Id, dartP2Id, dartP3Id, typeCreation);
scene->addItem(points); scene->addItem(points);

View File

@ -170,7 +170,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::CutArc, doc); VAbstractTool::AddRecord(id, Tool::CutArc, doc);
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, typeCreation); VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);

View File

@ -170,7 +170,7 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::CutSpline, doc); VAbstractTool::AddRecord(id, Tool::CutSpline, doc);
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, typeCreation); VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);

View File

@ -181,7 +181,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::CutSplinePath, doc); VAbstractTool::AddRecord(id, Tool::CutSplinePath, doc);
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, typeCreation); VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, typeCreation);
scene->addItem(point); scene->addItem(point);
InitToolConnections(scene, point); InitToolConnections(scene, point);

View File

@ -317,7 +317,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
VToolAlongLine *point = nullptr; VToolAlongLine *point = nullptr;
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::AlongLine, doc); VAbstractTool::AddRecord(id, Tool::AlongLine, doc);
point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, lineColor, point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, lineColor,
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -215,7 +215,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Bisector, doc); VAbstractTool::AddRecord(id, Tool::Bisector, doc);
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, lineColor, formula, firstPointId, VToolBisector *point = new VToolBisector(doc, data, id, typeLine, lineColor, formula, firstPointId,
secondPointId, thirdPointId, typeCreation); secondPointId, thirdPointId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -162,7 +162,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::CurveIntersectAxis, doc); VAbstractTool::AddRecord(id, Tool::CurveIntersectAxis, doc);
VToolCurveIntersectAxis *point = new VToolCurveIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle, VToolCurveIntersectAxis *point = new VToolCurveIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle,
basePointId, curveId, typeCreation); basePointId, curveId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -177,7 +177,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::EndLine, doc); VAbstractTool::AddRecord(id, Tool::EndLine, doc);
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, lineColor, formulaLength, formulaAngle, VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, lineColor, formulaLength, formulaAngle,
basePointId, typeCreation); basePointId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -175,7 +175,7 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Height, doc); VAbstractTool::AddRecord(id, Tool::Height, doc);
VToolHeight *point = new VToolHeight(doc, data, id, typeLine, lineColor, basePointId, p1LineId, p2LineId, VToolHeight *point = new VToolHeight(doc, data, id, typeLine, lineColor, basePointId, p1LineId, p2LineId,
typeCreation); typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -149,7 +149,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::LineIntersectAxis, doc); VAbstractTool::AddRecord(id, Tool::LineIntersectAxis, doc);
VToolLineIntersectAxis *point = new VToolLineIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle, VToolLineIntersectAxis *point = new VToolLineIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle,
basePointId, firstPointId, secondPointId, basePointId, firstPointId, secondPointId,
typeCreation); typeCreation);

View File

@ -179,7 +179,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Normal, doc); VAbstractTool::AddRecord(id, Tool::Normal, doc);
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, lineColor, formula, angle, firstPointId, VToolNormal *point = new VToolNormal(doc, data, id, typeLine, lineColor, formula, angle, firstPointId,
secondPointId, typeCreation); secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -232,7 +232,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::ShoulderPoint, doc); VAbstractTool::AddRecord(id, Tool::ShoulderPoint, doc);
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, lineColor, formula, VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, lineColor, formula,
p1Line, p2Line, pShoulder, p1Line, p2Line, pShoulder,
typeCreation); typeCreation);

View File

@ -126,7 +126,7 @@ VToolBasePoint *VToolBasePoint::Create(quint32 _id, const QString &nameActivPP,
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::BasePoint, doc); VAbstractTool::AddRecord(id, Tool::BasePoint, doc);
VToolBasePoint *spoint = new VToolBasePoint(doc, data, id, typeCreation, nameActivPP); VToolBasePoint *spoint = new VToolBasePoint(doc, data, id, typeCreation, nameActivPP);
scene->addItem(spoint); scene->addItem(spoint);
InitToolConnections(scene, spoint); InitToolConnections(scene, spoint);

View File

@ -183,7 +183,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::LineIntersect, doc); VAbstractTool::AddRecord(id, Tool::LineIntersect, doc);
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id,
p2Line2Id, typeCreation); p2Line2Id, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -126,7 +126,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointFromArcAndTangent, doc); VAbstractTool::AddRecord(id, Tool::PointFromArcAndTangent, doc);
VToolPointFromArcAndTangent *point = new VToolPointFromArcAndTangent(doc, data, id, arcId, tangentPointId, VToolPointFromArcAndTangent *point = new VToolPointFromArcAndTangent(doc, data, id, arcId, tangentPointId,
crossPoint, typeCreation); crossPoint, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -135,7 +135,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const qui
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointFromCircleAndTangent, doc); VAbstractTool::AddRecord(id, Tool::PointFromCircleAndTangent, doc);
VToolPointFromCircleAndTangent *point = new VToolPointFromCircleAndTangent(doc, data, id, circleCenterId, VToolPointFromCircleAndTangent *point = new VToolPointFromCircleAndTangent(doc, data, id, circleCenterId,
circleRadius, tangentPointId, circleRadius, tangentPointId,
crossPoint, typeCreation); crossPoint, typeCreation);

View File

@ -237,7 +237,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointOfContact, doc); VAbstractTool::AddRecord(id, Tool::PointOfContact, doc);
VToolPointOfContact *point = new VToolPointOfContact(doc, data, id, radius, center, VToolPointOfContact *point = new VToolPointOfContact(doc, data, id, radius, center,
firstPointId, secondPointId, typeCreation); firstPointId, secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -157,7 +157,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointOfIntersection, doc); VAbstractTool::AddRecord(id, Tool::PointOfIntersection, doc);
VToolPointOfIntersection *point = new VToolPointOfIntersection(doc, data, id, firstPointId, VToolPointOfIntersection *point = new VToolPointOfIntersection(doc, data, id, firstPointId,
secondPointId, typeCreation); secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -127,7 +127,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointOfIntersectionArcs, doc); VAbstractTool::AddRecord(id, Tool::PointOfIntersectionArcs, doc);
VToolPointOfIntersectionArcs *point = new VToolPointOfIntersectionArcs(doc, data, id, firstArcId, VToolPointOfIntersectionArcs *point = new VToolPointOfIntersectionArcs(doc, data, id, firstArcId,
secondArcId, pType, typeCreation); secondArcId, pType, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -148,7 +148,7 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const q
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointOfIntersectionCircles, doc); VAbstractTool::AddRecord(id, Tool::PointOfIntersectionCircles, doc);
VToolPointOfIntersectionCircles *point = new VToolPointOfIntersectionCircles(doc, data, id, firstCircleCenterId, VToolPointOfIntersectionCircles *point = new VToolPointOfIntersectionCircles(doc, data, id, firstCircleCenterId,
secondCircleCenterId, secondCircleCenterId,
firstCircleRadius, firstCircleRadius,

View File

@ -136,7 +136,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const qui
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::PointOfIntersectionCurves, doc); VAbstractTool::AddRecord(id, Tool::PointOfIntersectionCurves, doc);
auto point = new VToolPointOfIntersectionCurves(doc, data, id, firstCurveId, secondCurveId, vCrossPoint, auto point = new VToolPointOfIntersectionCurves(doc, data, id, firstCurveId, secondCurveId, vCrossPoint,
hCrossPoint, typeCreation); hCrossPoint, typeCreation);
scene->addItem(point); scene->addItem(point);
@ -185,17 +185,13 @@ QPointF VToolPointOfIntersectionCurves::FindPoint(const QVector<QPointF> &curve1
for ( auto i = 1; i < intersections.count(); ++i ) for ( auto i = 1; i < intersections.count(); ++i )
{ {
const QPointF p = intersections.at(i); const QPointF p = intersections.at(i);
if (p.y() > minY) if (p.y() < minY)
{
continue;
}
else if (p.y() < minY)
{ {
minY = p.y(); minY = p.y();
vIntersections.clear(); vIntersections.clear();
vIntersections.append(p); vIntersections.append(p);
} }
else else if (VFuzzyComparePossibleNulls(p.y(), minY))
{ {
vIntersections.append(p); vIntersections.append(p);
} }
@ -215,11 +211,7 @@ QPointF VToolPointOfIntersectionCurves::FindPoint(const QVector<QPointF> &curve1
vIntersections.clear(); vIntersections.clear();
vIntersections.append(p); vIntersections.append(p);
} }
else if (p.y() < maxY) else if (VFuzzyComparePossibleNulls(p.y(), maxY))
{
continue;
}
else
{ {
vIntersections.append(p); vIntersections.append(p);
} }

View File

@ -169,7 +169,7 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Triangle, doc); VAbstractTool::AddRecord(id, Tool::Triangle, doc);
VToolTriangle *point = new VToolTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, VToolTriangle *point = new VToolTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId,
secondPointId, typeCreation); secondPointId, typeCreation);
scene->addItem(point); scene->addItem(point);

View File

@ -168,7 +168,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VDrawTool::AddRecord(id, Tool::Line, doc); VAbstractTool::AddRecord(id, Tool::Line, doc);
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, lineColor, typeCreation); VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, lineColor, typeCreation);
scene->addItem(line); scene->addItem(line);
InitDrawToolConnections(scene, line); InitDrawToolConnections(scene, line);
@ -189,7 +189,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VToolLine::getTagName() const QString VToolLine::getTagName() const
{ {
return VAbstractPattern::TagLine; return VDomDocument::TagLine;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -1065,7 +1065,7 @@ void VToolSeamAllowance::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Q_UNUSED(e); Q_UNUSED(e);
return;//Leave this method immediately!!! return;//Leave this method immediately!!!
} }
return; //Leave this method immediately after call!!! //Leave this method immediately after call!!!
} }
} }

View File

@ -1529,7 +1529,6 @@ void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
else else
{ {
qCCritical(vToolUnion, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling)); qCCritical(vToolUnion, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling));
return;
} }
} }

View File

@ -61,19 +61,16 @@ void AddDetNode::undo()
if (modeling.removeChild(domElement).isNull()) if (modeling.removeChild(domElement).isNull())
{ {
qCDebug(vUndo, "Can't delete node."); qCDebug(vUndo, "Can't delete node.");
return;
} }
} }
else else
{ {
qCDebug(vUndo, "Can't get node by id = %u.", nodeId); qCDebug(vUndo, "Can't get node by id = %u.", nodeId);
return;
} }
} }
else else
{ {
qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling)); qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling));
return;
} }
} }
@ -90,7 +87,6 @@ void AddDetNode::redo()
else else
{ {
qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling)); qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling));
return;
} }
} }

View File

@ -63,13 +63,12 @@ DeletePiece::DeletePiece(VAbstractPattern *doc, quint32 id, const VPiece &detail
else else
{ {
// Better save id of previous detail instead of reference to node. // Better save id of previous detail instead of reference to node.
m_siblingId = doc->GetParametrUInt(previousDetail.toElement(), VAbstractPattern::AttrId, NULL_ID_STR); m_siblingId = doc->GetParametrUInt(previousDetail.toElement(), VDomDocument::AttrId, NULL_ID_STR);
} }
} }
else else
{ {
qCDebug(vUndo, "Can't get detail by id = %u.", nodeId); qCDebug(vUndo, "Can't get detail by id = %u.", nodeId);
return;
} }
} }
@ -111,6 +110,5 @@ void DeletePiece::redo()
else else
{ {
qCDebug(vUndo, "Can't get detail by id = %u.", nodeId); qCDebug(vUndo, "Can't get detail by id = %u.", nodeId);
return;
} }
} }

View File

@ -77,7 +77,6 @@ MoveDoubleLabel::MoveDoubleLabel(VAbstractPattern *doc, const double &x, const d
else else
{ {
qCDebug(vUndo, "Can't find point with id = %u.", nodeId); qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
return;
} }
} }
@ -151,6 +150,5 @@ void MoveDoubleLabel::Do(double mx, double my)
else else
{ {
qCDebug(vUndo, "Can't find point with id = %u.", nodeId); qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
return;
} }
} }

View File

@ -56,7 +56,6 @@ MoveLabel::MoveLabel(VAbstractPattern *doc, const double &x, const double &y, co
else else
{ {
qCDebug(vUndo, "Can't find point with id = %u.", nodeId); qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
return;
} }
} }
@ -104,6 +103,5 @@ void MoveLabel::Do(double mx, double my)
else else
{ {
qCDebug(vUndo, "Can't find point with id = %u.", nodeId); qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
return;
} }
} }

View File

@ -62,7 +62,6 @@ OperationMoveLabel::OperationMoveLabel(quint32 idTool, VAbstractPattern *doc, do
else else
{ {
qCDebug(vUndo, "Can't find point with id = %u.", nodeId); qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
return;
} }
} }
@ -111,7 +110,6 @@ void OperationMoveLabel::Do(double mx, double my)
else else
{ {
qCDebug(vUndo, "Can't find point with id = %u.", nodeId); qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
return;
} }
} }
@ -126,7 +124,7 @@ QDomElement OperationMoveLabel::GetDestinationObject(quint32 idTool, quint32 idP
for (qint32 i = 0; i < nodeList.size(); ++i) for (qint32 i = 0; i < nodeList.size(); ++i)
{ {
const QDomElement dest = nodeList.at(i).toElement(); const QDomElement dest = nodeList.at(i).toElement();
if (not dest.isNull() && dest.isElement() && dest.tagName() == VToolRotation::TagDestination) if (not dest.isNull() && dest.isElement() && dest.tagName() == VAbstractOperation::TagDestination)
{ {
correctDest = dest; correctDest = dest;
break; break;

View File

@ -61,7 +61,6 @@ MovePiece::MovePiece(VAbstractPattern *doc, const double &x, const double &y, co
else else
{ {
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
} }
} }
@ -84,7 +83,6 @@ void MovePiece::undo()
else else
{ {
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
} }
} }
@ -111,7 +109,6 @@ void MovePiece::redo()
else else
{ {
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
} }
} }

View File

@ -116,6 +116,5 @@ void MoveSpline::Do(const VSpline &spl)
else else
{ {
qCDebug(vUndo, "Can't find spline with id = %u.", nodeId); qCDebug(vUndo, "Can't find spline with id = %u.", nodeId);
return;
} }
} }

View File

@ -110,6 +110,5 @@ void MoveSplinePath::Do(const VSplinePath &splPath)
else else
{ {
qCDebug(vUndo, "Can't find spline path with id = %u.", nodeId); qCDebug(vUndo, "Can't find spline path with id = %u.", nodeId);
return;
} }
} }

View File

@ -62,7 +62,6 @@ MoveSPoint::MoveSPoint(VAbstractPattern *doc, const double &x, const double &y,
else else
{ {
qCDebug(vUndo, "Can't find spoint with id = %u.", nodeId); qCDebug(vUndo, "Can't find spoint with id = %u.", nodeId);
return;
} }
} }
@ -131,6 +130,5 @@ void MoveSPoint::Do(double x, double y)
else else
{ {
qCDebug(vUndo, "Can't find spoint with id = %u.", nodeId); qCDebug(vUndo, "Can't find spoint with id = %u.", nodeId);
return;
} }
} }

View File

@ -86,7 +86,6 @@ void SavePieceOptions::undo()
else else
{ {
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
} }
} }
@ -118,7 +117,6 @@ void SavePieceOptions::redo()
else else
{ {
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
} }
} }

View File

@ -73,7 +73,6 @@ void SavePiecePathOptions::undo()
else else
{ {
qCDebug(vUndo, "Can't find path with id = %u.", nodeId); qCDebug(vUndo, "Can't find path with id = %u.", nodeId);
return;
} }
} }
@ -97,7 +96,6 @@ void SavePiecePathOptions::redo()
else else
{ {
qCDebug(vUndo, "Can't find path with id = %u.", nodeId); qCDebug(vUndo, "Can't find path with id = %u.", nodeId);
return;
} }
} }

View File

@ -63,7 +63,6 @@ void SaveToolOptions::undo()
else else
{ {
qCDebug(vUndo, "Can't find tool with id = %u.", nodeId); qCDebug(vUndo, "Can't find tool with id = %u.", nodeId);
return;
} }
} }
@ -82,7 +81,6 @@ void SaveToolOptions::redo()
else else
{ {
qCDebug(vUndo, "Can't find tool with id = %u.", nodeId); qCDebug(vUndo, "Can't find tool with id = %u.", nodeId);
return;
} }
} }

View File

@ -121,6 +121,5 @@ void TogglePieceInLayout::Do(bool state)
else else
{ {
qDebug("Can't get detail by id = %u.", m_id); qDebug("Can't get detail by id = %u.", m_id);
return;
} }
} }

View File

@ -75,11 +75,7 @@ void VisToolLineIntersect::RefreshGeometry()
DrawLine(line1, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor); DrawLine(line1, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor);
if (line2P1Id <= NULL_ID) if (line2P1Id > NULL_ID)
{
return;
}
else
{ {
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(line2P1Id); const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(line2P1Id);
DrawPoint(line2P1, static_cast<QPointF>(*third), supportColor); DrawPoint(line2P1, static_cast<QPointF>(*third), supportColor);

View File

@ -73,11 +73,7 @@ void VisToolPointOfContact::RefreshGeometry()
DrawPoint(lineP2, static_cast<QPointF>(*second), supportColor); DrawPoint(lineP2, static_cast<QPointF>(*second), supportColor);
DrawLine(this, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor); DrawLine(this, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor);
if (radiusId <= NULL_ID) if (radiusId > NULL_ID)
{
return;
}
else
{ {
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId); const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId);
DrawPoint(arc_point, static_cast<QPointF>(*third), supportColor); DrawPoint(arc_point, static_cast<QPointF>(*third), supportColor);

View File

@ -81,11 +81,7 @@ void VisToolTriangle::RefreshGeometry()
DrawAimedAxis(axis, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor); DrawAimedAxis(axis, QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)), supportColor);
if (hypotenuseP1Id <= NULL_ID) if (hypotenuseP1Id > NULL_ID)
{
return;
}
else
{ {
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(hypotenuseP1Id); const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(hypotenuseP1Id);
DrawPoint(hypotenuseP1, static_cast<QPointF>(*third), supportColor); DrawPoint(hypotenuseP1, static_cast<QPointF>(*third), supportColor);

View File

@ -345,7 +345,6 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME)
else else
{ {
pME->ignore(); pME->ignore();
return;
} }
} }
} }

View File

@ -213,7 +213,7 @@ bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event)
{ {
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event); QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event);
SCASSERT(wheel_event != nullptr) SCASSERT(wheel_event != nullptr)
if (QApplication::keyboardModifiers() == _modifiers) if (QGuiApplication::keyboardModifiers() == _modifiers)
{ {
if (wheel_event->orientation() == Qt::Vertical) if (wheel_event->orientation() == Qt::Vertical)
{ {
@ -225,7 +225,7 @@ bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event)
} }
else else
{ {
if (QApplication::keyboardModifiers() == Qt::ShiftModifier) if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{ {
return StartHorizontalScrollings(wheel_event); return StartHorizontalScrollings(wheel_event);
} }

View File

@ -453,7 +453,6 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
else else
{ {
pME->ignore(); pME->ignore();
return;
} }
} }
} }