Allow a user to select dimensions for individual measurements.

This commit is contained in:
Roman Telezhynskyi 2020-10-15 09:35:08 +03:00
parent ed2bf34f1e
commit 23e6d0f830
12 changed files with 291 additions and 46 deletions

View File

@ -621,6 +621,8 @@ void TMainWindow::changeEvent(QEvent *event)
InitGender(ui->comboBoxGender); InitGender(ui->comboBoxGender);
ui->comboBoxGender->setCurrentIndex(index); ui->comboBoxGender->setCurrentIndex(index);
ui->comboBoxGender->blockSignals(false); ui->comboBoxGender->blockSignals(false);
InitMeasurementDimension();
} }
{ {
@ -1696,6 +1698,11 @@ void TMainWindow::ShowNewMData(bool fresh)
ui->plainTextEditFormula->setPlainText(formula); ui->plainTextEditFormula->setPlainText(formula);
ui->plainTextEditFormula->blockSignals(false); ui->plainTextEditFormula->blockSignals(false);
ui->comboBoxDimension->blockSignals(true);
ui->comboBoxDimension->setCurrentIndex(
ui->comboBoxDimension->findData(static_cast<int>(meash->GetDimension())));
ui->comboBoxDimension->blockSignals(false);
} }
MeasurementGUI(); MeasurementGUI();
@ -2121,6 +2128,32 @@ void TMainWindow::SaveMUnits()
ShowNewMData(false); ShowNewMData(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SaveMDimension()
{
const int row = ui->tableWidget->currentRow();
if (row == -1)
{
return;
}
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const IMD dimension = static_cast<IMD>(ui->comboBoxDimension->currentData().toInt());
m->SetMDimension(nameField->data(Qt::UserRole).toString(), dimension);
MeasurementsWereSaved(false);
RefreshData();
search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->blockSignals(true);
ui->tableWidget->selectRow(row);
ui->tableWidget->blockSignals(false);
ShowNewMData(false);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::FullCircumferenceChanged(bool checked) void TMainWindow::FullCircumferenceChanged(bool checked)
{ {
@ -2389,6 +2422,8 @@ void TMainWindow::InitWindow()
HackWidget(&ui->toolButtonExpr); HackWidget(&ui->toolButtonExpr);
HackWidget(&ui->labelFormula); HackWidget(&ui->labelFormula);
HackWidget(&ui->pushButtonGrow); HackWidget(&ui->pushButtonGrow);
HackWidget(&ui->labelDimension);
HackWidget(&ui->comboBoxDimension);
// Tab Information // Tab Information
HackWidget(&ui->lineEditCustomerName); HackWidget(&ui->lineEditCustomerName);
@ -2471,6 +2506,10 @@ void TMainWindow::InitWindow()
Qt::UniqueConnection); Qt::UniqueConnection);
connect(ui->toolButtonExpr, &QToolButton::clicked, this, &TMainWindow::Fx); connect(ui->toolButtonExpr, &QToolButton::clicked, this, &TMainWindow::Fx);
InitMeasurementDimension();
connect(ui->comboBoxDimension, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&TMainWindow::SaveMDimension);
} }
ui->comboBoxPMSystem->setEnabled(true); ui->comboBoxPMSystem->setEnabled(true);
@ -3180,6 +3219,7 @@ void TMainWindow::MFields(bool enabled)
ui->plainTextEditFormula->setEnabled(enabled); ui->plainTextEditFormula->setEnabled(enabled);
ui->pushButtonGrow->setEnabled(enabled); ui->pushButtonGrow->setEnabled(enabled);
ui->toolButtonExpr->setEnabled(enabled); ui->toolButtonExpr->setEnabled(enabled);
ui->comboBoxDimension->setEnabled(enabled);
} }
ui->lineEditFind->setEnabled(enabled); ui->lineEditFind->setEnabled(enabled);
@ -4309,6 +4349,34 @@ void TMainWindow::InitGender(QComboBox *gender)
gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female))); gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
} }
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitMeasurementDimension()
{
ui->comboBoxDimension->blockSignals(true);
int current = -1;
if (ui->comboBoxDimension->currentIndex() != -1)
{
current = ui->comboBoxDimension->currentData().toInt();
}
ui->comboBoxDimension->clear();
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::N), QVariant(static_cast<int>(IMD::N)));
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::X), QVariant(static_cast<int>(IMD::X)));
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::Y), QVariant(static_cast<int>(IMD::Y)));
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::W), QVariant(static_cast<int>(IMD::W)));
ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::Z), QVariant(static_cast<int>(IMD::Z)));
int i = ui->comboBoxDimension->findData(current);
if (i != -1)
{
ui->comboBoxDimension->setCurrentIndex(i);
}
ui->comboBoxDimension->blockSignals(false);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <class T> template <class T>
void TMainWindow::HackWidget(T **widget) void TMainWindow::HackWidget(T **widget)

