Resolved issue #378. Change 'sex' field name to 'gender'.
--HG-- branch : develop
This commit is contained in:
parent
1ba9855d22
commit
c9ff24dd79
|
@ -623,12 +623,12 @@ void TMainWindow::SaveEmail()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::SaveSex(int index)
|
void TMainWindow::SaveGender(int index)
|
||||||
{
|
{
|
||||||
const SexType type = static_cast<SexType>(ui->comboBoxSex->itemData(index).toInt());
|
const GenderType type = static_cast<GenderType>(ui->comboBoxGender->itemData(index).toInt());
|
||||||
if (m->Sex() != type)
|
if (m->Gender() != type)
|
||||||
{
|
{
|
||||||
m->SetSex(type);
|
m->SetGender(type);
|
||||||
MeasurementsWasSaved(false);
|
MeasurementsWasSaved(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1619,7 +1619,7 @@ void TMainWindow::InitWindow()
|
||||||
// Tab Information
|
// Tab Information
|
||||||
delete ui->lineEditGivenName;
|
delete ui->lineEditGivenName;
|
||||||
delete ui->lineEditFamilyName;
|
delete ui->lineEditFamilyName;
|
||||||
delete ui->comboBoxSex;
|
delete ui->comboBoxGender;
|
||||||
delete ui->lineEditEmail;
|
delete ui->lineEditEmail;
|
||||||
|
|
||||||
delete ui->labelGivenName;
|
delete ui->labelGivenName;
|
||||||
|
@ -1634,8 +1634,8 @@ void TMainWindow::InitWindow()
|
||||||
delete ui->dateEditBirthDate;
|
delete ui->dateEditBirthDate;
|
||||||
ui->dateEditBirthDate = new QDateEdit(this);
|
ui->dateEditBirthDate = new QDateEdit(this);
|
||||||
|
|
||||||
delete ui->labelSex;
|
delete ui->labelGender;
|
||||||
ui->labelSex = new QLabel(this);
|
ui->labelGender = new QLabel(this);
|
||||||
|
|
||||||
delete ui->labelEmail;
|
delete ui->labelEmail;
|
||||||
ui->labelEmail = new QLabel(this);
|
ui->labelEmail = new QLabel(this);
|
||||||
|
@ -1672,7 +1672,7 @@ void TMainWindow::InitWindow()
|
||||||
ui->lineEditGivenName->setEnabled(true);
|
ui->lineEditGivenName->setEnabled(true);
|
||||||
ui->lineEditFamilyName->setEnabled(true);
|
ui->lineEditFamilyName->setEnabled(true);
|
||||||
ui->dateEditBirthDate->setEnabled(true);
|
ui->dateEditBirthDate->setEnabled(true);
|
||||||
ui->comboBoxSex->setEnabled(true);
|
ui->comboBoxGender->setEnabled(true);
|
||||||
ui->lineEditEmail->setEnabled(true);
|
ui->lineEditEmail->setEnabled(true);
|
||||||
|
|
||||||
// Tab Measurements
|
// Tab Measurements
|
||||||
|
@ -1705,11 +1705,11 @@ void TMainWindow::InitWindow()
|
||||||
ui->lineEditGivenName->setText(m->GivenName());
|
ui->lineEditGivenName->setText(m->GivenName());
|
||||||
ui->lineEditFamilyName->setText(m->FamilyName());
|
ui->lineEditFamilyName->setText(m->FamilyName());
|
||||||
|
|
||||||
ui->comboBoxSex->addItem(tr("unknown", "gender"), QVariant(static_cast<int>(SexType::Unknown)));
|
ui->comboBoxGender->addItem(tr("unknown", "gender"), QVariant(static_cast<int>(GenderType::Unknown)));
|
||||||
ui->comboBoxSex->addItem(tr("male", "gender"), QVariant(static_cast<int>(SexType::Male)));
|
ui->comboBoxGender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
|
||||||
ui->comboBoxSex->addItem(tr("female", "gender"), QVariant(static_cast<int>(SexType::Female)));
|
ui->comboBoxGender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
|
||||||
const qint32 index = ui->comboBoxSex->findData(static_cast<int>(m->Sex()));
|
const qint32 index = ui->comboBoxGender->findData(static_cast<int>(m->Gender()));
|
||||||
ui->comboBoxSex->setCurrentIndex(index);
|
ui->comboBoxGender->setCurrentIndex(index);
|
||||||
|
|
||||||
ui->dateEditBirthDate->setDate(m->BirthDate());
|
ui->dateEditBirthDate->setDate(m->BirthDate());
|
||||||
ui->lineEditEmail->setText(m->Email());
|
ui->lineEditEmail->setText(m->Email());
|
||||||
|
@ -1717,8 +1717,8 @@ void TMainWindow::InitWindow()
|
||||||
connect(ui->lineEditGivenName, &QLineEdit::editingFinished, this, &TMainWindow::SaveGivenName);
|
connect(ui->lineEditGivenName, &QLineEdit::editingFinished, this, &TMainWindow::SaveGivenName);
|
||||||
connect(ui->lineEditFamilyName, &QLineEdit::editingFinished, this, &TMainWindow::SaveFamilyName);
|
connect(ui->lineEditFamilyName, &QLineEdit::editingFinished, this, &TMainWindow::SaveFamilyName);
|
||||||
connect(ui->lineEditEmail, &QLineEdit::editingFinished, this, &TMainWindow::SaveEmail);
|
connect(ui->lineEditEmail, &QLineEdit::editingFinished, this, &TMainWindow::SaveEmail);
|
||||||
connect(ui->comboBoxSex, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(ui->comboBoxGender, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&TMainWindow::SaveSex);
|
&TMainWindow::SaveGender);
|
||||||
connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &TMainWindow::SaveBirthDate);
|
connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &TMainWindow::SaveBirthDate);
|
||||||
connect(ui->pushButtonGrow, &QPushButton::clicked, this, &TMainWindow::DeployFormula);
|
connect(ui->pushButtonGrow, &QPushButton::clicked, this, &TMainWindow::DeployFormula);
|
||||||
|
|
||||||
|
@ -2225,7 +2225,7 @@ void TMainWindow::GUIReadOnly(bool ro)
|
||||||
ui->lineEditGivenName->setReadOnly(ro);
|
ui->lineEditGivenName->setReadOnly(ro);
|
||||||
ui->lineEditFamilyName->setReadOnly(ro);
|
ui->lineEditFamilyName->setReadOnly(ro);
|
||||||
ui->dateEditBirthDate->setReadOnly(ro);
|
ui->dateEditBirthDate->setReadOnly(ro);
|
||||||
ui->comboBoxSex->setDisabled(ro);
|
ui->comboBoxGender->setDisabled(ro);
|
||||||
ui->lineEditEmail->setReadOnly(ro);
|
ui->lineEditEmail->setReadOnly(ro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ private slots:
|
||||||
void SaveGivenName();
|
void SaveGivenName();
|
||||||
void SaveFamilyName();
|
void SaveFamilyName();
|
||||||
void SaveEmail();
|
void SaveEmail();
|
||||||
void SaveSex(int index);
|
void SaveGender(int index);
|
||||||
void SaveBirthDate(const QDate & date);
|
void SaveBirthDate(const QDate & date);
|
||||||
void SaveNotes();
|
void SaveNotes();
|
||||||
void ReadOnly(bool ro);
|
void ReadOnly(bool ro);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabMeasurements">
|
<widget class="QWidget" name="tabMeasurements">
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -344,7 +344,9 @@
|
||||||
<string notr="true">...</string>
|
<string notr="true">...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="go-top"/>
|
<iconset theme="go-top">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -396,7 +398,9 @@
|
||||||
<string notr="true">...</string>
|
<string notr="true">...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="go-bottom"/>
|
<iconset theme="go-bottom">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -636,14 +640,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="labelSex">
|
<widget class="QLabel" name="labelGender">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sex:</string>
|
<string>Gender:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxSex">
|
<widget class="QComboBox" name="comboBoxGender">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -10,5 +10,6 @@
|
||||||
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
<file>schema/standard_measurements/v0.4.0.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>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
66
src/libs/ifc/schema/individual_measurements/v0.3.1.xsd
Normal file
66
src/libs/ifc/schema/individual_measurements/v0.3.1.xsd
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||||
|
<xs:element name="vit">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="version" type="formatVersion"></xs:element>
|
||||||
|
<xs:element name="read-only" type="xs:boolean"></xs:element>
|
||||||
|
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||||
|
<xs:element name="unit" type="units"></xs:element>
|
||||||
|
<xs:element name="personal">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="family-name" type="xs:string"></xs:element>
|
||||||
|
<xs:element name="given-name" type="xs:string"></xs:element>
|
||||||
|
<xs:element name="birth-date" type="xs:date"></xs:element>
|
||||||
|
<xs:element name="gender" type="gender"></xs:element>
|
||||||
|
<xs:element name="email" type="xs:string"></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:attribute name="name" type="shortName" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="value" type="xs:string" use="required"></xs:attribute>
|
||||||
|
<xs:attribute name="full_name" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="description" type="xs:string"></xs:attribute>
|
||||||
|
</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="^([^0-9*/^+\-=\s()?%:;!.,`'\"]){1,1}([^*/^+\-=\s()?%:;!.,`'\"]){0,}$"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="formatVersion">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
|
||||||
|
</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="gender">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="unknown"/>
|
||||||
|
<xs:enumeration value="male"/>
|
||||||
|
<xs:enumeration value="female"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:schema>
|
|
@ -40,8 +40,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
|
const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
|
||||||
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.0");
|
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.1");
|
||||||
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.0.xsd");
|
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.1.xsd");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVITConverter::VVITConverter(const QString &fileName)
|
VVITConverter::VVITConverter(const QString &fileName)
|
||||||
|
@ -89,6 +89,8 @@ QString VVITConverter::XSDSchema(int ver) const
|
||||||
case (0x000200):
|
case (0x000200):
|
||||||
return QStringLiteral("://schema/individual_measurements/v0.2.0.xsd");
|
return QStringLiteral("://schema/individual_measurements/v0.2.0.xsd");
|
||||||
case (0x000300):
|
case (0x000300):
|
||||||
|
return QStringLiteral("://schema/individual_measurements/v0.3.0.xsd");
|
||||||
|
case (0x000301):
|
||||||
return CurrentSchema;
|
return CurrentSchema;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
@ -113,6 +115,13 @@ void VVITConverter::ApplyPatches()
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
}
|
}
|
||||||
case (0x000300):
|
case (0x000300):
|
||||||
|
{
|
||||||
|
ToV0_3_1();
|
||||||
|
const QString schema = XSDSchema(0x000301);
|
||||||
|
ValidateXML(schema, fileName);
|
||||||
|
V_FALLTHROUGH
|
||||||
|
}
|
||||||
|
case (0x000301):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -213,6 +222,19 @@ QDomElement VVITConverter::AddMV0_3_0(const QString &name, qreal value)
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VVITConverter::GenderV0_3_1()
|
||||||
|
{
|
||||||
|
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("sex"));
|
||||||
|
QDomElement sex = nodeList.at(0).toElement();
|
||||||
|
|
||||||
|
QDomElement gender = createElement(QStringLiteral("gender"));
|
||||||
|
gender.appendChild(createTextNode(sex.text()));
|
||||||
|
|
||||||
|
QDomElement parent = sex.parentNode().toElement();
|
||||||
|
parent.replaceChild(gender, sex);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VVITConverter::ToV0_3_0()
|
void VVITConverter::ToV0_3_0()
|
||||||
{
|
{
|
||||||
|
@ -222,3 +244,11 @@ void VVITConverter::ToV0_3_0()
|
||||||
ConvertMeasurementsToV0_3_0();
|
ConvertMeasurementsToV0_3_0();
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VVITConverter::ToV0_3_1()
|
||||||
|
{
|
||||||
|
SetVersion(QStringLiteral("0.3.1"));
|
||||||
|
GenderV0_3_1();
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
|
@ -59,8 +59,10 @@ private:
|
||||||
QString MUnitV0_2_0();
|
QString MUnitV0_2_0();
|
||||||
void ConvertMeasurementsToV0_3_0();
|
void ConvertMeasurementsToV0_3_0();
|
||||||
QDomElement AddMV0_3_0(const QString &name, qreal value);
|
QDomElement AddMV0_3_0(const QString &name, qreal value);
|
||||||
|
void GenderV0_3_1();
|
||||||
|
|
||||||
void ToV0_3_0();
|
void ToV0_3_0();
|
||||||
|
void ToV0_3_1();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VVITCONVERTER_H
|
#endif // VVITCONVERTER_H
|
||||||
|
|
|
@ -43,7 +43,7 @@ const QString VMeasurements::TagPersonal = QStringLiteral("personal");
|
||||||
const QString VMeasurements::TagFamilyName = QStringLiteral("family-name");
|
const QString VMeasurements::TagFamilyName = QStringLiteral("family-name");
|
||||||
const QString VMeasurements::TagGivenName = QStringLiteral("given-name");
|
const QString VMeasurements::TagGivenName = QStringLiteral("given-name");
|
||||||
const QString VMeasurements::TagBirthDate = QStringLiteral("birth-date");
|
const QString VMeasurements::TagBirthDate = QStringLiteral("birth-date");
|
||||||
const QString VMeasurements::TagSex = QStringLiteral("sex");
|
const QString VMeasurements::TagGender = QStringLiteral("gender");
|
||||||
const QString VMeasurements::TagEmail = QStringLiteral("email");
|
const QString VMeasurements::TagEmail = QStringLiteral("email");
|
||||||
const QString VMeasurements::TagReadOnly = QStringLiteral("read-only");
|
const QString VMeasurements::TagReadOnly = QStringLiteral("read-only");
|
||||||
const QString VMeasurements::TagMeasurement = QStringLiteral("m");
|
const QString VMeasurements::TagMeasurement = QStringLiteral("m");
|
||||||
|
@ -56,9 +56,9 @@ const QString VMeasurements::AttrDescription = QStringLiteral("description");
|
||||||
const QString VMeasurements::AttrName = QStringLiteral("name");
|
const QString VMeasurements::AttrName = QStringLiteral("name");
|
||||||
const QString VMeasurements::AttrFullName = QStringLiteral("full_name");
|
const QString VMeasurements::AttrFullName = QStringLiteral("full_name");
|
||||||
|
|
||||||
const QString VMeasurements::SexMale = QStringLiteral("male");
|
const QString VMeasurements::GenderMale = QStringLiteral("male");
|
||||||
const QString VMeasurements::SexFemale = QStringLiteral("female");
|
const QString VMeasurements::GenderFemale = QStringLiteral("female");
|
||||||
const QString VMeasurements::SexUnknown = QStringLiteral("unknown");
|
const QString VMeasurements::GenderUnknown = QStringLiteral("unknown");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMeasurements::VMeasurements(VContainer *data)
|
VMeasurements::VMeasurements(VContainer *data)
|
||||||
|
@ -379,17 +379,17 @@ void VMeasurements::SetBirthDate(const QDate &date)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
SexType VMeasurements::Sex() const
|
GenderType VMeasurements::Gender() const
|
||||||
{
|
{
|
||||||
return StrToGender(UniqueTagText(TagSex, SexUnknown));
|
return StrToGender(UniqueTagText(TagGender, GenderUnknown));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMeasurements::SetSex(const SexType &sex)
|
void VMeasurements::SetGender(const GenderType &gender)
|
||||||
{
|
{
|
||||||
if (not ReadOnly())
|
if (not ReadOnly())
|
||||||
{
|
{
|
||||||
setTagText(TagSex, GenderToStr(sex));
|
setTagText(TagGender, GenderToStr(gender));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,33 +533,33 @@ void VMeasurements::SetMFullName(const QString &name, const QString &text)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VMeasurements::GenderToStr(const SexType &sex)
|
QString VMeasurements::GenderToStr(const GenderType &sex)
|
||||||
{
|
{
|
||||||
switch (sex)
|
switch (sex)
|
||||||
{
|
{
|
||||||
case SexType::Male:
|
case GenderType::Male:
|
||||||
return SexMale;
|
return GenderMale;
|
||||||
case SexType::Female:
|
case GenderType::Female:
|
||||||
return SexFemale;
|
return GenderFemale;
|
||||||
case SexType::Unknown:
|
case GenderType::Unknown:
|
||||||
default:
|
default:
|
||||||
return SexUnknown;
|
return GenderUnknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
SexType VMeasurements::StrToGender(const QString &sex)
|
GenderType VMeasurements::StrToGender(const QString &sex)
|
||||||
{
|
{
|
||||||
const QStringList genders = QStringList() << SexMale << SexFemale << SexUnknown;
|
const QStringList genders = QStringList() << GenderMale << GenderFemale << GenderUnknown;
|
||||||
switch (genders.indexOf(sex))
|
switch (genders.indexOf(sex))
|
||||||
{
|
{
|
||||||
case 0: // SexMale
|
case 0: // GenderMale
|
||||||
return SexType::Male;
|
return GenderType::Male;
|
||||||
case 1: // SexFemale
|
case 1: // GenderFemale
|
||||||
return SexType::Female;
|
return GenderType::Female;
|
||||||
case 2: // SexUnknown
|
case 2: // GenderUnknown
|
||||||
default:
|
default:
|
||||||
return SexType::Unknown;
|
return GenderType::Unknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,10 +705,9 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
||||||
date.appendChild(newDate);
|
date.appendChild(newDate);
|
||||||
personal.appendChild(date);
|
personal.appendChild(date);
|
||||||
|
|
||||||
QDomElement sex = createElement(TagSex);
|
QDomElement gender = createElement(TagGender);
|
||||||
const QDomText newSex = createTextNode(GenderToStr(SexType::Unknown));
|
gender.appendChild(createTextNode(GenderToStr(GenderType::Unknown)));
|
||||||
sex.appendChild(newSex);
|
personal.appendChild(gender);
|
||||||
personal.appendChild(sex);
|
|
||||||
|
|
||||||
personal.appendChild(createElement(TagEmail));
|
personal.appendChild(createElement(TagEmail));
|
||||||
mElement.appendChild(personal);
|
mElement.appendChild(personal);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
|
||||||
enum class SexType : char { Male, Female, Unknown };
|
enum class GenderType : char { Male, Female, Unknown };
|
||||||
|
|
||||||
class VMeasurements : public VDomDocument
|
class VMeasurements : public VDomDocument
|
||||||
{
|
{
|
||||||
|
@ -72,8 +72,8 @@ public:
|
||||||
QDate BirthDate() const;
|
QDate BirthDate() const;
|
||||||
void SetBirthDate(const QDate &date);
|
void SetBirthDate(const QDate &date);
|
||||||
|
|
||||||
SexType Sex() const;
|
GenderType Gender() const;
|
||||||
void SetSex(const SexType &sex);
|
void SetGender(const GenderType &gender);
|
||||||
|
|
||||||
QString Email() const;
|
QString Email() const;
|
||||||
void SetEmail(const QString &text);
|
void SetEmail(const QString &text);
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
static const QString TagFamilyName;
|
static const QString TagFamilyName;
|
||||||
static const QString TagGivenName;
|
static const QString TagGivenName;
|
||||||
static const QString TagBirthDate;
|
static const QString TagBirthDate;
|
||||||
static const QString TagSex;
|
static const QString TagGender;
|
||||||
static const QString TagEmail;
|
static const QString TagEmail;
|
||||||
static const QString TagReadOnly;
|
static const QString TagReadOnly;
|
||||||
static const QString TagMeasurement;
|
static const QString TagMeasurement;
|
||||||
|
@ -113,12 +113,12 @@ public:
|
||||||
static const QString AttrName;
|
static const QString AttrName;
|
||||||
static const QString AttrFullName;
|
static const QString AttrFullName;
|
||||||
|
|
||||||
static const QString SexMale;
|
static const QString GenderMale;
|
||||||
static const QString SexFemale;
|
static const QString GenderFemale;
|
||||||
static const QString SexUnknown;
|
static const QString GenderUnknown;
|
||||||
|
|
||||||
static QString GenderToStr(const SexType &sex);
|
static QString GenderToStr(const GenderType &sex);
|
||||||
static SexType StrToGender(const QString &sex);
|
static GenderType StrToGender(const QString &sex);
|
||||||
|
|
||||||
QStringList ListAll() const;
|
QStringList ListAll() const;
|
||||||
QStringList ListKnown() const;
|
QStringList ListKnown() const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user