Pattern label template placeholder with dimension label value. Closes #109
This commit is contained in:
parent
45649f5178
commit
95fb3f3d89
|
@ -1,5 +1,6 @@
|
|||
# Version 0.7.46 (unreleased)
|
||||
- Fix incorrect calculation of value for multisize measurements in Valentina.
|
||||
- [smart-pattern/valentina#109] Pattern label template placeholder with dimension label value.
|
||||
|
||||
# Version 0.7.45 Feb 26, 2021
|
||||
- Fix incorrect seam allowance for angle type second edge right angle.
|
||||
|
|
|
@ -1841,6 +1841,11 @@ void MainWindow::UnloadMeasurements()
|
|||
VAbstractValApplication::VApp()->SetDimensionHip(0);
|
||||
VAbstractValApplication::VApp()->SetDimensionWaist(0);
|
||||
|
||||
VAbstractValApplication::VApp()->SetDimensionHeightLabel(QString());
|
||||
VAbstractValApplication::VApp()->SetDimensionSizeLabel(QString());
|
||||
VAbstractValApplication::VApp()->SetDimensionHipLabel(QString());
|
||||
VAbstractValApplication::VApp()->SetDimensionWaistLabel(QString());
|
||||
|
||||
if (oldType == MeasurementsType::Multisize)
|
||||
{
|
||||
m_currentDimensionA = 0;
|
||||
|
@ -2067,16 +2072,21 @@ void MainWindow::StoreMultisizeMDimensions()
|
|||
if (dimensions.size() > index)
|
||||
{
|
||||
const MeasurementDimension_p& dimension = dimensions.at(index);
|
||||
const DimesionLabels labels = dimension->Labels();
|
||||
|
||||
switch(dimension->Type())
|
||||
{
|
||||
case MeasurementDimension::X:
|
||||
VAbstractValApplication::VApp()->SetDimensionHeight(currentBase);
|
||||
VAbstractValApplication::VApp()->SetDimensionHeightLabel(
|
||||
labels.value(currentBase, QString::number(currentBase)));
|
||||
break;
|
||||
case MeasurementDimension::Y:
|
||||
{
|
||||
const bool fc = m->IsFullCircumference();
|
||||
VAbstractValApplication::VApp()->SetDimensionSize(fc ? currentBase*2 : currentBase);
|
||||
VAbstractValApplication::VApp()->SetDimensionSizeLabel(
|
||||
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
||||
const bool circumference = dimension->IsCircumference();
|
||||
VAbstractValApplication::VApp()
|
||||
->SetDimensionSizeUnits(circumference ? m->MUnit() : Unit::LAST_UNIT_DO_NOT_USE);
|
||||
|
@ -2086,12 +2096,16 @@ void MainWindow::StoreMultisizeMDimensions()
|
|||
{
|
||||
const bool fc = m->IsFullCircumference();
|
||||
VAbstractValApplication::VApp()->SetDimensionWaist(fc ? currentBase*2 : currentBase);
|
||||
VAbstractValApplication::VApp()->SetDimensionWaistLabel(
|
||||
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
||||
break;
|
||||
}
|
||||
case MeasurementDimension::Z:
|
||||
{
|
||||
const bool fc = m->IsFullCircumference();
|
||||
VAbstractValApplication::VApp()->SetDimensionHip(fc ? currentBase*2 : currentBase);
|
||||
VAbstractValApplication::VApp()->SetDimensionHipLabel(
|
||||
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -2114,19 +2128,24 @@ void MainWindow::StoreIndividualMDimensions()
|
|||
{
|
||||
const QString name = VAbstractApplication::VApp()->TrVars()->VarToUser(m->MeasurementForDimension(type));
|
||||
const bool valid = not name.isEmpty() && measurements.contains(name);
|
||||
const qreal value = valid ? *measurements.value(name)->GetValue() : 0;
|
||||
switch(type)
|
||||
{
|
||||
case IMD::X:
|
||||
VAbstractValApplication::VApp()->SetDimensionHeight(valid ? *measurements.value(name)->GetValue() : 0);
|
||||
VAbstractValApplication::VApp()->SetDimensionHeight(value);
|
||||
VAbstractValApplication::VApp()->SetDimensionHeightLabel(QString::number(value));
|
||||
break;
|
||||
case IMD::Y:
|
||||
VAbstractValApplication::VApp()->SetDimensionSize(valid ? *measurements.value(name)->GetValue() : 0);
|
||||
VAbstractValApplication::VApp()->SetDimensionSize(value);
|
||||
VAbstractValApplication::VApp()->SetDimensionSizeLabel(QString::number(value));
|
||||
break;
|
||||
case IMD::W:
|
||||
VAbstractValApplication::VApp()->SetDimensionWaist(valid ? *measurements.value(name)->GetValue() : 0);
|
||||
VAbstractValApplication::VApp()->SetDimensionWaist(value);
|
||||
VAbstractValApplication::VApp()->SetDimensionWaistLabel(QString::number(value));
|
||||
break;
|
||||
case IMD::Z:
|
||||
VAbstractValApplication::VApp()->SetDimensionHip(valid ? *measurements.value(name)->GetValue() : 0);
|
||||
VAbstractValApplication::VApp()->SetDimensionHip(value);
|
||||
VAbstractValApplication::VApp()->SetDimensionHipLabel(QString::number(value));
|
||||
break;
|
||||
case IMD::N:
|
||||
default:
|
||||
|
|
|
@ -215,12 +215,34 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VC
|
|||
placeholders.insert(pl_pFileName, QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).baseName());
|
||||
placeholders.insert(pl_mFileName, QFileInfo(doc->MPath()).baseName());
|
||||
|
||||
placeholders.insert(pl_height, QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()));
|
||||
placeholders.insert(pl_size, QString::number(VAbstractValApplication::VApp()->GetDimensionSize()));
|
||||
placeholders.insert(pl_hip, QString::number(VAbstractValApplication::VApp()->GetDimensionHip()));
|
||||
placeholders.insert(pl_waist, QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()));
|
||||
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
||||
placeholders.insert(pl_height, heightValue);
|
||||
|
||||
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
|
||||
placeholders.insert(pl_size, sizeValue);
|
||||
|
||||
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
|
||||
placeholders.insert(pl_hip, hipValue);
|
||||
|
||||
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
|
||||
placeholders.insert(pl_waist, waistValue);
|
||||
|
||||
{
|
||||
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
||||
placeholders.insert(pl_heightLabel, not label.isEmpty() ? label : heightValue);
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
||||
placeholders.insert(pl_sizeLabel, not label.isEmpty() ? label : sizeValue);
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
||||
placeholders.insert(pl_hipLabel, not label.isEmpty() ? label : hipValue);
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
||||
placeholders.insert(pl_waistLabel, not label.isEmpty() ? label : waistValue);
|
||||
}
|
||||
|
||||
placeholders.insert(pl_mExt, VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
|
||||
? QString("vst") : QString("vit"));
|
||||
? QStringLiteral("vst") : QStringLiteral("vit"));
|
||||
|
||||
const QMap<int, QString> materials = doc->GetPatternMaterials();
|
||||
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
|
||||
|
@ -241,7 +263,6 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VC
|
|||
auto i = measurements.constBegin();
|
||||
while (i != measurements.constEnd())
|
||||
{
|
||||
QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText();
|
||||
placeholders.insert(pl_measurement + i.key(), QString::number(*i.value()->GetValue()));
|
||||
++i;
|
||||
}
|
||||
|
|
|
@ -138,6 +138,10 @@ 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_sizeLabel = QStringLiteral("sizeLabel");
|
||||
const QString pl_heightLabel = QStringLiteral("heightLabel");
|
||||
const QString pl_hipLabel = QStringLiteral("hipLabel");
|
||||
const QString pl_waistLabel = QStringLiteral("waistLabel");
|
||||
const QString pl_date = QStringLiteral("date");
|
||||
const QString pl_time = QStringLiteral("time");
|
||||
const QString pl_birthDate = QStringLiteral("birthDate");
|
||||
|
|
|
@ -406,6 +406,10 @@ extern const QString pl_size;
|
|||
extern const QString pl_height;
|
||||
extern const QString pl_hip;
|
||||
extern const QString pl_waist;
|
||||
extern const QString pl_sizeLabel;
|
||||
extern const QString pl_heightLabel;
|
||||
extern const QString pl_hipLabel;
|
||||
extern const QString pl_waistLabel;
|
||||
extern const QString pl_date;
|
||||
extern const QString pl_time;
|
||||
extern const QString pl_birthDate;
|
||||
|
|
|
@ -108,6 +108,18 @@ public:
|
|||
qreal GetDimensionWaist() const;
|
||||
void SetDimensionWaist(qreal dimensionWaist);
|
||||
|
||||
QString GetDimensionHeightLabel() const;
|
||||
void SetDimensionHeightLabel(const QString &label);
|
||||
|
||||
QString GetDimensionSizeLabel() const;
|
||||
void SetDimensionSizeLabel(const QString &label);
|
||||
|
||||
QString GetDimensionHipLabel() const;
|
||||
void SetDimensionHipLabel(const QString &label);
|
||||
|
||||
QString GetDimensionWaistLabel() const;
|
||||
void SetDimensionWaistLabel(const QString &label);
|
||||
|
||||
virtual void OpenSettings() override;
|
||||
VSettings *ValentinaSettings();
|
||||
|
||||
|
@ -132,6 +144,11 @@ protected:
|
|||
qreal m_dimensionHip{0};
|
||||
qreal m_dimensionWaist{0};
|
||||
|
||||
QString m_dimensionHeightLabel{};
|
||||
QString m_dimensionSizeLabel{};
|
||||
QString m_dimensionHipLabel{};
|
||||
QString m_dimensionWaistLabel{};
|
||||
|
||||
Unit m_dimensionSizeUnits{Unit::Cm};
|
||||
|
||||
/**
|
||||
|
@ -363,6 +380,54 @@ inline void VAbstractValApplication::SetDimensionWaist(qreal dimensionWaist)
|
|||
m_dimensionWaist = dimensionWaist;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::GetDimensionHeightLabel() const
|
||||
{
|
||||
return m_dimensionHeightLabel;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionHeightLabel(const QString &label)
|
||||
{
|
||||
m_dimensionHeightLabel = label;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::GetDimensionSizeLabel() const
|
||||
{
|
||||
return m_dimensionSizeLabel;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionSizeLabel(const QString &label)
|
||||
{
|
||||
m_dimensionSizeLabel = label;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::GetDimensionHipLabel() const
|
||||
{
|
||||
return m_dimensionHipLabel;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionHipLabel(const QString &label)
|
||||
{
|
||||
m_dimensionHipLabel = label;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::GetDimensionWaistLabel() const
|
||||
{
|
||||
return m_dimensionWaistLabel;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionWaistLabel(const QString &label)
|
||||
{
|
||||
m_dimensionWaistLabel = label;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QDate VAbstractValApplication::GetCustomerBirthDate() const
|
||||
{
|
||||
|
|
|
@ -535,18 +535,41 @@ void DialogEditLabel::InitPlaceholders()
|
|||
const QString measurementsFilePath = QFileInfo(m_doc->MPath()).baseName();
|
||||
m_placeholders.insert(pl_mFileName, qMakePair(tr("Measurments file name"), measurementsFilePath));
|
||||
|
||||
m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"),
|
||||
QString::number(VAbstractValApplication::VApp()->GetDimensionHeight())));
|
||||
m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"),
|
||||
QString::number(VAbstractValApplication::VApp()->GetDimensionSize())));
|
||||
m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"),
|
||||
QString::number(VAbstractValApplication::VApp()->GetDimensionHip())));
|
||||
m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"),
|
||||
QString::number(VAbstractValApplication::VApp()->GetDimensionWaist())));
|
||||
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
||||
m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
|
||||
|
||||
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
|
||||
m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue));
|
||||
|
||||
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
|
||||
m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue));
|
||||
|
||||
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
|
||||
m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue));
|
||||
|
||||
{
|
||||
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
||||
m_placeholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"),
|
||||
not label.isEmpty() ? label : heightValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
||||
m_placeholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"),
|
||||
not label.isEmpty() ? label : sizeValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
||||
m_placeholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"),
|
||||
not label.isEmpty() ? label : hipValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
||||
m_placeholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"),
|
||||
not label.isEmpty() ? label : waistValue));
|
||||
}
|
||||
|
||||
|
||||
m_placeholders.insert(pl_mExt,
|
||||
qMakePair(tr("Measurments extension"),
|
||||
VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
|
||||
? QString("vst") : QString("vit")));
|
||||
? QStringLiteral("vst") : QStringLiteral("vit")));
|
||||
|
||||
const QString materialDescription = tr("User material");
|
||||
const QMap<int, QString> materials = m_doc->GetPatternMaterials();
|
||||
|
|
Loading…
Reference in New Issue
Block a user