diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 34213dbee..0edf3d62b 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -893,16 +893,12 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail) { VPieceLabelData &ppData = detail.GetPatternPieceData(); ppData.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr)); - try - { - QString qsLetter = GetParametrString(domElement, AttrLetter, ""); - ppData.SetLetter(qsLetter); - } - catch(const VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - ppData.SetLetter(""); - } + ppData.SetLetter(GetParametrEmptyString(domElement, AttrLetter)); + ppData.SetAnnotation(GetParametrEmptyString(domElement, AttrAnnotation)); + ppData.SetOrientation(GetParametrEmptyString(domElement, AttrOrientation)); + ppData.SetRotation(GetParametrEmptyString(domElement, AttrRotation)); + ppData.SetTilt(GetParametrEmptyString(domElement, AttrTilt)); + ppData.SetFoldPosition(GetParametrEmptyString(domElement, AttrFoldPosition)); ppData.SetQuantity(static_cast(GetParametrUInt(domElement, AttrQuantity, "1"))); ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr)); ppData.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, "0"), GetParametrDouble(domElement, AttrMy, "0"))); diff --git a/src/libs/ifc/schema/pattern/v0.6.0.xsd b/src/libs/ifc/schema/pattern/v0.6.0.xsd index 1ecaeba30..9cb509919 100644 --- a/src/libs/ifc/schema/pattern/v0.6.0.xsd +++ b/src/libs/ifc/schema/pattern/v0.6.0.xsd @@ -516,6 +516,11 @@ + + + + + diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 2985fe318..cb35f9a39 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -98,6 +98,11 @@ const QString VAbstractPattern::AttrObject = QStringLiteral("object") const QString VAbstractPattern::AttrTool = QStringLiteral("tool"); const QString VAbstractPattern::AttrType = QStringLiteral("type"); const QString VAbstractPattern::AttrLetter = QStringLiteral("letter"); +const QString VAbstractPattern::AttrAnnotation = QStringLiteral("annotation"); +const QString VAbstractPattern::AttrOrientation = QStringLiteral("orientation"); +const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation"); +const QString VAbstractPattern::AttrTilt = QStringLiteral("tilt"); +const QString VAbstractPattern::AttrFoldPosition = QStringLiteral("foldPosition"); const QString VAbstractPattern::AttrQuantity = QStringLiteral("quantity"); const QString VAbstractPattern::AttrOnFold = QStringLiteral("onFold"); const QString VAbstractPattern::AttrDateFormat = QStringLiteral("dateFormat"); @@ -116,7 +121,6 @@ const QString VAbstractPattern::AttrPath = QStringLiteral("path"); const QString VAbstractPattern::AttrEnd = QStringLiteral("end"); const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeAs"); const QString VAbstractPattern::AttrWidth = QStringLiteral("width"); -const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation"); const QString VAbstractPattern::AttrAll = QStringLiteral("all"); diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 4e0a8da7e..7afa88722 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -228,6 +228,11 @@ public: static const QString AttrTool; static const QString AttrType; static const QString AttrLetter; + static const QString AttrAnnotation; + static const QString AttrOrientation; + static const QString AttrRotation; + static const QString AttrTilt; + static const QString AttrFoldPosition; static const QString AttrQuantity; static const QString AttrOnFold; static const QString AttrDateFormat; @@ -246,7 +251,6 @@ public: static const QString AttrEnd; static const QString AttrIncludeAs; static const QString AttrWidth; - static const QString AttrRotation; static const QString AttrAll; diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index 247a564cb..408b986fc 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -453,6 +453,21 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt return parameter; } +//--------------------------------------------------------------------------------------------------------------------- +QString VDomDocument::GetParametrEmptyString(const QDomElement &domElement, const QString &name) +{ + QString result; + try + { + result = GetParametrString(domElement, name, ""); + } + catch(const VExceptionEmptyParameter &) + { + // do nothing + } + return result; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief Returns the double value of the given attribute. diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h index 16c6437a9..b2a401e4a 100644 --- a/src/libs/ifc/xml/vdomdocument.h +++ b/src/libs/ifc/xml/vdomdocument.h @@ -108,6 +108,7 @@ public: static QString GetParametrString(const QDomElement& domElement, const QString &name, const QString &defValue = QString()); + static QString GetParametrEmptyString(const QDomElement& domElement, const QString &name); static qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue); static quint32 GetParametrId(const QDomElement& domElement); diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index 8ca64f1a2..6b104f91b 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -102,6 +102,11 @@ QMap PreparePlaceholders(const VAbstractPattern *doc) // Piece tags placeholders.insert(pl_pLetter, ""); + placeholders.insert(pl_pAnnotation, ""); + placeholders.insert(pl_pOrientation, ""); + placeholders.insert(pl_pRotation, ""); + placeholders.insert(pl_pTilt, ""); + placeholders.insert(pl_pFoldPosition, ""); placeholders.insert(pl_pName, ""); placeholders.insert(pl_pQuantity, ""); placeholders.insert(pl_wOnFold, ""); @@ -118,6 +123,11 @@ QMap PreparePlaceholders(const VAbstractPattern *doc) void InitPiecePlaceholders(QMap &placeholders, const QString &name, const VPieceLabelData& data) { placeholders[pl_pLetter] = data.GetLetter(); + placeholders[pl_pAnnotation] = data.GetAnnotation(); + placeholders[pl_pOrientation] = data.GetOrientation(); + placeholders[pl_pRotation] = data.GetRotation(); + placeholders[pl_pTilt] = data.GetTilt(); + placeholders[pl_pFoldPosition] = data.GetFoldPosition(); placeholders[pl_pName] = name; placeholders[pl_pQuantity] = QString::number(data.GetQuantity()); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 32fe7f6bf..e8f06e69e 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -122,6 +122,11 @@ const QString pl_pFileName = QStringLiteral("pFileName"); const QString pl_mFileName = QStringLiteral("mFileName"); const QString pl_mExt = QStringLiteral("mExt"); const QString pl_pLetter = QStringLiteral("pLetter"); +const QString pl_pAnnotation = QStringLiteral("pAnnotation"); +const QString pl_pOrientation = QStringLiteral("pOrientation"); +const QString pl_pRotation = QStringLiteral("pRotation"); +const QString pl_pTilt = QStringLiteral("pTilt"); +const QString pl_pFoldPosition = QStringLiteral("pFoldPosition"); const QString pl_pName = QStringLiteral("pName"); const QString pl_pQuantity = QStringLiteral("pQuantity"); const QString pl_mFabric = QStringLiteral("mFabric"); @@ -144,6 +149,11 @@ const QStringList labelTemplatePlaceholders = QStringList() << pl_size << pl_mFileName << pl_mExt << pl_pLetter + << pl_pAnnotation + << pl_pOrientation + << pl_pRotation + << pl_pTilt + << pl_pFoldPosition << pl_pName << pl_pQuantity << pl_mFabric diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 4cec58455..e39b6dcca 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -364,6 +364,11 @@ extern const QString pl_pFileName; extern const QString pl_mFileName; extern const QString pl_mExt; extern const QString pl_pLetter; +extern const QString pl_pAnnotation; +extern const QString pl_pOrientation; +extern const QString pl_pRotation; +extern const QString pl_pTilt; +extern const QString pl_pFoldPosition; extern const QString pl_pName; extern const QString pl_pQuantity; extern const QString pl_mFabric; diff --git a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp index 6b1d8da33..6b5da058d 100644 --- a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp @@ -77,6 +77,66 @@ void VPieceLabelData::SetLetter(const QString &qsLetter) d->m_qsLetter = qsLetter.left(3); } +//--------------------------------------------------------------------------------------------------------------------- +QString VPieceLabelData::GetAnnotation() const +{ + return d->m_annotation; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceLabelData::SetAnnotation(const QString &val) +{ + d->m_annotation = val; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VPieceLabelData::GetOrientation() const +{ + return d->m_orientation; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceLabelData::SetOrientation(const QString &val) +{ + d->m_orientation = val; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VPieceLabelData::GetRotation() const +{ + return d->m_rotation; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceLabelData::SetRotation(const QString &val) +{ + d->m_rotation = val; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VPieceLabelData::GetTilt() const +{ + return d->m_tilt; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceLabelData::SetTilt(const QString &val) +{ + d->m_tilt = val; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VPieceLabelData::GetFoldPosition() const +{ + return d->m_foldPosition; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceLabelData::SetFoldPosition(const QString &val) +{ + d->m_foldPosition = val; +} + //--------------------------------------------------------------------------------------------------------------------- int VPieceLabelData::GetQuantity() const { diff --git a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h index f79eb6b50..087184d30 100644 --- a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h @@ -63,6 +63,21 @@ public: QString GetLetter() const; void SetLetter(const QString &qsLetter); + QString GetAnnotation() const; + void SetAnnotation(const QString &val); + + QString GetOrientation() const; + void SetOrientation(const QString &val); + + QString GetRotation() const; + void SetRotation(const QString &val); + + QString GetTilt() const; + void SetTilt(const QString &val); + + QString GetFoldPosition() const; + void SetFoldPosition(const QString &val); + int GetQuantity() const; void SetQuantity(int val); diff --git a/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h b/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h index 62289856a..23ff02908 100644 --- a/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h @@ -46,6 +46,11 @@ class VPieceLabelDataPrivate : public QSharedData public: VPieceLabelDataPrivate() : m_qsLetter(), + m_annotation(), + m_orientation(), + m_rotation(), + m_tilt(), + m_foldPosition(), m_quantity(1), m_onFold(false), m_lines() @@ -54,6 +59,11 @@ public: VPieceLabelDataPrivate(const VPieceLabelDataPrivate &data) : QSharedData(data), m_qsLetter(data.m_qsLetter), + m_annotation(data.m_annotation), + m_orientation(data.m_orientation), + m_rotation(data.m_rotation), + m_tilt(data.m_tilt), + m_foldPosition(data.m_foldPosition), m_quantity(data.m_quantity), m_onFold(data.m_onFold), m_lines(data.m_lines) @@ -62,7 +72,12 @@ public: ~VPieceLabelDataPrivate() Q_DECL_EQ_DEFAULT; /** @brief m_qsLetter Detail letter (should be no more than 3 characters) */ - QString m_qsLetter; + QString m_qsLetter; + QString m_annotation; + QString m_orientation; + QString m_rotation; + QString m_tilt; + QString m_foldPosition; int m_quantity; bool m_onFold; diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp index 09a8737fc..a672e7e18 100644 --- a/src/libs/vpatterndb/vtranslatevars.cpp +++ b/src/libs/vpatterndb/vtranslatevars.cpp @@ -470,6 +470,11 @@ void VTranslateVars::InitPlaceholder() placeholders.insert(pl_mFileName, translate("VTranslateVars", "mFileName", "placeholder")); placeholders.insert(pl_mExt, translate("VTranslateVars", "mExt", "placeholder")); placeholders.insert(pl_pLetter, translate("VTranslateVars", "pLetter", "placeholder")); + placeholders.insert(pl_pAnnotation, translate("VTranslateVars", "pAnnotation", "placeholder")); + placeholders.insert(pl_pOrientation, translate("VTranslateVars", "pOrientation", "placeholder")); + placeholders.insert(pl_pRotation, translate("VTranslateVars", "pRotation", "placeholder")); + placeholders.insert(pl_pTilt, translate("VTranslateVars", "pTilt", "placeholder")); + placeholders.insert(pl_pFoldPosition, translate("VTranslateVars", "pFoldPosition", "placeholder")); placeholders.insert(pl_pName, translate("VTranslateVars", "pName", "placeholder")); placeholders.insert(pl_pQuantity, translate("VTranslateVars", "pQuantity", "placeholder")); placeholders.insert(pl_mFabric, translate("VTranslateVars", "mFabric", "placeholder")); diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index 9c7ea8cee..a7cadf1e4 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -506,6 +506,11 @@ void DialogEditLabel::InitPlaceholders() // Piece tags m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString(""))); + m_placeholders.insert(pl_pAnnotation, qMakePair(tr("Piece annotation"), QString(""))); + m_placeholders.insert(pl_pOrientation, qMakePair(tr("Piece orientation"), QString(""))); + m_placeholders.insert(pl_pRotation, qMakePair(tr("Piece rotation"), QString(""))); + m_placeholders.insert(pl_pTilt, qMakePair(tr("Piece tilt"), QString(""))); + m_placeholders.insert(pl_pFoldPosition, qMakePair(tr("Piece fold position"), QString(""))); m_placeholders.insert(pl_pName, qMakePair(tr("Piece name"), QString(""))); m_placeholders.insert(pl_pQuantity, qMakePair(tr("Quantity"), QString(""))); m_placeholders.insert(pl_mFabric, qMakePair(tr("Material: Fabric"), tr("Fabric"))); @@ -590,6 +595,11 @@ void DialogEditLabel::SetPiece(const VPiece &piece) { const VPieceLabelData& pieceData = piece.GetPatternPieceData(); m_placeholders[pl_pLetter].second = pieceData.GetLetter(); + m_placeholders[pl_pAnnotation].second = pieceData.GetAnnotation(); + m_placeholders[pl_pOrientation].second = pieceData.GetOrientation(); + m_placeholders[pl_pRotation].second = pieceData.GetRotation(); + m_placeholders[pl_pTilt].second = pieceData.GetTilt(); + m_placeholders[pl_pFoldPosition].second = pieceData.GetFoldPosition(); m_placeholders[pl_pName].second = piece.GetName(); m_placeholders[pl_pQuantity].second = QString::number(pieceData.GetQuantity()); if (pieceData.IsOnFold()) diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index be24b9e52..cdfb3186a 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -244,14 +244,19 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) m_mx = piece.GetMx(); m_my = piece.GetMy(); - uiTabLabels->lineEditLetter->setText(piece.GetPatternPieceData().GetLetter()); - uiTabLabels->spinBoxQuantity->setValue(piece.GetPatternPieceData().GetQuantity()); - uiTabLabels->checkBoxFold->setChecked(piece.GetPatternPieceData().IsOnFold()); - m_templateLines = piece.GetPatternPieceData().GetLabelTemplate(); + m_oldData = piece.GetPatternPieceData(); + uiTabLabels->lineEditLetter->setText(m_oldData.GetLetter()); + uiTabLabels->lineEditAnnotation->setText(m_oldData.GetAnnotation()); + uiTabLabels->lineEditOrientation->setText(m_oldData.GetOrientation()); + uiTabLabels->lineEditRotation->setText(m_oldData.GetRotation()); + uiTabLabels->lineEditTilt->setText(m_oldData.GetTilt()); + uiTabLabels->lineEditFoldPosition->setText(m_oldData.GetFoldPosition()); + uiTabLabels->spinBoxQuantity->setValue(m_oldData.GetQuantity()); + uiTabLabels->checkBoxFold->setChecked(m_oldData.IsOnFold()); + m_templateLines = m_oldData.GetLabelTemplate(); uiTabGrainline->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); - m_oldData = piece.GetPatternPieceData(); uiTabLabels->groupBoxDetailLabel->setChecked(m_oldData.IsVisible()); ChangeCurrentData(uiTabLabels->comboBoxDLCenterPin, m_oldData.CenterPin()); ChangeCurrentData(uiTabLabels->comboBoxDLTopLeftPin, m_oldData.TopLeftPin()); @@ -1971,6 +1976,11 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.SetMy(m_my); piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth); piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text()); + piece.GetPatternPieceData().SetAnnotation(uiTabLabels->lineEditAnnotation->text()); + piece.GetPatternPieceData().SetOrientation(uiTabLabels->lineEditOrientation->text()); + piece.GetPatternPieceData().SetRotation(uiTabLabels->lineEditRotation->text()); + piece.GetPatternPieceData().SetTilt(uiTabLabels->lineEditTilt->text()); + piece.GetPatternPieceData().SetFoldPosition(uiTabLabels->lineEditFoldPosition->text()); piece.GetPatternPieceData().SetQuantity(uiTabLabels->spinBoxQuantity->value()); piece.GetPatternPieceData().SetOnFold(uiTabLabels->checkBoxFold->isChecked()); piece.GetPatternPieceData().SetLabelTemplate(m_templateLines); @@ -2498,6 +2508,11 @@ void DialogSeamAllowance::InitPatternPieceDataTab() { uiTabLabels->lineEditName->setClearButtonEnabled(true); uiTabLabels->lineEditLetter->setClearButtonEnabled(true); + uiTabLabels->lineEditAnnotation->setClearButtonEnabled(true); + uiTabLabels->lineEditOrientation->setClearButtonEnabled(true); + uiTabLabels->lineEditRotation->setClearButtonEnabled(true); + uiTabLabels->lineEditTilt->setClearButtonEnabled(true); + uiTabLabels->lineEditFoldPosition->setClearButtonEnabled(true); connect(uiTabLabels->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged); connect(uiTabLabels->pushButtonEditPieceLabel, &QPushButton::clicked, this, &DialogSeamAllowance::EditLabel); diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui index 3681b96cf..3b247040d 100644 --- a/src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui @@ -157,6 +157,76 @@ + + + + Annotation: + + + + + + + A text field to add comments in + + + + + + + Orientation: + + + + + + + "Left"/"Right"/"Undefined" + + + + + + + Rotation: + + + + + + + "1-Way"/"2-Way"/"4-Way"/"Any" + + + + + + + Tilt: + + + + + + + "CW X"/"CCW X" + + + + + + + Fold position: + + + + + + + "Up/Down"/"Left/Right" + + + diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 1b37e0825..69c1b9368 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -302,6 +302,11 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement QDomElement domData = doc->createElement(VAbstractPattern::TagData); const VPieceLabelData& data = piece.GetPatternPieceData(); doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter()); + doc->SetAttribute(domData, VAbstractPattern::AttrAnnotation, data.GetAnnotation()); + doc->SetAttribute(domData, VAbstractPattern::AttrOrientation, data.GetOrientation()); + doc->SetAttribute(domData, VAbstractPattern::AttrRotation, data.GetRotation()); + doc->SetAttribute(domData, VAbstractPattern::AttrTilt, data.GetTilt()); + doc->SetAttribute(domData, VAbstractPattern::AttrFoldPosition, data.GetFoldPosition()); doc->SetAttribute(domData, VAbstractPattern::AttrQuantity, data.GetQuantity()); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible()); doc->SetAttribute(domData, VAbstractPattern::AttrOnFold, data.IsOnFold());