From f046624b368c1d3a95e39327daa3aa210259d618 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 19 May 2016 15:40:55 +0300 Subject: [PATCH] Clean a file. Tool Cut doesn't need color attribute anymore. --HG-- branch : feature --- src/libs/ifc/xml/vpatternconverter.cpp | 21 +++++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 961d1251c..5068702ef 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -318,6 +318,7 @@ void VPatternConverter::ToV0_3_0() void VPatternConverter::ToV0_3_1() { SetVersion(QStringLiteral("0.3.1")); + RemoveColorToolCutV0_3_1(); Save(); } @@ -782,6 +783,26 @@ void VPatternConverter::ConvertMeasurementsToV0_2_1() ConvertPathPointExpressionsToV0_2_0(names); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::RemoveColorToolCutV0_3_1() +{ + const QDomNodeList list = elementsByTagName("point"); + for (int i=0; i < list.size(); ++i) + { + QDomElement element = list.at(i).toElement(); + if (not element.isNull()) + { + const QString type = element.attribute(QStringLiteral("type")); + if (type == QStringLiteral("cutArc") || + type == QStringLiteral("cutSpline") || + type == QStringLiteral("cutSplinePath")) + { + element.removeAttribute(QStringLiteral("color")); + } + } + } +} + //--------------------------------------------------------------------------------------------------------------------- QString VPatternConverter::MUnitV0_1_4() const { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 96bdcd864..55be6f196 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -78,6 +78,8 @@ private: void ConvertMeasurementsToV0_2_1(); + void RemoveColorToolCutV0_3_1(); + QSet FixIncrementsToV0_2_0(); QString FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet &names); void FixPointExpressionsToV0_2_0(const QSet &names);