diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui index 66d7f956b..17175c597 100644 --- a/src/app/tape/tmainwindow.ui +++ b/src/app/tape/tmainwindow.ui @@ -14,7 +14,7 @@ - + :/tapeicon/64x64/logo.png:/tapeicon/64x64/logo.png @@ -47,11 +47,11 @@ - 0 + 1 - + :/tapeicon/16x16/measurement.png:/tapeicon/16x16/measurement.png @@ -457,7 +457,7 @@ ... - + :/tapeicon/24x24/fx.png:/tapeicon/24x24/fx.png @@ -649,7 +649,7 @@ - + :/tapeicon/16x16/info.png:/tapeicon/16x16/info.png @@ -1209,7 +1209,7 @@ false - + :/tapeicon/24x24/red_plus.png:/tapeicon/24x24/red_plus.png @@ -1224,7 +1224,7 @@ false - + :/tapeicon/24x24/orange_plus.png:/tapeicon/24x24/orange_plus.png @@ -1242,7 +1242,7 @@ false - + :/tapeicon/24x24/padlock_opened.png:/tapeicon/24x24/padlock_opened.png @@ -1350,7 +1350,7 @@ true - + :/tapeicon/24x24/mannequin.png:/tapeicon/24x24/mannequin.png @@ -1433,9 +1433,7 @@
vplaintextedit.h
- - - + actionMeasurementDiagram diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 15f173ae2..96af3e222 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -71,6 +71,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat setWindowFlags(Qt::Window); #endif + ui->lineEditCustomerEmail->setClearButtonEnabled(true); + SCASSERT(doc != nullptr) VSettings *settings = qApp->ValentinaSettings(); @@ -157,21 +159,29 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat ui->lineEditPatternNumber->setText(doc->GetPatternNumber()); ui->lineEditCompanyName->setText(doc->GetCompanyName()); + ui->lineEditCustomerName->setText(qApp->GetCustomerName()); + ui->lineEditCustomerEmail->setText(qApp->CustomerEmail()); + ui->dateEditCustomerBirthDate->setDate(qApp->GetCustomerBirthDate()); + if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { - ui->lineEditCustomerName->setText(qApp->GetCustomerName()); ui->lineEditCustomerName->setReadOnly(true); ui->lineEditCustomerName->setToolTip(tr("The customer name from individual measurements")); - } - else - { - ui->lineEditCustomerName->setText(doc->GetCustomerName()); + + ui->lineEditCustomerEmail->setReadOnly(true); + ui->lineEditCustomerEmail->setToolTip(tr("The customer email from individual measurements")); + + ui->dateEditCustomerBirthDate->setReadOnly(true); + ui->dateEditCustomerBirthDate->setToolTip(tr("The customer birth date from individual measurements")); } connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged); connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged); connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged); connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged); + connect(ui->lineEditCustomerEmail, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged); + connect(ui->dateEditCustomerBirthDate, &QDateEdit::editingFinished, this, + &DialogPatternProperties::LabelDataChanged); connect(ui->pushButtonEditPatternLabel, &QPushButton::clicked, this, &DialogPatternProperties::EditLabel); connect(ui->pushButtonPatternMaterials, &QPushButton::clicked, this, &DialogPatternProperties::ManagePatternMaterials); @@ -286,6 +296,8 @@ void DialogPatternProperties::SaveLabelData() if (qApp->GetMeasurementsType() != MeasurementsType::Individual) { doc->SetCustomerName(ui->lineEditCustomerName->text()); + doc->SetCustomerBirthDate(ui->dateEditCustomerBirthDate->date()); + doc->SetCustomerEmail(ui->lineEditCustomerEmail->text()); } doc->SetLabelDateFormat(ui->comboBoxDateFormat->currentText()); doc->SetLabelTimeFormat(ui->comboBoxTimeFormat->currentText()); diff --git a/src/app/valentina/dialogs/dialogpatternproperties.ui b/src/app/valentina/dialogs/dialogpatternproperties.ui index e2f52fcd0..54b2ccf74 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.ui +++ b/src/app/valentina/dialogs/dialogpatternproperties.ui @@ -7,7 +7,7 @@ 0 0 726 - 681 + 507
@@ -21,7 +21,7 @@ - 0 + 2 @@ -357,26 +357,50 @@
- + Date format: - + - + Time format: - + + + + + Customer birth date: + + + + + + + yyyy-MM-dd + + + + + + + Customer email: + + + + + +
@@ -417,7 +441,7 @@ 20 - 90 + 9000 @@ -487,7 +511,4 @@ - - - diff --git a/src/libs/ifc/schema/pattern/v0.8.8.xsd b/src/libs/ifc/schema/pattern/v0.8.8.xsd index dd0578f25..93ef3d153 100644 --- a/src/libs/ifc/schema/pattern/v0.8.8.xsd +++ b/src/libs/ifc/schema/pattern/v0.8.8.xsd @@ -21,6 +21,8 @@ + + diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 092adef5d..c12bf9233 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -87,6 +87,8 @@ const QString VAbstractPattern::TagPatternInfo = QStringLiteral("patternInf const QString VAbstractPattern::TagPatternName = QStringLiteral("patternName"); const QString VAbstractPattern::TagPatternNum = QStringLiteral("patternNumber"); const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer"); +const QString VAbstractPattern::TagCustomerBirthDate = QStringLiteral("birthDate"); +const QString VAbstractPattern::TagCustomerEmail = QStringLiteral("email"); const QString VAbstractPattern::TagCompanyName = QStringLiteral("company"); const QString VAbstractPattern::TagPatternLabel = QStringLiteral("patternLabel"); const QString VAbstractPattern::TagWatermark = QStringLiteral("watermark"); @@ -1000,6 +1002,38 @@ void VAbstractPattern::SetCustomerName(const QString& qsName) emit patternChanged(false); } +//--------------------------------------------------------------------------------------------------------------------- +QDate VAbstractPattern::GetCustomerBirthDate() const +{ + return QDate::fromString(UniqueTagText(TagCustomerBirthDate), "yyyy-MM-dd"); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractPattern::SetCustomerBirthDate(const QDate &date) +{ + CheckTagExists(TagCustomerBirthDate); + setTagText(TagCustomerBirthDate, date.toString("yyyy-MM-dd")); + patternLabelWasChanged = true; + modified = true; + emit patternChanged(false); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VAbstractPattern::GetCustomerEmail() const +{ + return UniqueTagText(TagCustomerEmail); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractPattern::SetCustomerEmail(const QString &email) +{ + CheckTagExists(TagCustomerEmail); + setTagText(TagCustomerEmail, email); + patternLabelWasChanged = true; + modified = true; + emit patternChanged(false); +} + //--------------------------------------------------------------------------------------------------------------------- QString VAbstractPattern::GetLabelDateFormat() const { @@ -1351,10 +1385,12 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag) TagPatternNum, // 5 TagCompanyName, // 6 TagCustomerName, // 7 - TagPatternLabel, // 8 - TagWatermark, // 9 - TagPatternMaterials, // 10 - TagFinalMeasurements // 11 + TagCustomerBirthDate, // 8 + TagCustomerEmail, // 9 + TagPatternLabel, // 10 + TagWatermark, // 11 + TagPatternMaterials, // 12 + TagFinalMeasurements // 13 }; switch (tags.indexOf(tag)) @@ -1380,16 +1416,22 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag) case 7: // TagCustomerName element = createElement(TagCustomerName); break; - case 8: // TagPatternLabel + case 8: // TagCustomerBirthDate + element = createElement(TagCustomerBirthDate); + break; + case 9: // TagCustomerEmail + element = createElement(TagCustomerEmail); + break; + case 10: // TagPatternLabel element = createElement(TagPatternLabel); break; - case 9: // TagWatermark + case 11: // TagWatermark element = createElement(TagWatermark); break; - case 10: // TagPatternMaterials + case 12: // TagPatternMaterials element = createElement(TagPatternMaterials); break; - case 11: // TagFinalMeasurements + case 13: // TagFinalMeasurements element = createElement(TagFinalMeasurements); break; case 0: //TagUnit (Mandatory tag) diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 2c0bd575a..7c008fe82 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -165,6 +165,12 @@ public: QString GetCustomerName() const; void SetCustomerName(const QString& qsName); + QDate GetCustomerBirthDate() const; + void SetCustomerBirthDate(const QDate& date); + + QString GetCustomerEmail() const; + void SetCustomerEmail(const QString& email); + QString GetLabelDateFormat() const; void SetLabelDateFormat(const QString &format); @@ -252,6 +258,8 @@ public: static const QString TagPatternNum; static const QString TagCompanyName; static const QString TagCustomerName; + static const QString TagCustomerBirthDate; + static const QString TagCustomerEmail; static const QString TagPatternLabel; static const QString TagWatermark; static const QString TagPatternMaterials; diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index c6ff72ff7..20718cab2 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -185,38 +185,39 @@ QMap PreparePlaceholders(const VAbstractPattern *doc) placeholders.insert(pl_patternNumber, doc->GetPatternNumber()); placeholders.insert(pl_author, doc->GetCompanyName()); + placeholders.insert(pl_mUnits, UnitsToStr(qApp->MeasurementsUnits(), true)); + placeholders.insert(pl_pUnits, UnitsToStr(qApp->patternUnits(), true)); + placeholders.insert(pl_mSizeUnits, UnitsToStr(qApp->DimensionSizeUnits(), true)); + if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { placeholders.insert(pl_customer, qApp->GetCustomerName()); + + const QString birthDate = locale.toString(qApp->GetCustomerBirthDate(), doc->GetLabelDateFormat()); + placeholders.insert(pl_birthDate, birthDate); + + placeholders.insert(pl_email, qApp->CustomerEmail()); } else { placeholders.insert(pl_customer, doc->GetCustomerName()); + + const QString birthDate = locale.toString(doc->GetCustomerBirthDate(), doc->GetLabelDateFormat()); + placeholders.insert(pl_birthDate, birthDate); + + placeholders.insert(pl_email, doc->GetCustomerEmail()); } placeholders.insert(pl_pExt, QStringLiteral("val")); placeholders.insert(pl_pFileName, QFileInfo(qApp->GetPatternPath()).baseName()); placeholders.insert(pl_mFileName, QFileInfo(doc->MPath()).baseName()); - QString curSize; - QString curHeight; - QString mExt; - if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) - { - curSize = QString::number(VContainer::size(valentinaNamespace)); - curHeight = QString::number(VContainer::height(valentinaNamespace)); - mExt = QStringLiteral("vst"); - } - else if (qApp->GetMeasurementsType() == MeasurementsType::Individual) - { - curSize = QString::number(VContainer::size(valentinaNamespace)); - curHeight = QString::number(VContainer::height(valentinaNamespace)); - mExt = QStringLiteral("vit"); - } - - placeholders.insert(pl_size, curSize); - placeholders.insert(pl_height, curHeight); - placeholders.insert(pl_mExt, mExt); + placeholders.insert(pl_height, QString::number(qApp->GetDimensionHeight())); + placeholders.insert(pl_size, QString::number(qApp->GetDimensionSize())); + placeholders.insert(pl_hip, QString::number(qApp->GetDimensionHip())); + placeholders.insert(pl_waist, QString::number(qApp->GetDimensionWaist())); + placeholders.insert(pl_mExt, qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst") + : QString("vit")); const QMap materials = doc->GetPatternMaterials(); for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i) diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 7584da3af..86ce79478 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -149,17 +149,24 @@ const QStringList builInFunctions = QStringList() << degTorad_F const QString pl_size = QStringLiteral("size"); const QString pl_height = QStringLiteral("height"); +const QString pl_hip = QStringLiteral("hip"); +const QString pl_waist = QStringLiteral("waist"); const QString pl_date = QStringLiteral("date"); const QString pl_time = QStringLiteral("time"); +const QString pl_birthDate = QStringLiteral("birthDate"); const QString pl_patternName = QStringLiteral("patternName"); const QString pl_patternNumber = QStringLiteral("patternNumber"); const QString pl_author = QStringLiteral("author"); const QString pl_customer = QStringLiteral("customer"); +const QString pl_email = QStringLiteral("email"); const QString pl_userMaterial = QStringLiteral("userMaterial"); const QString pl_pExt = QStringLiteral("pExt"); +const QString pl_pUnits = QStringLiteral("pUnits"); const QString pl_pFileName = QStringLiteral("pFileName"); const QString pl_mFileName = QStringLiteral("mFileName"); const QString pl_mExt = QStringLiteral("mExt"); +const QString pl_mUnits = QStringLiteral("mUnits"); +const QString pl_mSizeUnits = QStringLiteral("mSizeUnits"); const QString pl_pLetter = QStringLiteral("pLetter"); const QString pl_pAnnotation = QStringLiteral("pAnnotation"); const QString pl_pOrientation = QStringLiteral("pOrientation"); @@ -639,6 +646,8 @@ QString UnitsToStr(const Unit &unit, const bool translate) case Unit::Px: translate ? result = QObject::tr("px") : result = unitPX; break; + case Unit::LAST_UNIT_DO_NOT_USE: + break; case Unit::Cm: default: translate ? result = QObject::tr("cm") : result = unitCM; diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index e6ab5cadb..435372453 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -403,17 +403,24 @@ extern const QStringList builInFunctions; // Placeholders extern const QString pl_size; extern const QString pl_height; +extern const QString pl_hip; +extern const QString pl_waist; extern const QString pl_date; extern const QString pl_time; +extern const QString pl_birthDate; extern const QString pl_patternName; extern const QString pl_patternNumber; extern const QString pl_author; extern const QString pl_customer; +extern const QString pl_email; extern const QString pl_userMaterial; extern const QString pl_pExt; +extern const QString pl_pUnits; extern const QString pl_pFileName; extern const QString pl_mFileName; extern const QString pl_mExt; +extern const QString pl_mUnits; +extern const QString pl_mSizeUnits; extern const QString pl_pLetter; extern const QString pl_pAnnotation; extern const QString pl_pOrientation; diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index d31ccd589..a4b76093f 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -500,13 +500,27 @@ void DialogEditLabel::InitPlaceholders() m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber())); m_placeholders.insert(pl_author, qMakePair(tr("Company name or designer name"), m_doc->GetCompanyName())); + m_placeholders.insert(pl_mUnits, qMakePair(tr("Measurements units"), UnitsToStr(qApp->MeasurementsUnits(), true))); + m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"), UnitsToStr(qApp->patternUnits(), true))); + m_placeholders.insert(pl_mSizeUnits, qMakePair(tr("Size units"), UnitsToStr(qApp->DimensionSizeUnits(), true))); + if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), qApp->GetCustomerName())); + + const QString birthDate = locale.toString(qApp->GetCustomerBirthDate(), m_doc->GetLabelDateFormat()); + m_placeholders.insert(pl_birthDate, qMakePair(tr("Customer birth date"), birthDate)); + + m_placeholders.insert(pl_email, qMakePair(tr("Customer email"), qApp->CustomerEmail())); } else { m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), m_doc->GetCustomerName())); + + const QString birthDate = locale.toString(m_doc->GetCustomerBirthDate(), m_doc->GetLabelDateFormat()); + m_placeholders.insert(pl_birthDate, qMakePair(tr("Customer birth date"), birthDate)); + + m_placeholders.insert(pl_email, qMakePair(tr("Customer email"), m_doc->GetCustomerEmail())); } m_placeholders.insert(pl_pExt, qMakePair(tr("Pattern extension"), QString("val"))); @@ -517,25 +531,14 @@ void DialogEditLabel::InitPlaceholders() const QString measurementsFilePath = QFileInfo(m_doc->MPath()).baseName(); m_placeholders.insert(pl_mFileName, qMakePair(tr("Measurments file name"), measurementsFilePath)); - QString curSize; - QString curHeight; - QString mExt; - if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) - { - curSize = QString::number(VContainer::size(valentinaNamespace)); - curHeight = QString::number(VContainer::height(valentinaNamespace)); - mExt = "vst"; - } - else if (qApp->GetMeasurementsType() == MeasurementsType::Individual) - { - curSize = QString::number(VContainer::size(valentinaNamespace)); - curHeight = QString::number(VContainer::height(valentinaNamespace)); - mExt = "vit"; - } - - m_placeholders.insert(pl_size, qMakePair(tr("Size"), curSize)); - m_placeholders.insert(pl_height, qMakePair(tr("Height"), curHeight)); - m_placeholders.insert(pl_mExt, qMakePair(tr("Measurments extension"), mExt)); + m_placeholders.insert(pl_height, qMakePair(tr("Height"), QString::number(qApp->GetDimensionHeight()))); + m_placeholders.insert(pl_size, qMakePair(tr("Size"), QString::number(qApp->GetDimensionSize()))); + m_placeholders.insert(pl_hip, qMakePair(tr("Hip"), QString::number(qApp->GetDimensionHip()))); + m_placeholders.insert(pl_waist, qMakePair(tr("Waist"), QString::number(qApp->GetDimensionWaist()))); + m_placeholders.insert(pl_mExt, + qMakePair(tr("Measurments extension"), + qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst") + : QString("vit"))); const QString materialDescription = tr("User material"); const QMap materials = m_doc->GetPatternMaterials();