diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index b38fe5a81..c463c78a9 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -889,6 +889,9 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail ArrowType eAT = static_cast(GetParametrUInt(domElement, AttrArrows, "0")); detail.GetGrainlineGeometry().SetArrowType(eAT); + const quint32 centerPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR); + detail.GetGrainlineGeometry().SetCenterPin(centerPin); + const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR); detail.GetGrainlineGeometry().SetTopPin(topPin); diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index 95b4fe6f2..1056de83e 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -26,6 +26,7 @@ schema/pattern/v0.4.0.xsd schema/pattern/v0.4.1.xsd schema/pattern/v0.4.2.xsd + schema/pattern/v0.4.3.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.4.3.xsd b/src/libs/ifc/schema/pattern/v0.4.3.xsd new file mode 100644 index 000000000..39205474a --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.4.3.xsd @@ -0,0 +1,861 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 4b8f40465..64fc3c4e6 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.2"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.2.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.3"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.3.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -202,6 +202,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000401): return QStringLiteral("://schema/pattern/v0.4.1.xsd"); case (0x000402): + return QStringLiteral("://schema/pattern/v0.4.2.xsd"); + case (0x000403): return CurrentSchema; default: InvalidVersion(ver); @@ -315,6 +317,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(0x000402), m_convertedFileName); V_FALLTHROUGH case (0x000402): + ToV0_4_3(); + ValidateXML(XSDSchema(0x000403), m_convertedFileName); + V_FALLTHROUGH + case (0x000403): break; default: InvalidVersion(m_ver); @@ -333,7 +339,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion() bool VPatternConverter::IsReadOnly() const { // Check if attribute readOnly was not changed in file format - Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 2), + Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 3), "Check attribute readOnly."); // Possibly in future attribute readOnly will change position etc. @@ -638,6 +644,17 @@ void VPatternConverter::ToV0_4_2() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_4_3() +{ + // TODO. Delete if minimal supported version is 0.4.3 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 3), + "Time to refactor the code."); + + SetVersion(QStringLiteral("0.4.3")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 82636f2b5..73310c676 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -55,10 +55,10 @@ public: // GCC 4.6 doesn't allow constexpr and const together #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406 static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 2); + static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 3); #else static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 2); + static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 3); #endif protected: @@ -103,6 +103,7 @@ private: void ToV0_4_0(); void ToV0_4_1(); void ToV0_4_2(); + void ToV0_4_3(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp index de189c075..a0ed3eecf 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp @@ -95,6 +95,18 @@ void VGrainlineData::SetArrowType(ArrowType eAT) d->m_eArrowType = eAT; } +//--------------------------------------------------------------------------------------------------------------------- +quint32 VGrainlineData::CenterPin() const +{ + return d->m_centerPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VGrainlineData::SetCenterPin(quint32 centerPin) +{ + d->m_centerPin = centerPin; +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VGrainlineData::TopPin() const { diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h index dc259bf0e..97c247a37 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h @@ -59,6 +59,9 @@ public: ArrowType GetArrowType() const; void SetArrowType(ArrowType eAT); + quint32 CenterPin() const; + void SetCenterPin(quint32 centerPin); + quint32 TopPin() const; void SetTopPin(quint32 topPin); diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h index cb85be652..5f336dfad 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h @@ -46,6 +46,7 @@ public: : m_qsLength(), m_dRotation(), m_eArrowType(ArrowType::atBoth), + m_centerPin(NULL_ID), m_topPin(NULL_ID), m_bottomPin(NULL_ID) {} @@ -55,6 +56,7 @@ public: m_qsLength(data.m_qsLength), m_dRotation(data.m_dRotation), m_eArrowType(data.m_eArrowType), + m_centerPin(data.m_centerPin), m_topPin(data.m_topPin), m_bottomPin(data.m_bottomPin) {} @@ -67,6 +69,8 @@ public: QString m_dRotation; /** @brief m_eArrowType type of arrow on the grainline */ ArrowType m_eArrowType; + /** @brief m_centerPin center pin id */ + quint32 m_centerPin; /** @brief m_topPin top pin id */ quint32 m_topPin; /** @brief m_bottomPin bottom pin id */ diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 01924a406..08c66d379 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -226,6 +226,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) ChangeCurrentData(ui->comboBoxPatternLabelBottomRightPin, m_oldGeom.BottomRightPin()); m_oldGrainline = piece.GetGrainlineGeometry(); + ChangeCurrentData(ui->comboBoxGrainlineCenterPin, m_oldGrainline.CenterPin()); ChangeCurrentData(ui->comboBoxGrainlineTopPin, m_oldGrainline.TopPin()); ChangeCurrentData(ui->comboBoxGrainlineBottomPin, m_oldGrainline.BottomPin()); @@ -1410,6 +1411,7 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); piece.GetGrainlineGeometry().SetArrowType(static_cast(ui->comboBoxArrow->currentIndex())); + piece.GetGrainlineGeometry().SetCenterPin(getCurrentObjectId(ui->comboBoxGrainlineCenterPin)); piece.GetGrainlineGeometry().SetTopPin(getCurrentObjectId(ui->comboBoxGrainlineTopPin)); piece.GetGrainlineGeometry().SetBottomPin(getCurrentObjectId(ui->comboBoxGrainlineBottomPin)); @@ -1882,6 +1884,7 @@ void DialogSeamAllowance::InitGrainlineTab() m_iRotBaseHeight = ui->lineEditRotFormula->height(); m_iLenBaseHeight = ui->lineEditLenFormula->height(); + InitPinPoint(ui->comboBoxGrainlineCenterPin); InitPinPoint(ui->comboBoxGrainlineTopPin); InitPinPoint(ui->comboBoxGrainlineBottomPin); diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui index d9637e9e7..3ed545f5e 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui @@ -1522,10 +1522,59 @@ - - - QFormLayout::ExpandingFieldsGrow + + + + + Center pin: + + + + + + + + + + + + Qt::Horizontal + + + + + + + + Top pin: + + + + + + + + + + Bottom pin: + + + + + + + + + + + + Qt::Horizontal + + + + + @@ -1542,26 +1591,6 @@ - - - - Top pin: - - - - - - - Bottom pin: - - - - - - - - - diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index f7576d5ab..369847097 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -62,7 +62,7 @@ #include #include -// Current version of seam allowance tag nned for backward compatibility +// Current version of seam allowance tag need for backward compatibility const quint8 VToolSeamAllowance::pieceVersion = 2; const QString VToolSeamAllowance::TagCSA = QStringLiteral("csa"); @@ -78,6 +78,7 @@ const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united"); const QString VToolSeamAllowance::AttrFont = QStringLiteral("fontSize"); const QString VToolSeamAllowance::AttrTopLeftPin = QStringLiteral("topLeftPin"); const QString VToolSeamAllowance::AttrBottomRightPin = QStringLiteral("bottomRightPin"); +const QString VToolSeamAllowance::AttrCenterPin = QStringLiteral("centerPin"); const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("topPin"); const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin"); @@ -338,6 +339,15 @@ void VToolSeamAllowance::AddGrainline(VAbstractPattern *doc, QDomElement &domEle doc->SetAttribute(domData, VAbstractPattern::AttrRotation, glGeom.GetRotation()); doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType())); + if (glGeom.CenterPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrCenterPin, glGeom.CenterPin()); + } + else + { + domData.removeAttribute(AttrCenterPin); + } + if (glGeom.TopPin() > NULL_ID) { doc->SetAttribute(domData, AttrTopPin, glGeom.TopPin()); diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index f402721dc..82b7c5498 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -68,6 +68,7 @@ public: static const QString AttrFont; static const QString AttrTopLeftPin; static const QString AttrBottomRightPin; + static const QString AttrCenterPin; static const QString AttrTopPin; static const QString AttrBottomPin;