View File

@ -134,6 +134,7 @@ private slots:
void SaveMDescription(); void SaveMDescription();
void SaveMFullName(); void SaveMFullName();
void SaveMUnits(); void SaveMUnits();
void SaveMDimension();
void FullCircumferenceChanged(bool checked); void FullCircumferenceChanged(bool checked);
@ -186,6 +187,7 @@ private:
void InitComboBoxUnits(); void InitComboBoxUnits();
void InitMeasurementUnits(); void InitMeasurementUnits();
void InitGender(QComboBox *gender); void InitGender(QComboBox *gender);
void InitMeasurementDimension();
void ShowNewMData(bool fresh); void ShowNewMData(bool fresh);
void ShowUnits(); void ShowUnits();

View File

@ -339,14 +339,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Name:</string> <string>Name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="lineEditName"> <widget class="QLineEdit" name="lineEditName">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -359,14 +359,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="labelCalculated"> <widget class="QLabel" name="labelCalculated">
<property name="text"> <property name="text">
<string>Calculated value:</string> <string>Calculated value:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QLabel" name="labelCalculatedValue"> <widget class="QLabel" name="labelCalculatedValue">
<property name="toolTip"> <property name="toolTip">
<string>Calculated value</string> <string>Calculated value</string>
@ -376,14 +376,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="labelFormula"> <widget class="QLabel" name="labelFormula">
<property name="text"> <property name="text">
<string>Formula:</string> <string>Formula:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayoutValue"> <layout class="QHBoxLayout" name="horizontalLayoutValue">
<item> <item>
<widget class="VPlainTextEdit" name="plainTextEditFormula"> <widget class="VPlainTextEdit" name="plainTextEditFormula">
@ -470,14 +470,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="labelBaseValue"> <widget class="QLabel" name="labelBaseValue">
<property name="text"> <property name="text">
<string>Base value:</string> <string>Base value:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxBaseValue"> <widget class="QDoubleSpinBox" name="doubleSpinBoxBaseValue">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -490,14 +490,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="labelShiftA"> <widget class="QLabel" name="labelShiftA">
<property name="text"> <property name="text">
<string notr="true">Shift A</string> <string notr="true">Shift A</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxShiftA"> <widget class="QDoubleSpinBox" name="doubleSpinBoxShiftA">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -510,14 +510,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<widget class="QLabel" name="labelShiftB"> <widget class="QLabel" name="labelShiftB">
<property name="text"> <property name="text">
<string>Shift B</string> <string>Shift B</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxShiftB"> <widget class="QDoubleSpinBox" name="doubleSpinBoxShiftB">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -530,14 +530,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QLabel" name="labelShiftC"> <widget class="QLabel" name="labelShiftC">
<property name="text"> <property name="text">
<string>Shift C</string> <string>Shift C</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxShiftC"> <widget class="QDoubleSpinBox" name="doubleSpinBoxShiftC">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -550,14 +550,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="9" column="0">
<widget class="QLabel" name="labelCorrection"> <widget class="QLabel" name="labelCorrection">
<property name="text"> <property name="text">
<string>Correction:</string> <string>Correction:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxCorrection"> <widget class="QDoubleSpinBox" name="doubleSpinBoxCorrection">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -570,14 +570,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="10" column="0">
<widget class="QLabel" name="labelFullName"> <widget class="QLabel" name="labelFullName">
<property name="text"> <property name="text">
<string>Full name:</string> <string>Full name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="10" column="1">
<widget class="QLineEdit" name="lineEditFullName"> <widget class="QLineEdit" name="lineEditFullName">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -590,14 +590,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="11" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Description:</string> <string>Description:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1"> <item row="11" column="1">
<widget class="VPlainTextEdit" name="plainTextEditDescription"> <widget class="VPlainTextEdit" name="plainTextEditDescription">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -616,6 +616,29 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="labelDimension">
<property name="text">
<string>Dimension:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxDimension">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select one of the dimensions to later use the measurement value in piece label</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -2191,21 +2191,6 @@ QSharedPointer<VMeasurements> MainWindowsNoGUI::OpenMeasurementFile(const QStrin
} }
CheckRequiredMeasurements(m.data()); CheckRequiredMeasurements(m.data());
if (m->Type() == MeasurementsType::Multisize)
{
if (m->MUnit() == Unit::Inch)
{
qCCritical(vMainNoGUIWindow, "%s\n\n%s", qUtf8Printable(tr("Wrong units.")),
qUtf8Printable(tr("Application doesn't support multisize table with inches.")));
m->clear();
if (not VApplication::IsGUIMode())
{
qApp->exit(V_EX_DATAERR);
}
return m;
}
}
} }
catch (VException &e) catch (VException &e)
{ {

View File

@ -28,6 +28,7 @@
<xs:attribute name="full_name" type="xs:string"/> <xs:attribute name="full_name" type="xs:string"/>
<xs:attribute name="description" type="xs:string"/> <xs:attribute name="description" type="xs:string"/>
<xs:attribute name="specialUnits" type="xs:boolean"/> <xs:attribute name="specialUnits" type="xs:boolean"/>
<xs:attribute name="dimension" type="dimensionType"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
@ -70,4 +71,13 @@
<xs:pattern value="(([0-9]|[1-4][0-9]|5[0-4])|998)"/> <xs:pattern value="(([0-9]|[1-4][0-9]|5[0-4])|998)"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="dimensionType">
<xs:restriction base="xs:string">
<xs:enumeration value="n"/>
<xs:enumeration value="x"/>
<xs:enumeration value="y"/>
<xs:enumeration value="w"/>
<xs:enumeration value="z"/>
</xs:restriction>
</xs:simpleType>
</xs:schema> </xs:schema>

View File

@ -165,16 +165,16 @@ QString VAbstartMeasurementDimension::DimensionName(MeasurementDimension type)
{ {
switch(type) switch(type)
{ {
case MeasurementDimension::X: case MeasurementDimension::X:
return tr("Height"); return tr("Height");
case MeasurementDimension::Y: case MeasurementDimension::Y:
return tr("Size"); return tr("Size");
case MeasurementDimension::W: case MeasurementDimension::W:
return tr("Hip"); return tr("Hip");
case MeasurementDimension::Z: case MeasurementDimension::Z:
return tr("Waist"); return tr("Waist");
default: default:
return QString(); return QString();
} }
} }

View File

@ -94,11 +94,13 @@ const QString VMeasurements::AttrStep = QStringLiteral("step");
const QString VMeasurements::AttrCircumference = QStringLiteral("circumference"); const QString VMeasurements::AttrCircumference = QStringLiteral("circumference");
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::GenderMale = QStringLiteral("male"); const QString VMeasurements::GenderMale = QStringLiteral("male");
const QString VMeasurements::GenderFemale = QStringLiteral("female"); const QString VMeasurements::GenderFemale = QStringLiteral("female");
const QString VMeasurements::GenderUnknown = QStringLiteral("unknown"); const QString VMeasurements::GenderUnknown = QStringLiteral("unknown");
const QString VMeasurements::DimensionN = QStringLiteral("n");
const QString VMeasurements::DimensionX = QStringLiteral("x"); const QString VMeasurements::DimensionX = QStringLiteral("x");
const QString VMeasurements::DimensionY = QStringLiteral("y"); const QString VMeasurements::DimensionY = QStringLiteral("y");
const QString VMeasurements::DimensionW = QStringLiteral("w"); const QString VMeasurements::DimensionW = QStringLiteral("w");
@ -366,6 +368,8 @@ void VMeasurements::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC) cons
} }
else else
{ {
const IMD dimension =
VMeasurements::StrToIMD(GetParametrString(dom, AttrDimension, VMeasurements::IMDToStr(IMD::N)));
const QString formula = GetParametrString(dom, AttrValue, QChar('0')); const QString formula = GetParametrString(dom, AttrValue, QChar('0'));
bool ok = false; bool ok = false;
qreal value = EvalFormula(tempData.data(), formula, &ok); qreal value = EvalFormula(tempData.data(), formula, &ok);
@ -382,6 +386,7 @@ void VMeasurements::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC) cons
meash->SetGuiText(fullName); meash->SetGuiText(fullName);
meash->SetDescription(description); meash->SetDescription(description);
meash->SetSpecialUnits(specialUnits); meash->SetSpecialUnits(specialUnits);
meash->SetDimension(dimension);
} }
if (m_keepNames) if (m_keepNames)
@ -804,6 +809,41 @@ void VMeasurements::SetMFullName(const QString &name, const QString &text)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetMDimension(const QString &name, IMD type)
{
ClearDimension(type);
QDomElement node = FindM(name);
if (not node.isNull())
{
SetAttributeOrRemoveIf(node, AttrDimension, VMeasurements::IMDToStr(type), type == IMD::N);
}
else
{
qWarning() << tr("Can't find measurement '%1'").arg(name);
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VMeasurements::MeasurementForDimension(IMD type) const
{
const QString d = VMeasurements::IMDToStr(type);
QDomNodeList list = elementsByTagName(TagMeasurement);
for (int i=0; i < list.size(); ++i)
{
const QDomElement domElement = list.at(i).toElement();
if (domElement.isNull() == false)
{
if (domElement.attribute(AttrDimension) == d)
{
return domElement.attribute(AttrName);
}
}
}
return QString();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMap<MeasurementDimension, MeasurementDimension_p > VMeasurements::Dimensions() const QMap<MeasurementDimension, MeasurementDimension_p > VMeasurements::Dimensions() const
{ {
@ -1001,6 +1041,65 @@ MeasurementDimension VMeasurements::StrToDimensionType(const QString &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QString VMeasurements::IMDToStr(const IMD &type)
{
switch (type)
{
case IMD::X:
return DimensionX;
case IMD::Y:
return DimensionY;
case IMD::W:
return DimensionW;
case IMD::Z:
return DimensionZ;
case IMD::N:
default:
return DimensionN;
}
}
//---------------------------------------------------------------------------------------------------------------------
IMD VMeasurements::StrToIMD(const QString &type)
{
const QStringList dimensions = QStringList{DimensionN, DimensionX, DimensionY, DimensionW, DimensionZ};
switch (dimensions.indexOf(type))
{
case 1: // DimensionX
return IMD::X;
case 2: // DimensionY
return IMD::Y;
case 3: // DimensionW
return IMD::W;
case 4: // DimensionZ
return IMD::Z;
case 0: // DimensionN
default:
return IMD::N;
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VMeasurements::IMDName(IMD type)
{
switch(type)
{
case IMD::N:
return tr("None");
case IMD::X:
return tr("Height");
case IMD::Y:
return tr("Size");
case IMD::W:
return tr("Hip");
case IMD::Z:
return tr("Waist");
default:
return QString();
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VMeasurements::ListAll() const QStringList VMeasurements::ListAll() const
{ {
@ -1419,3 +1518,22 @@ DimesionLabels VMeasurements::ReadDimensionLabels(const QDomElement &dElement) c
return labels; return labels;
} }
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::ClearDimension(IMD type)
{
const QString d = VMeasurements::IMDToStr(type);
QDomNodeList list = elementsByTagName(TagMeasurement);
for (int i=0; i < list.size(); ++i)
{
QDomElement domElement = list.at(i).toElement();
if (domElement.isNull() == false)
{
if (domElement.attribute(AttrDimension) == d)
{
domElement.removeAttribute(AttrDimension);
}
}
}
}

View File

@ -113,6 +113,9 @@ public:
void SetMCorrectionValue(const QString &name, qreal baseA, qreal baseB, qreal baseC, double value); void SetMCorrectionValue(const QString &name, qreal baseA, qreal baseB, qreal baseC, double value);
void SetMDescription(const QString &name, const QString &text); void SetMDescription(const QString &name, const QString &text);
void SetMFullName(const QString &name, const QString &text); void SetMFullName(const QString &name, const QString &text);
void SetMDimension(const QString &name, IMD type);
QString MeasurementForDimension(IMD type) const;
QMap<MeasurementDimension, MeasurementDimension_p > Dimensions() const; QMap<MeasurementDimension, MeasurementDimension_p > Dimensions() const;
@ -161,11 +164,13 @@ public:
static const QString AttrCircumference; static const QString AttrCircumference;
static const QString AttrFullCircumference; static const QString AttrFullCircumference;
static const QString AttrLabel; static const QString AttrLabel;
static const QString AttrDimension;
static const QString GenderMale; static const QString GenderMale;
static const QString GenderFemale; static const QString GenderFemale;
static const QString GenderUnknown; static const QString GenderUnknown;
static const QString DimensionN;
static const QString DimensionX; static const QString DimensionX;
static const QString DimensionY; static const QString DimensionY;
static const QString DimensionW; static const QString DimensionW;
@ -177,6 +182,11 @@ public:
static QString DimensionTypeToStr(const MeasurementDimension &type); static QString DimensionTypeToStr(const MeasurementDimension &type);
static MeasurementDimension StrToDimensionType(const QString &type); static MeasurementDimension StrToDimensionType(const QString &type);
static QString IMDToStr(const IMD &type);
static IMD StrToIMD(const QString &type);
static QString IMDName(IMD type);
QStringList ListAll() const; QStringList ListAll() const;
QStringList ListKnown() const; QStringList ListKnown() const;
@ -214,6 +224,8 @@ private:
void SaveDimesionLabels(QDomElement &dElement, const DimesionLabels &labels); void SaveDimesionLabels(QDomElement &dElement, const DimesionLabels &labels);
DimesionLabels ReadDimensionLabels(const QDomElement &dElement) const; DimesionLabels ReadDimensionLabels(const QDomElement &dElement) const;
void ClearDimension(IMD type);
}; };
#endif // VMEASUREMENTS_H #endif // VMEASUREMENTS_H

View File

@ -288,6 +288,15 @@ enum class GSizes : quint8 { ALL,
S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56, S58=58, S60=60, S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56, S58=58, S60=60,
S62=62, S64=64, S66=66, S68=68, S70=70, S72=72 }; S62=62, S64=64, S66=66, S68=68, S70=70, S72=72 };
enum class IMD: qint8 // Individual measurement dimension
{
N, // None
X, // height
Y, // size (chest half circumference)
W, // hip half circumference
Z // waist half circumference
};
/* QImage supports a maximum of 32768x32768 px images (signed short). /* QImage supports a maximum of 32768x32768 px images (signed short).
* This follows from the condition: width * height * colordepth < INT_MAX (4 billion) -> 32768 * 32768 * 4 = 4 billion. * This follows from the condition: width * height * colordepth < INT_MAX (4 billion) -> 32768 * 32768 * 4 = 4 billion.
* The second condition is of course that malloc is able to allocate the requested memory. * The second condition is of course that malloc is able to allocate the requested memory.

View File

@ -458,6 +458,18 @@ void VMeasurement::SetSpecialUnits(bool special)
d->specialUnits = special; d->specialUnits = special;
} }
//---------------------------------------------------------------------------------------------------------------------
IMD VMeasurement::GetDimension() const
{
return d->dimension;
}
//---------------------------------------------------------------------------------------------------------------------
void VMeasurement::SetDimension(IMD type)
{
d->dimension = type;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VMeasurement::GetCorrection(int baseA, int baseB, int baseC) const qreal VMeasurement::GetCorrection(int baseA, int baseB, int baseC) const
{ {

View File

@ -108,6 +108,9 @@ public:
bool IsSpecialUnits() const; bool IsSpecialUnits() const;
void SetSpecialUnits(bool special); void SetSpecialUnits(bool special);
IMD GetDimension() const;
void SetDimension(IMD type);
qreal GetCorrection(int baseA, int baseB, int baseC) const; qreal GetCorrection(int baseA, int baseB, int baseC) const;
QMap<QString, qreal> GetCorrections() const; QMap<QString, qreal> GetCorrections() const;

View File

@ -79,7 +79,8 @@ public:
baseB(m.baseB), baseB(m.baseB),
baseC(m.baseC), baseC(m.baseC),
corrections(m.corrections), corrections(m.corrections),
specialUnits(m.specialUnits) specialUnits(m.specialUnits),
dimension(m.dimension)
{} {}
virtual ~VMeasurementData(); virtual ~VMeasurementData();
@ -112,6 +113,8 @@ public:
bool specialUnits{false}; bool specialUnits{false};
IMD dimension{IMD::N};
private: private:
Q_DISABLE_ASSIGN(VMeasurementData) Q_DISABLE_ASSIGN(VMeasurementData)
}; };