Fix Setup multisize measurements dialog. Improved handling Height dimension.
This commit is contained in:
parent
be430f8c7e
commit
672278209d
|
@ -10,6 +10,7 @@
|
||||||
- Fix warning while segmenting flipped arc.
|
- Fix warning while segmenting flipped arc.
|
||||||
- Tape app. "Export from existing ..." now supports multisize measurements.
|
- Tape app. "Export from existing ..." now supports multisize measurements.
|
||||||
- Fix main path validation. False positive double curve.
|
- Fix main path validation. False positive double curve.
|
||||||
|
- Fix Setup multisize measurements dialog. Improved handling Height dimension.
|
||||||
|
|
||||||
# Valentina 0.7.51 April 18, 2022
|
# Valentina 0.7.51 April 18, 2022
|
||||||
- Z value change for a layout piece.
|
- Z value change for a layout piece.
|
||||||
|
|
|
@ -205,7 +205,7 @@ auto DialogDimensionLabels::DimensionValue(const MeasurementDimension_p &dimensi
|
||||||
|
|
||||||
if (dimension->Type() == MeasurementDimension::Y)
|
if (dimension->Type() == MeasurementDimension::Y)
|
||||||
{
|
{
|
||||||
if (dimension->IsCircumference())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
return QString::number(m_fullCircumference ? value*2 : value);
|
return QString::number(m_fullCircumference ? value*2 : value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -756,7 +756,7 @@ void DialogRestrictDimension::FillBases(const QVector<qreal> &bases, const Measu
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dimension->IsCircumference())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
control->addItem(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
|
control->addItem(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ void DialogRestrictDimension::FillBases(const QVector<qreal> &bases, const Measu
|
||||||
auto DialogRestrictDimension::DimensionLabels(const QVector<qreal> &bases,
|
auto DialogRestrictDimension::DimensionLabels(const QVector<qreal> &bases,
|
||||||
const MeasurementDimension_p &dimension) const -> QStringList
|
const MeasurementDimension_p &dimension) const -> QStringList
|
||||||
{
|
{
|
||||||
const bool showUnits = dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X;
|
const bool showUnits = dimension->IsBodyMeasurement() || dimension->Type() == MeasurementDimension::X;
|
||||||
const QString units = showUnits ? UnitsToStr(dimension->Units(), true) : QString();
|
const QString units = showUnits ? UnitsToStr(dimension->Units(), true) : QString();
|
||||||
const DimesionLabels dimensionLabels = dimension->Labels();
|
const DimesionLabels dimensionLabels = dimension->Labels();
|
||||||
|
|
||||||
|
@ -817,7 +817,7 @@ auto DialogRestrictDimension::DimensionLabels(const QVector<qreal> &bases,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dimension->IsCircumference())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
labels.append(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units));
|
labels.append(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units));
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,14 +166,14 @@ DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) :
|
||||||
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged,
|
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged,
|
||||||
this, &DialogSetupMultisize::ShowFullCircumference);
|
this, &DialogSetupMultisize::ShowFullCircumference);
|
||||||
|
|
||||||
connect(ui->checkBoxXDimensionCircumference, &QCheckBox::stateChanged,
|
connect(ui->checkBoxXDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||||
this, &DialogSetupMultisize::XDimensionCircumferenceChanged);
|
this, &DialogSetupMultisize::XDimensionBodyMeasurementChanged);
|
||||||
connect(ui->checkBoxYDimensionCircumference, &QCheckBox::stateChanged,
|
connect(ui->checkBoxYDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||||
this, &DialogSetupMultisize::YDimensionCircumferenceChanged);
|
this, &DialogSetupMultisize::YDimensionBodyMeasurementChanged);
|
||||||
connect(ui->checkBoxWDimensionCircumference, &QCheckBox::stateChanged,
|
connect(ui->checkBoxWDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||||
this, &DialogSetupMultisize::WDimensionCircumferenceChanged);
|
this, &DialogSetupMultisize::WDimensionBodyMeasurementChanged);
|
||||||
connect(ui->checkBoxZDimensionCircumference, &QCheckBox::stateChanged,
|
connect(ui->checkBoxZDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||||
this, &DialogSetupMultisize::ZDimensionCircumferenceChanged);
|
this, &DialogSetupMultisize::ZDimensionBodyMeasurementChanged);
|
||||||
|
|
||||||
connect(ui->lineEditCustomXDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
|
connect(ui->lineEditCustomXDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
|
||||||
{
|
{
|
||||||
|
@ -307,8 +307,6 @@ void DialogSetupMultisize::ShowFullCircumference()
|
||||||
comboBoxBase->blockSignals(false);
|
comboBoxBase->blockSignals(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
ShowDimensionFullCircumference(ui->doubleSpinBoxXDimensionMinValue, ui->doubleSpinBoxXDimensionMaxValue,
|
|
||||||
ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension);
|
|
||||||
ShowDimensionFullCircumference(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue,
|
ShowDimensionFullCircumference(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue,
|
||||||
ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
||||||
ShowDimensionFullCircumference(ui->doubleSpinBoxWDimensionMinValue, ui->doubleSpinBoxWDimensionMaxValue,
|
ShowDimensionFullCircumference(ui->doubleSpinBoxWDimensionMinValue, ui->doubleSpinBoxWDimensionMaxValue,
|
||||||
|
@ -320,16 +318,10 @@ void DialogSetupMultisize::ShowFullCircumference()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSetupMultisize::XDimensionCircumferenceChanged()
|
void DialogSetupMultisize::XDimensionBodyMeasurementChanged()
|
||||||
{
|
{
|
||||||
bool checked = ui->checkBoxXDimensionCircumference->isChecked();
|
bool checked = ui->checkBoxXDimensionBodyMeasurement->isChecked();
|
||||||
m_xDimension->SetCircumference(checked);
|
m_xDimension->SetBodyMeasurement(checked);
|
||||||
|
|
||||||
const bool c = m_xDimension->IsCircumference();
|
|
||||||
const QString unitStr = c ? " " + UnitsToStr(m_xDimension->Units()) : QString();
|
|
||||||
|
|
||||||
ui->doubleSpinBoxXDimensionMinValue->setSuffix(unitStr);
|
|
||||||
ui->doubleSpinBoxXDimensionMaxValue->setSuffix(unitStr);
|
|
||||||
|
|
||||||
InitDimension(ui->doubleSpinBoxXDimensionMinValue, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
InitDimension(ui->doubleSpinBoxXDimensionMinValue, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
||||||
m_xDimension);
|
m_xDimension);
|
||||||
|
@ -348,16 +340,10 @@ void DialogSetupMultisize::XDimensionCircumferenceChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSetupMultisize::YDimensionCircumferenceChanged()
|
void DialogSetupMultisize::YDimensionBodyMeasurementChanged()
|
||||||
{
|
{
|
||||||
bool checked = ui->checkBoxYDimensionCircumference->isChecked();
|
bool checked = ui->checkBoxYDimensionBodyMeasurement->isChecked();
|
||||||
m_yDimension->SetCircumference(checked);
|
m_yDimension->SetBodyMeasurement(checked);
|
||||||
|
|
||||||
const bool c = m_yDimension->IsCircumference();
|
|
||||||
const QString unitStr = c ? " " + UnitsToStr(m_yDimension->Units()) : QString();
|
|
||||||
|
|
||||||
ui->doubleSpinBoxYDimensionMinValue->setSuffix(unitStr);
|
|
||||||
ui->doubleSpinBoxYDimensionMaxValue->setSuffix(unitStr);
|
|
||||||
|
|
||||||
InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||||
m_yDimension);
|
m_yDimension);
|
||||||
|
@ -376,16 +362,10 @@ void DialogSetupMultisize::YDimensionCircumferenceChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSetupMultisize::WDimensionCircumferenceChanged()
|
void DialogSetupMultisize::WDimensionBodyMeasurementChanged()
|
||||||
{
|
{
|
||||||
bool checked = ui->checkBoxWDimensionCircumference->isChecked();
|
bool checked = ui->checkBoxWDimensionBodyMeasurement->isChecked();
|
||||||
m_wDimension->SetCircumference(checked);
|
m_wDimension->SetBodyMeasurement(checked);
|
||||||
|
|
||||||
const bool c = m_wDimension->IsCircumference();
|
|
||||||
const QString unitStr = c ? " " + UnitsToStr(m_wDimension->Units()) : QString();
|
|
||||||
|
|
||||||
ui->doubleSpinBoxWDimensionMinValue->setSuffix(unitStr);
|
|
||||||
ui->doubleSpinBoxWDimensionMaxValue->setSuffix(unitStr);
|
|
||||||
|
|
||||||
InitDimension(ui->doubleSpinBoxWDimensionMinValue, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
InitDimension(ui->doubleSpinBoxWDimensionMinValue, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
||||||
m_wDimension);
|
m_wDimension);
|
||||||
|
@ -404,16 +384,10 @@ void DialogSetupMultisize::WDimensionCircumferenceChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSetupMultisize::ZDimensionCircumferenceChanged()
|
void DialogSetupMultisize::ZDimensionBodyMeasurementChanged()
|
||||||
{
|
{
|
||||||
bool checked = ui->checkBoxZDimensionCircumference->isChecked();
|
bool checked = ui->checkBoxZDimensionBodyMeasurement->isChecked();
|
||||||
m_zDimension->SetCircumference(checked);
|
m_zDimension->SetBodyMeasurement(checked);
|
||||||
|
|
||||||
const bool c = m_zDimension->IsCircumference();
|
|
||||||
const QString unitStr = c ? " " + UnitsToStr(m_zDimension->Units()) : QString();
|
|
||||||
|
|
||||||
ui->doubleSpinBoxZDimensionMinValue->setSuffix(unitStr);
|
|
||||||
ui->doubleSpinBoxZDimensionMaxValue->setSuffix(unitStr);
|
|
||||||
|
|
||||||
InitDimension(ui->doubleSpinBoxZDimensionMinValue, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
InitDimension(ui->doubleSpinBoxZDimensionMinValue, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
||||||
m_zDimension);
|
m_zDimension);
|
||||||
|
@ -513,33 +487,25 @@ void DialogSetupMultisize::InitDimensionMinMax(QDoubleSpinBox *doubleSpinBoxMinV
|
||||||
dimension->SetMinValue(dimension->RangeMin());
|
dimension->SetMinValue(dimension->RangeMin());
|
||||||
dimension->SetMaxValue(dimension->RangeMax());
|
dimension->SetMaxValue(dimension->RangeMax());
|
||||||
|
|
||||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
const bool fc = dimension->Type() != MeasurementDimension::X ? ui->checkBoxFullCircumference->isChecked() : false;
|
||||||
const bool c = dimension->IsCircumference();
|
const bool m = dimension->IsBodyMeasurement();
|
||||||
|
const QString unitStr = m ? " " + UnitsToStr(m_xDimension->Units()) : QString();
|
||||||
|
|
||||||
doubleSpinBoxMinValue->blockSignals(true);
|
doubleSpinBoxMinValue->blockSignals(true);
|
||||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
doubleSpinBoxMinValue->setSuffix(unitStr);
|
||||||
if (c || dimension->Type() == MeasurementDimension::X)
|
|
||||||
{
|
|
||||||
doubleSpinBoxMinValue->setSuffix(unitStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
doubleSpinBoxMinValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
|
doubleSpinBoxMinValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
|
||||||
doubleSpinBoxMinValue->setMinimum(c && fc ? dimension->RangeMin()*2 : dimension->RangeMin());
|
doubleSpinBoxMinValue->setMinimum(m && fc ? dimension->RangeMin()*2 : dimension->RangeMin());
|
||||||
doubleSpinBoxMinValue->setMaximum(c && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
doubleSpinBoxMinValue->setMaximum(m && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||||
doubleSpinBoxMinValue->setValue(c && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
doubleSpinBoxMinValue->setValue(m && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||||
doubleSpinBoxMinValue->blockSignals(false);
|
doubleSpinBoxMinValue->blockSignals(false);
|
||||||
|
|
||||||
doubleSpinBoxMaxValue->blockSignals(true);
|
doubleSpinBoxMaxValue->blockSignals(true);
|
||||||
if (c || dimension->Type() == MeasurementDimension::X)
|
doubleSpinBoxMaxValue->setSuffix(unitStr);
|
||||||
{
|
|
||||||
doubleSpinBoxMaxValue->setSuffix(unitStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
doubleSpinBoxMaxValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
|
doubleSpinBoxMaxValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
|
||||||
doubleSpinBoxMaxValue->setMinimum(c && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
doubleSpinBoxMaxValue->setMinimum(m && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||||
doubleSpinBoxMaxValue->setMaximum(c && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
doubleSpinBoxMaxValue->setMaximum(m && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||||
doubleSpinBoxMaxValue->setValue(c && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||||
doubleSpinBoxMaxValue->setValue(c && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||||
doubleSpinBoxMaxValue->blockSignals(false);
|
doubleSpinBoxMaxValue->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,9 +515,9 @@ void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
|
||||||
{
|
{
|
||||||
SCASSERT(comboBoxStep != nullptr)
|
SCASSERT(comboBoxStep != nullptr)
|
||||||
|
|
||||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
const bool fc = dimension->Type() != MeasurementDimension::X ? ui->checkBoxFullCircumference->isChecked() : false;
|
||||||
const bool c = dimension->IsCircumference();
|
const bool m = dimension->IsBodyMeasurement();
|
||||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
|
||||||
|
|
||||||
dimension->SetStep(-1);
|
dimension->SetStep(-1);
|
||||||
|
|
||||||
|
@ -560,8 +526,7 @@ void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
|
||||||
comboBoxStep->clear();
|
comboBoxStep->clear();
|
||||||
for(auto step : steps)
|
for(auto step : steps)
|
||||||
{
|
{
|
||||||
comboBoxStep->addItem(QStringLiteral("%1%2").arg(c && fc ? step*2 : step)
|
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step*2 : step).arg(unitStr), step);
|
||||||
.arg(c || dimension->Type() == MeasurementDimension::X ? unitStr : QString()), step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
comboBoxStep->setCurrentIndex(-1); // force a user to select
|
comboBoxStep->setCurrentIndex(-1); // force a user to select
|
||||||
|
@ -621,16 +586,16 @@ void DialogSetupMultisize::DimensionMinValueChanged(qreal value, QDoubleSpinBox
|
||||||
SCASSERT(comboBoxStep != nullptr)
|
SCASSERT(comboBoxStep != nullptr)
|
||||||
SCASSERT(comboBoxBase != nullptr)
|
SCASSERT(comboBoxBase != nullptr)
|
||||||
|
|
||||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
const bool fc = dimension->Type() != MeasurementDimension::X ? ui->checkBoxFullCircumference->isChecked() : false;
|
||||||
const bool c = dimension->IsCircumference();
|
const bool m = dimension->IsBodyMeasurement();
|
||||||
|
|
||||||
dimension->SetMinValue(c && fc ? value / 2 : value);
|
dimension->SetMinValue(m && fc ? value / 2 : value);
|
||||||
|
|
||||||
doubleSpinBoxMaxValue->blockSignals(true);
|
doubleSpinBoxMaxValue->blockSignals(true);
|
||||||
doubleSpinBoxMaxValue->setMinimum(value);
|
doubleSpinBoxMaxValue->setMinimum(value);
|
||||||
doubleSpinBoxMaxValue->blockSignals(false);
|
doubleSpinBoxMaxValue->blockSignals(false);
|
||||||
|
|
||||||
dimension->SetMaxValue(c && fc ? doubleSpinBoxMaxValue->value() / 2 : doubleSpinBoxMaxValue->value());
|
dimension->SetMaxValue(m && fc ? doubleSpinBoxMaxValue->value() / 2 : doubleSpinBoxMaxValue->value());
|
||||||
|
|
||||||
UpdateSteps(comboBoxStep, dimension);
|
UpdateSteps(comboBoxStep, dimension);
|
||||||
UpdateBase(comboBoxBase, dimension);
|
UpdateBase(comboBoxBase, dimension);
|
||||||
|
@ -647,16 +612,16 @@ void DialogSetupMultisize::DimensionMaxValueChanged(qreal value, QDoubleSpinBox
|
||||||
SCASSERT(comboBoxStep != nullptr)
|
SCASSERT(comboBoxStep != nullptr)
|
||||||
SCASSERT(comboBoxBase != nullptr)
|
SCASSERT(comboBoxBase != nullptr)
|
||||||
|
|
||||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
const bool fc = dimension->Type() != MeasurementDimension::X ? ui->checkBoxFullCircumference->isChecked() : false;
|
||||||
const bool c = dimension->IsCircumference();
|
const bool m = dimension->IsBodyMeasurement();
|
||||||
|
|
||||||
dimension->SetMaxValue(c && fc ? value / 2 : value);
|
dimension->SetMaxValue(m && fc ? value / 2 : value);
|
||||||
|
|
||||||
doubleSpinBoxMinValue->blockSignals(true);
|
doubleSpinBoxMinValue->blockSignals(true);
|
||||||
doubleSpinBoxMinValue->setMaximum(value);
|
doubleSpinBoxMinValue->setMaximum(value);
|
||||||
doubleSpinBoxMinValue->blockSignals(false);
|
doubleSpinBoxMinValue->blockSignals(false);
|
||||||
|
|
||||||
dimension->SetMinValue(c && fc ? doubleSpinBoxMinValue->value() / 2 : doubleSpinBoxMinValue->value());
|
dimension->SetMinValue(m && fc ? doubleSpinBoxMinValue->value() / 2 : doubleSpinBoxMinValue->value());
|
||||||
|
|
||||||
UpdateSteps(comboBoxStep, dimension);
|
UpdateSteps(comboBoxStep, dimension);
|
||||||
UpdateBase(comboBoxBase, dimension);
|
UpdateBase(comboBoxBase, dimension);
|
||||||
|
@ -707,17 +672,16 @@ void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
|
||||||
|
|
||||||
comboBoxStep->blockSignals(true);
|
comboBoxStep->blockSignals(true);
|
||||||
|
|
||||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
|
||||||
const QVector<qreal> steps = dimension->ValidSteps();
|
const QVector<qreal> steps = dimension->ValidSteps();
|
||||||
comboBoxStep->clear();
|
comboBoxStep->clear();
|
||||||
|
|
||||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
const bool fc = dimension->Type() != MeasurementDimension::X ? ui->checkBoxFullCircumference->isChecked() : false;
|
||||||
const bool c = dimension->IsCircumference();
|
const bool m = dimension->IsBodyMeasurement();
|
||||||
|
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
|
||||||
|
|
||||||
for(auto step : steps)
|
for(auto step : steps)
|
||||||
{
|
{
|
||||||
comboBoxStep->addItem(QStringLiteral("%1%2").arg(c && fc ? step * 2 : step)
|
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step * 2 : step).arg(unitStr), step);
|
||||||
.arg(c ? unitStr : QString()), step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
comboBoxStep->setCurrentIndex(comboBoxStep->findData(oldStep));
|
comboBoxStep->setCurrentIndex(comboBoxStep->findData(oldStep));
|
||||||
|
@ -742,16 +706,15 @@ void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
|
||||||
|
|
||||||
comboBoxBase->blockSignals(true);
|
comboBoxBase->blockSignals(true);
|
||||||
|
|
||||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
|
||||||
const QVector<qreal> bases = dimension->ValidBases();
|
const QVector<qreal> bases = dimension->ValidBases();
|
||||||
comboBoxBase->clear();
|
comboBoxBase->clear();
|
||||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
const bool fc = dimension->Type() != MeasurementDimension::X ? ui->checkBoxFullCircumference->isChecked() : false;
|
||||||
const bool c = dimension->IsCircumference();
|
const bool m = dimension->IsBodyMeasurement();
|
||||||
|
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
|
||||||
|
|
||||||
for(auto base : bases)
|
for(auto base : bases)
|
||||||
{
|
{
|
||||||
comboBoxBase->addItem(QStringLiteral("%1%2").arg(c && fc ? base * 2 : base)
|
comboBoxBase->addItem(QStringLiteral("%1%2").arg(m && fc ? base * 2 : base).arg(unitStr), base);
|
||||||
.arg(c || dimension->Type() == MeasurementDimension::X ? unitStr : QString()), base);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
comboBoxBase->setCurrentIndex(comboBoxBase->findData(oldBase));
|
comboBoxBase->setCurrentIndex(comboBoxBase->findData(oldBase));
|
||||||
|
|
|
@ -62,13 +62,13 @@ protected:
|
||||||
private slots:
|
private slots:
|
||||||
void ShowFullCircumference();
|
void ShowFullCircumference();
|
||||||
|
|
||||||
void XDimensionCircumferenceChanged();
|
void XDimensionBodyMeasurementChanged();
|
||||||
void YDimensionCircumferenceChanged();
|
void YDimensionBodyMeasurementChanged();
|
||||||
void WDimensionCircumferenceChanged();
|
void WDimensionBodyMeasurementChanged();
|
||||||
void ZDimensionCircumferenceChanged();
|
void ZDimensionBodyMeasurementChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(DialogSetupMultisize)
|
Q_DISABLE_COPY_MOVE(DialogSetupMultisize) // NOLINT
|
||||||
Ui::DialogSetupMultisize *ui;
|
Ui::DialogSetupMultisize *ui;
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
QSharedPointer<VXMeasurementDimension> m_xDimension;
|
QSharedPointer<VXMeasurementDimension> m_xDimension;
|
||||||
|
|
|
@ -147,9 +147,12 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxXDimensionCircumference">
|
<widget class="QCheckBox" name="checkBoxXDimensionBodyMeasurement">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>A body measurement measured in units of length.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Circumference</string>
|
<string>Body Measurement</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -282,9 +285,12 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxYDimensionCircumference">
|
<widget class="QCheckBox" name="checkBoxYDimensionBodyMeasurement">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>A body measurement measured in units of length. Circumference.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Circumference</string>
|
<string>Body Measurement</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -417,9 +423,12 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxWDimensionCircumference">
|
<widget class="QCheckBox" name="checkBoxWDimensionBodyMeasurement">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>A body measurement measured in units of length. Circumference.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Circumference</string>
|
<string>Body Measurement</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -552,9 +561,12 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxZDimensionCircumference">
|
<widget class="QCheckBox" name="checkBoxZDimensionBodyMeasurement">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>A body measurement measured in units of length. Circumference.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Circumference</string>
|
<string>Body Measurement</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
|
@ -2761,7 +2761,7 @@ void TMainWindow::InitDimensionsBaseValue()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X)
|
if (dimension->IsBodyMeasurement() || dimension->Type() == MeasurementDimension::X)
|
||||||
{
|
{
|
||||||
if (dimension->Type() != MeasurementDimension::X && fc)
|
if (dimension->Type() != MeasurementDimension::X && fc)
|
||||||
{
|
{
|
||||||
|
@ -2829,7 +2829,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dimension->IsCircumference())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2146,7 +2146,7 @@ void MainWindow::StoreMultisizeMDimensions()
|
||||||
|
|
||||||
QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
|
|
||||||
if (dimensions.size() > 0)
|
if (not dimensions.isEmpty())
|
||||||
{
|
{
|
||||||
if (not dimensionALabel.isNull())
|
if (not dimensionALabel.isNull())
|
||||||
{
|
{
|
||||||
|
@ -2190,9 +2190,9 @@ void MainWindow::StoreMultisizeMDimensions()
|
||||||
VAbstractValApplication::VApp()->SetDimensionSize(fc ? currentBase*2 : currentBase);
|
VAbstractValApplication::VApp()->SetDimensionSize(fc ? currentBase*2 : currentBase);
|
||||||
VAbstractValApplication::VApp()->SetDimensionSizeLabel(
|
VAbstractValApplication::VApp()->SetDimensionSizeLabel(
|
||||||
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
||||||
const bool circumference = dimension->IsCircumference();
|
const bool measurement = dimension->IsBodyMeasurement();
|
||||||
VAbstractValApplication::VApp()
|
VAbstractValApplication::VApp()
|
||||||
->SetDimensionSizeUnits(circumference ? m->Units() : Unit::LAST_UNIT_DO_NOT_USE);
|
->SetDimensionSizeUnits(measurement ? m->Units() : Unit::LAST_UNIT_DO_NOT_USE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MeasurementDimension::W:
|
case MeasurementDimension::W:
|
||||||
|
@ -4614,7 +4614,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dimension->IsCircumference())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
<file>schema/multisize_measurements/v0.5.1.xsd</file>
|
<file>schema/multisize_measurements/v0.5.1.xsd</file>
|
||||||
<file>schema/multisize_measurements/v0.5.2.xsd</file>
|
<file>schema/multisize_measurements/v0.5.2.xsd</file>
|
||||||
<file>schema/multisize_measurements/v0.5.3.xsd</file>
|
<file>schema/multisize_measurements/v0.5.3.xsd</file>
|
||||||
|
<file>schema/multisize_measurements/v0.5.4.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.2.0.xsd</file>
|
<file>schema/individual_measurements/v0.2.0.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.3.0.xsd</file>
|
<file>schema/individual_measurements/v0.3.0.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
||||||
|
|
145
src/libs/ifc/schema/multisize_measurements/v0.5.4.xsd
Normal file
145
src/libs/ifc/schema/multisize_measurements/v0.5.4.xsd
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||||
|
<xs:element name="vst">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="version" type="formatVersion"/>
|
||||||
|
<xs:element name="read-only" type="xs:boolean"/>
|
||||||
|
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||||
|
<xs:element name="unit" type="units"/>
|
||||||
|
<xs:element name="pm_system" type="psCode"/>
|
||||||
|
<xs:element name="dimensions">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="dimension" minOccurs="1" maxOccurs="3">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="labels" minOccurs="0" maxOccurs="1">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="label" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="value" type="dimesionValue" use="required"/>
|
||||||
|
<xs:attribute name="label" type="xs:string" use="required"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="type" type="dimensionType" use="required"/>
|
||||||
|
<xs:attribute name="base" type="dimesionValue" use="required"/>
|
||||||
|
<xs:attribute name="min" type="dimesionValue" use="required"/>
|
||||||
|
<xs:attribute name="max" type="dimesionValue" use="required"/>
|
||||||
|
<xs:attribute name="step" type="dimensionStep" use="required"/>
|
||||||
|
<xs:attribute name="measurement" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="customName" type="xs:string"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="fullCircumference" type="xs:boolean"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="restrictions">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="restriction" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="coordinates" type="xs:string" use="required"/>
|
||||||
|
<xs:attribute name="min" type="dimesionValue"/>
|
||||||
|
<xs:attribute name="max" type="dimesionValue"/>
|
||||||
|
<xs:attribute name="exclude" type="xs:string"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="body-measurements">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="m" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="corrections" minOccurs="0" maxOccurs="1">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="correction" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="coordinates" type="xs:string" use="required"/>
|
||||||
|
<xs:attribute name="correction" type="xs:double" use="required"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute name="name" type="shortName" use="required"/>
|
||||||
|
<xs:attribute name="base" type="xs:double"/>
|
||||||
|
<xs:attribute name="shiftA" type="xs:double"/>
|
||||||
|
<xs:attribute name="shiftB" type="xs:double"/>
|
||||||
|
<xs:attribute name="shiftC" type="xs:double"/>
|
||||||
|
<xs:attribute name="full_name" type="xs:string"/>
|
||||||
|
<xs:attribute name="description" type="xs:string"/>
|
||||||
|
<xs:attribute name="specialUnits" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="type" type="measurementType"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:unique name="measurementName">
|
||||||
|
<xs:selector xpath="body-measurements/m"/>
|
||||||
|
<xs:field xpath="@name"/>
|
||||||
|
</xs:unique>
|
||||||
|
</xs:element>
|
||||||
|
<xs:simpleType name="shortName">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="([^\p{Nd}\p{Zs}*/&|!<>^ \()\-−+.,٫, ٬.’=?:;'\"]){1,1}([^\p{Zs}*/&|!<>^ \()\-−+.,٫, ٬.’=?:;\"]){0,}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="units">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="mm"/>
|
||||||
|
<xs:enumeration value="cm"/>
|
||||||
|
<xs:enumeration value="inch"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="formatVersion">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="psCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="(([0-9]|[1-4][0-9]|5[0-4])|998)"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="dimensionType">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="x"/>
|
||||||
|
<xs:enumeration value="y"/>
|
||||||
|
<xs:enumeration value="w"/>
|
||||||
|
<xs:enumeration value="z"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="dimesionValue">
|
||||||
|
<xs:restriction base="xs:double">
|
||||||
|
<xs:minInclusive value="1"/>
|
||||||
|
<xs:maxInclusive value="2720"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="dimensionStep">
|
||||||
|
<xs:restriction base="xs:double">
|
||||||
|
<xs:minInclusive value="0"/>
|
||||||
|
<xs:maxInclusive value="80"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="measurementType">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="measurement"/>
|
||||||
|
<xs:enumeration value="separator"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:schema>
|
|
@ -54,8 +54,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
|
const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
|
||||||
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.5.3");
|
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.5.4");
|
||||||
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/multisize_measurements/v0.5.3.xsd");
|
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/multisize_measurements/v0.5.4.xsd");
|
||||||
|
|
||||||
//VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
@ -63,6 +63,9 @@ const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/mu
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrCircumference, (QLatin1String("circumference")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrMeasurement, (QLatin1String("measurement")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagDimension, (QLatin1String("dimension")))
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -86,7 +89,8 @@ auto VVSTConverter::XSDSchema(unsigned ver) const -> QString
|
||||||
std::make_pair(FormatVersion(0, 5, 0), QStringLiteral("://schema/multisize_measurements/v0.5.0.xsd")),
|
std::make_pair(FormatVersion(0, 5, 0), QStringLiteral("://schema/multisize_measurements/v0.5.0.xsd")),
|
||||||
std::make_pair(FormatVersion(0, 5, 1), QStringLiteral("://schema/multisize_measurements/v0.5.1.xsd")),
|
std::make_pair(FormatVersion(0, 5, 1), QStringLiteral("://schema/multisize_measurements/v0.5.1.xsd")),
|
||||||
std::make_pair(FormatVersion(0, 5, 2), QStringLiteral("://schema/multisize_measurements/v0.5.2.xsd")),
|
std::make_pair(FormatVersion(0, 5, 2), QStringLiteral("://schema/multisize_measurements/v0.5.2.xsd")),
|
||||||
std::make_pair(FormatVersion(0, 5, 3), CurrentSchema),
|
std::make_pair(FormatVersion(0, 5, 3), QStringLiteral("://schema/multisize_measurements/v0.5.3.xsd")),
|
||||||
|
std::make_pair(FormatVersion(0, 5, 4), CurrentSchema),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (schemas.contains(ver))
|
if (schemas.contains(ver))
|
||||||
|
@ -119,10 +123,11 @@ void VVSTConverter::ApplyPatches()
|
||||||
case (FormatVersion(0, 5, 0)):
|
case (FormatVersion(0, 5, 0)):
|
||||||
case (FormatVersion(0, 5, 1)):
|
case (FormatVersion(0, 5, 1)):
|
||||||
case (FormatVersion(0, 5, 2)):
|
case (FormatVersion(0, 5, 2)):
|
||||||
ToV0_5_3();
|
case (FormatVersion(0, 5, 3)):
|
||||||
|
ToV0_5_4();
|
||||||
ValidateXML(CurrentSchema);
|
ValidateXML(CurrentSchema);
|
||||||
Q_FALLTHROUGH();
|
Q_FALLTHROUGH();
|
||||||
case (FormatVersion(0, 5, 3)):
|
case (FormatVersion(0, 5, 4)):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
|
@ -141,7 +146,7 @@ void VVSTConverter::DowngradeToCurrentMaxVersion()
|
||||||
auto VVSTConverter::IsReadOnly() const -> bool
|
auto VVSTConverter::IsReadOnly() const -> bool
|
||||||
{
|
{
|
||||||
// Check if attribute read-only was not changed in file format
|
// Check if attribute read-only was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FormatVersion(0, 5, 3),
|
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FormatVersion(0, 5, 4),
|
||||||
"Check attribute read-only.");
|
"Check attribute read-only.");
|
||||||
|
|
||||||
// Possibly in future attribute read-only will change position etc.
|
// Possibly in future attribute read-only will change position etc.
|
||||||
|
@ -415,6 +420,22 @@ void VVSTConverter::ConvertMeasurementsToV0_5_0()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VVSTConverter::ConvertCircumferenceAttreibuteToV0_5_4()
|
||||||
|
{
|
||||||
|
const QDomNodeList list = elementsByTagName(*strTagDimension);
|
||||||
|
for (int i=0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
QDomElement dom = list.at(i).toElement();
|
||||||
|
if (dom.hasAttribute(*strAttrCircumference))
|
||||||
|
{
|
||||||
|
bool m = GetParametrBool(dom, *strAttrCircumference, trueStr);
|
||||||
|
dom.removeAttribute(*strAttrCircumference);
|
||||||
|
SetAttribute(dom, *strAttrMeasurement, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VVSTConverter::ToV0_4_0()
|
void VVSTConverter::ToV0_4_0()
|
||||||
{
|
{
|
||||||
|
@ -469,12 +490,13 @@ void VVSTConverter::ToV0_5_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VVSTConverter::ToV0_5_3()
|
void VVSTConverter::ToV0_5_4()
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.5.3
|
// TODO. Delete if minimal supported version is 0.5.4
|
||||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 3),
|
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 4),
|
||||||
"Time to refactor the code.");
|
"Time to refactor the code.");
|
||||||
|
|
||||||
SetVersion(QStringLiteral("0.5.3"));
|
SetVersion(QStringLiteral("0.5.4"));
|
||||||
|
ConvertCircumferenceAttreibuteToV0_5_4();
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
static const QString MeasurementMaxVerStr;
|
static const QString MeasurementMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
|
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
|
||||||
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 3);
|
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 4);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual unsigned MinVer() const override;
|
virtual unsigned MinVer() const override;
|
||||||
|
@ -78,11 +78,13 @@ private:
|
||||||
void RemoveTagsForV0_5_0();
|
void RemoveTagsForV0_5_0();
|
||||||
void ConvertMeasurementsToV0_5_0();
|
void ConvertMeasurementsToV0_5_0();
|
||||||
|
|
||||||
|
void ConvertCircumferenceAttreibuteToV0_5_4();
|
||||||
|
|
||||||
void ToV0_4_0();
|
void ToV0_4_0();
|
||||||
void ToV0_4_1();
|
void ToV0_4_1();
|
||||||
void ToV0_4_2();
|
void ToV0_4_2();
|
||||||
void ToV0_5_0();
|
void ToV0_5_0();
|
||||||
void ToV0_5_3();
|
void ToV0_5_4();
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -54,7 +54,7 @@ auto VAbstartMeasurementDimension::IsValid() -> bool
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstartMeasurementDimension::RangeMin() const -> int
|
auto VAbstartMeasurementDimension::RangeMin() const -> int
|
||||||
{
|
{
|
||||||
if (m_circumference)
|
if (m_measurement)
|
||||||
{
|
{
|
||||||
const int rangeMinCm = 20;
|
const int rangeMinCm = 20;
|
||||||
const int rangeMinMm = 200;
|
const int rangeMinMm = 200;
|
||||||
|
@ -79,7 +79,7 @@ auto VAbstartMeasurementDimension::RangeMin() const -> int
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstartMeasurementDimension::RangeMax() const -> int
|
auto VAbstartMeasurementDimension::RangeMax() const -> int
|
||||||
{
|
{
|
||||||
if (m_circumference)
|
if (m_measurement)
|
||||||
{
|
{
|
||||||
const int rangeMaxCm = 272;
|
const int rangeMaxCm = 272;
|
||||||
const int rangeMaxMm = 2720;
|
const int rangeMaxMm = 2720;
|
||||||
|
@ -276,19 +276,19 @@ auto VAbstartMeasurementDimension::DimensionToolTip(const MeasurementDimension_p
|
||||||
switch(dimension->Type())
|
switch(dimension->Type())
|
||||||
{
|
{
|
||||||
case MeasurementDimension::Y:
|
case MeasurementDimension::Y:
|
||||||
if (dimension->CustomName().isEmpty() && dimension->IsCircumference())
|
if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
return fc ? tr("Chest full circumference", "dimension") : tr("Chest half circumference", "dimension");
|
return fc ? tr("Chest full circumference", "dimension") : tr("Chest half circumference", "dimension");
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
case MeasurementDimension::W:
|
case MeasurementDimension::W:
|
||||||
if (dimension->CustomName().isEmpty() && dimension->IsCircumference())
|
if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
return fc ? tr("Waist full circumference", "dimension") : tr("Waist half circumference", "dimension");
|
return fc ? tr("Waist full circumference", "dimension") : tr("Waist half circumference", "dimension");
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
case MeasurementDimension::Z:
|
case MeasurementDimension::Z:
|
||||||
if (dimension->CustomName().isEmpty() && dimension->IsCircumference())
|
if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
return fc ? tr("Hip full circumference", "dimension") : tr("Hip half circumference", "dimension");
|
return fc ? tr("Hip full circumference", "dimension") : tr("Hip half circumference", "dimension");
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ public:
|
||||||
// cppcheck-suppress functionStatic
|
// cppcheck-suppress functionStatic
|
||||||
auto Units() const -> Unit;
|
auto Units() const -> Unit;
|
||||||
|
|
||||||
auto IsCircumference() const -> bool;
|
auto IsBodyMeasurement() const -> bool;
|
||||||
void SetCircumference(bool circumference);
|
void SetBodyMeasurement(bool measurement);
|
||||||
|
|
||||||
auto RangeMin() const -> int;
|
auto RangeMin() const -> int;
|
||||||
auto RangeMax() const -> int;
|
auto RangeMax() const -> int;
|
||||||
|
@ -124,7 +124,7 @@ private:
|
||||||
qreal m_baseValue{0};
|
qreal m_baseValue{0};
|
||||||
QString m_error{};
|
QString m_error{};
|
||||||
DimesionLabels m_labels{};
|
DimesionLabels m_labels{};
|
||||||
bool m_circumference{true};
|
bool m_measurement{true};
|
||||||
QString m_customName{};
|
QString m_customName{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,15 +189,15 @@ inline auto VAbstartMeasurementDimension::Units() const -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline auto VAbstartMeasurementDimension::IsCircumference() const -> bool
|
inline auto VAbstartMeasurementDimension::IsBodyMeasurement() const -> bool
|
||||||
{
|
{
|
||||||
return m_circumference;
|
return m_measurement;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline void VAbstartMeasurementDimension::SetCircumference(bool circumference)
|
inline void VAbstartMeasurementDimension::SetBodyMeasurement(bool measurement)
|
||||||
{
|
{
|
||||||
m_circumference = circumference;
|
m_measurement = measurement;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -93,7 +93,7 @@ const QString VMeasurements::AttrFullName = QStringLiteral("full_name")
|
||||||
const QString VMeasurements::AttrMin = QStringLiteral("min");
|
const QString VMeasurements::AttrMin = QStringLiteral("min");
|
||||||
const QString VMeasurements::AttrMax = QStringLiteral("max");
|
const QString VMeasurements::AttrMax = QStringLiteral("max");
|
||||||
const QString VMeasurements::AttrStep = QStringLiteral("step");
|
const QString VMeasurements::AttrStep = QStringLiteral("step");
|
||||||
const QString VMeasurements::AttrCircumference = QStringLiteral("circumference");
|
const QString VMeasurements::AttrMeasurement = QStringLiteral("measurement");
|
||||||
const QString VMeasurements::AttrFullCircumference = QStringLiteral("fullCircumference");
|
const QString VMeasurements::AttrFullCircumference = QStringLiteral("fullCircumference");
|
||||||
const QString VMeasurements::AttrLabel = QStringLiteral("label");
|
const QString VMeasurements::AttrLabel = QStringLiteral("label");
|
||||||
const QString VMeasurements::AttrDimension = QStringLiteral("dimension");
|
const QString VMeasurements::AttrDimension = QStringLiteral("dimension");
|
||||||
|
@ -1250,7 +1250,7 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VMeasurements::CreateDimensions(const QVector<MeasurementDimension_p > &dimensions)
|
auto VMeasurements::CreateDimensions(const QVector<MeasurementDimension_p > &dimensions) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement dimensionsTag = createElement(TagDimensions);
|
QDomElement dimensionsTag = createElement(TagDimensions);
|
||||||
|
|
||||||
|
@ -1263,8 +1263,8 @@ QDomElement VMeasurements::CreateDimensions(const QVector<MeasurementDimension_p
|
||||||
SetAttribute(dimensionTag, AttrMin, dimension->MinValue());
|
SetAttribute(dimensionTag, AttrMin, dimension->MinValue());
|
||||||
SetAttribute(dimensionTag, AttrMax, dimension->MaxValue());
|
SetAttribute(dimensionTag, AttrMax, dimension->MaxValue());
|
||||||
SetAttribute(dimensionTag, AttrStep, dimension->Step());
|
SetAttribute(dimensionTag, AttrStep, dimension->Step());
|
||||||
SetAttributeOrRemoveIf<bool>(dimensionTag, AttrCircumference, dimension->IsCircumference(),
|
SetAttributeOrRemoveIf<bool>(dimensionTag, AttrMeasurement, dimension->IsBodyMeasurement(),
|
||||||
[](bool c) noexcept {return c;});
|
[](bool m) noexcept {return m;});
|
||||||
SetAttributeOrRemoveIf<QString>(dimensionTag, AttrCustomName, dimension->CustomName(),
|
SetAttributeOrRemoveIf<QString>(dimensionTag, AttrCustomName, dimension->CustomName(),
|
||||||
[](const QString &name) noexcept {return name.isEmpty();});
|
[](const QString &name) noexcept {return name.isEmpty();});
|
||||||
|
|
||||||
|
@ -1427,7 +1427,7 @@ auto VMeasurements::ReadDimensions() const -> VDimensions
|
||||||
}
|
}
|
||||||
|
|
||||||
dimension->SetBaseValue(GetParametrDouble(dom, AttrBase, QChar('0')));
|
dimension->SetBaseValue(GetParametrDouble(dom, AttrBase, QChar('0')));
|
||||||
dimension->SetCircumference(GetParametrBool(dom, AttrCircumference, trueStr));
|
dimension->SetBodyMeasurement(GetParametrBool(dom, AttrMeasurement, trueStr));
|
||||||
dimension->SetCustomName(GetParametrEmptyString(dom, AttrCustomName));
|
dimension->SetCustomName(GetParametrEmptyString(dom, AttrCustomName));
|
||||||
dimension->SetLabels(ReadDimensionLabels(dom));
|
dimension->SetLabels(ReadDimensionLabels(dom));
|
||||||
dimensions.insert(type, dimension);
|
dimensions.insert(type, dimension);
|
||||||
|
|
|
@ -168,7 +168,7 @@ public:
|
||||||
static const QString AttrMin;
|
static const QString AttrMin;
|
||||||
static const QString AttrMax;
|
static const QString AttrMax;
|
||||||
static const QString AttrStep;
|
static const QString AttrStep;
|
||||||
static const QString AttrCircumference;
|
static const QString AttrMeasurement;
|
||||||
static const QString AttrFullCircumference;
|
static const QString AttrFullCircumference;
|
||||||
static const QString AttrLabel;
|
static const QString AttrLabel;
|
||||||
static const QString AttrDimension;
|
static const QString AttrDimension;
|
||||||
|
|
|
@ -56,7 +56,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile()
|
||||||
|
|
||||||
auto m_yDimension = QSharedPointer<VYMeasurementDimension>::create(mUnit, 22, 72, 2);
|
auto m_yDimension = QSharedPointer<VYMeasurementDimension>::create(mUnit, 22, 72, 2);
|
||||||
m_yDimension->SetBaseValue(50);
|
m_yDimension->SetBaseValue(50);
|
||||||
m_yDimension->SetCircumference(true);
|
m_yDimension->SetBodyMeasurement(true);
|
||||||
|
|
||||||
QVector<MeasurementDimension_p > dimensions{m_xDimension, m_yDimension};
|
QVector<MeasurementDimension_p > dimensions{m_xDimension, m_yDimension};
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile()
|
||||||
|
|
||||||
auto m_yDimension = QSharedPointer<VYMeasurementDimension>::create(mUnit, 22, 72, 2);
|
auto m_yDimension = QSharedPointer<VYMeasurementDimension>::create(mUnit, 22, 72, 2);
|
||||||
m_yDimension->SetBaseValue(50);
|
m_yDimension->SetBaseValue(50);
|
||||||
m_yDimension->SetCircumference(true);
|
m_yDimension->SetBodyMeasurement(true);
|
||||||
|
|
||||||
QVector<MeasurementDimension_p > dimensions{m_xDimension, m_yDimension};
|
QVector<MeasurementDimension_p > dimensions{m_xDimension, m_yDimension};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user