Show pattern making system in tab Information of a measurement file.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-16 20:26:05 +03:00
parent 37f11e732d
commit ff768c1c0f
16 changed files with 468 additions and 109 deletions

View File

@ -238,80 +238,6 @@ void TapeConfigurationPage::SetLabelComboBox(const QStringList &list)
}
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigurationPage::InitPMSystems(QComboBox *systemCombo)
{
QMap<QString, QString> systems;
systems.insert(qApp->TrVars()->PMSystemName(p0_S), p0_S);
systems.insert(qApp->TrVars()->PMSystemName(p1_S), p1_S);
systems.insert(qApp->TrVars()->PMSystemName(p2_S), p2_S);
systems.insert(qApp->TrVars()->PMSystemName(p3_S), p3_S);
systems.insert(qApp->TrVars()->PMSystemName(p4_S), p4_S);
systems.insert(qApp->TrVars()->PMSystemName(p5_S), p5_S);
systems.insert(qApp->TrVars()->PMSystemName(p6_S), p6_S);
systems.insert(qApp->TrVars()->PMSystemName(p7_S), p7_S);
systems.insert(qApp->TrVars()->PMSystemName(p8_S), p8_S);
systems.insert(qApp->TrVars()->PMSystemName(p9_S), p9_S);
systems.insert(qApp->TrVars()->PMSystemName(p10_S), p10_S);
systems.insert(qApp->TrVars()->PMSystemName(p11_S), p11_S);
systems.insert(qApp->TrVars()->PMSystemName(p12_S), p12_S);
systems.insert(qApp->TrVars()->PMSystemName(p13_S), p13_S);
systems.insert(qApp->TrVars()->PMSystemName(p14_S), p14_S);
systems.insert(qApp->TrVars()->PMSystemName(p15_S), p15_S);
systems.insert(qApp->TrVars()->PMSystemName(p16_S), p16_S);
systems.insert(qApp->TrVars()->PMSystemName(p17_S), p17_S);
systems.insert(qApp->TrVars()->PMSystemName(p18_S), p18_S);
systems.insert(qApp->TrVars()->PMSystemName(p19_S), p19_S);
systems.insert(qApp->TrVars()->PMSystemName(p20_S), p20_S);
systems.insert(qApp->TrVars()->PMSystemName(p21_S), p21_S);
systems.insert(qApp->TrVars()->PMSystemName(p22_S), p22_S);
systems.insert(qApp->TrVars()->PMSystemName(p23_S), p23_S);
systems.insert(qApp->TrVars()->PMSystemName(p24_S), p24_S);
systems.insert(qApp->TrVars()->PMSystemName(p25_S), p25_S);
systems.insert(qApp->TrVars()->PMSystemName(p26_S), p26_S);
systems.insert(qApp->TrVars()->PMSystemName(p27_S), p27_S);
systems.insert(qApp->TrVars()->PMSystemName(p28_S), p28_S);
systems.insert(qApp->TrVars()->PMSystemName(p29_S), p29_S);
systems.insert(qApp->TrVars()->PMSystemName(p30_S), p30_S);
systems.insert(qApp->TrVars()->PMSystemName(p31_S), p31_S);
systems.insert(qApp->TrVars()->PMSystemName(p32_S), p32_S);
systems.insert(qApp->TrVars()->PMSystemName(p33_S), p33_S);
systems.insert(qApp->TrVars()->PMSystemName(p34_S), p34_S);
systems.insert(qApp->TrVars()->PMSystemName(p35_S), p35_S);
systems.insert(qApp->TrVars()->PMSystemName(p36_S), p36_S);
systems.insert(qApp->TrVars()->PMSystemName(p37_S), p37_S);
systems.insert(qApp->TrVars()->PMSystemName(p38_S), p38_S);
systems.insert(qApp->TrVars()->PMSystemName(p39_S), p39_S);
systems.insert(qApp->TrVars()->PMSystemName(p40_S), p40_S);
systems.insert(qApp->TrVars()->PMSystemName(p41_S), p41_S);
systems.insert(qApp->TrVars()->PMSystemName(p42_S), p42_S);
systems.insert(qApp->TrVars()->PMSystemName(p43_S), p43_S);
systems.insert(qApp->TrVars()->PMSystemName(p44_S), p44_S);
systems.insert(qApp->TrVars()->PMSystemName(p45_S), p45_S);
systems.insert(qApp->TrVars()->PMSystemName(p46_S), p46_S);
systems.insert(qApp->TrVars()->PMSystemName(p47_S), p47_S);
systems.insert(qApp->TrVars()->PMSystemName(p48_S), p48_S);
systems.insert(qApp->TrVars()->PMSystemName(p49_S), p49_S);
systems.insert(qApp->TrVars()->PMSystemName(p50_S), p50_S);
systems.insert(qApp->TrVars()->PMSystemName(p51_S), p51_S);
systems.insert(qApp->TrVars()->PMSystemName(p52_S), p52_S);
systems.insert(qApp->TrVars()->PMSystemName(p53_S), p53_S);
systems.insert(qApp->TrVars()->PMSystemName(p54_S), p54_S);
// * The default option (blank field or 'None') should appear at the top of the list.
// * The list should be sorted alphabetically so users can find their system easily.
// * 'None' would be in the middle of an alphabetically sorted list.
systemCombo->addItem(qApp->TrVars()->PMSystemName(p998_S), p998_S);
QMap<QString, QString>::const_iterator i = systems.constBegin();
while (i != systems.constEnd())
{
systemCombo->addItem(i.key(), i.value());
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigurationPage::RetranslateUi()
{

View File

@ -77,7 +77,6 @@ private:
QGroupBox *LangGroup();
void SetLabelComboBox(const QStringList &list);
void InitPMSystems(QComboBox *systemCombo);
void RetranslateUi();
};

View File

@ -73,7 +73,10 @@ TMainWindow::TMainWindow(QWidget *parent)
comboBoxUnits(nullptr),
formulaBaseHeight(0),
lock(nullptr),
search()
search(),
labelGradationHeights(nullptr),
labelGradationSizes(nullptr),
labelPatternUnit(nullptr)
{
ui->setupUi(this);
search = QSharedPointer<VTableSearch>(new VTableSearch(ui->tableWidget));
@ -118,6 +121,7 @@ void TMainWindow::RetranslateTable()
{
const int row = ui->tableWidget->currentRow();
RefreshTable();
ShowUnits();
ui->tableWidget->selectRow(row);
}
}
@ -447,6 +451,49 @@ void TMainWindow::changeEvent(QEvent *event)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
if (mType == MeasurementsType::Standard)
{
ui->labelMType->setText(tr("Standard measurements"));
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + " " +
VDomDocument::UnitsToStr(m->MUnit(), true));
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + " " +
VDomDocument::UnitsToStr(m->MUnit(), true));
labelGradationHeights = new QLabel(tr("Height: "));
labelGradationSizes = new QLabel(tr("Size: "));
}
else
{
ui->labelMType->setText(tr("Individual measurements"));
const qint32 index = ui->comboBoxGender->currentIndex();
ui->comboBoxGender->blockSignals(true);
ui->comboBoxGender->clear();
InitGender(ui->comboBoxGender);
ui->comboBoxGender->setCurrentIndex(index);
ui->comboBoxGender->blockSignals(false);
}
{
const qint32 index = ui->comboBoxPMSystem->currentIndex();
ui->comboBoxPMSystem->blockSignals(true);
ui->comboBoxPMSystem->clear();
InitPMSystems(ui->comboBoxPMSystem);
ui->comboBoxPMSystem->setCurrentIndex(index);
ui->comboBoxPMSystem->blockSignals(false);
}
{
labelPatternUnit = new QLabel(tr("Pattern unit:"));
const qint32 index = comboBoxUnits->currentIndex();
comboBoxUnits->blockSignals(true);
comboBoxUnits->clear();
InitComboBoxUnits();
comboBoxUnits->setCurrentIndex(index);
comboBoxUnits->blockSignals(false);
}
}
// remember to call base class implementation
@ -676,6 +723,19 @@ void TMainWindow::SaveNotes()
}
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SavePMSystem(int index)
{
QString system = ui->comboBoxPMSystem->itemData(index).toString();
system.remove(0, 1);// clear p
if (m->PMSystem() != system)
{
m->SetPMSystem(system);
MeasurementsWasSaved(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::ReadOnly(bool ro)
{
@ -1667,12 +1727,14 @@ void TMainWindow::InitWindow()
const QStringList listHeights = VMeasurement::WholeListHeights(mUnit);
const QStringList listSizes = VMeasurement::WholeListSizes(mUnit);
gradationHeights = SetGradationList(tr("Height: "), listHeights);
labelGradationHeights = new QLabel(tr("Height: "));
gradationHeights = SetGradationList(labelGradationHeights, listHeights);
SetDefaultHeight(static_cast<int>(data->height()));
connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &TMainWindow::ChangedHeight);
gradationSizes = SetGradationList(tr("Size: "), listSizes);
labelGradationSizes = new QLabel(tr("Size: "));
gradationSizes = SetGradationList(labelGradationSizes, listSizes);
SetDefaultSize(static_cast<int>(data->size()));
connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &TMainWindow::ChangedSize);
@ -1729,9 +1791,8 @@ void TMainWindow::InitWindow()
ui->lineEditGivenName->setText(m->GivenName());
ui->lineEditFamilyName->setText(m->FamilyName());
ui->comboBoxGender->addItem(tr("unknown", "gender"), QVariant(static_cast<int>(GenderType::Unknown)));
ui->comboBoxGender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
ui->comboBoxGender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
ui->comboBoxGender->clear();
InitGender(ui->comboBoxGender);
const qint32 index = ui->comboBoxGender->findData(static_cast<int>(m->Gender()));
ui->comboBoxGender->setCurrentIndex(index);
@ -1753,6 +1814,14 @@ void TMainWindow::InitWindow()
connect(ui->toolButtonExpr, &QToolButton::clicked, this, &TMainWindow::Fx);
}
ui->comboBoxPMSystem->setEnabled(true);
ui->comboBoxPMSystem->clear();
InitPMSystems(ui->comboBoxPMSystem);
const qint32 index = ui->comboBoxPMSystem->findData(QLatin1Char('p')+m->PMSystem());
ui->comboBoxPMSystem->setCurrentIndex(index);
connect(ui->comboBoxPMSystem, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&TMainWindow::SavePMSystem);
connect(ui->lineEditFind, &QLineEdit::textEdited, this, &TMainWindow::Find);
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, &TMainWindow::FindPrevious);
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, &TMainWindow::FindNext);
@ -1937,9 +2006,9 @@ QTableWidgetItem *TMainWindow::AddCell(const QString &text, int row, int column,
}
//---------------------------------------------------------------------------------------------------------------------
QComboBox *TMainWindow::SetGradationList(const QString &label, const QStringList &list)
QComboBox *TMainWindow::SetGradationList(QLabel *label, const QStringList &list)
{
ui->toolBarGradation->addWidget(new QLabel(label));
ui->toolBarGradation->addWidget(label);
QComboBox *comboBox = new QComboBox;
comboBox->addItems(list);
@ -2253,6 +2322,8 @@ void TMainWindow::GUIReadOnly(bool ro)
ui->lineEditEmail->setReadOnly(ro);
}
ui->comboBoxPMSystem->setDisabled(ro);
MeasurementReadOnly(ro);
}
@ -2521,12 +2592,11 @@ void TMainWindow::SetDecimals()
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitUnits()
{
ui->toolBarGradation->addWidget(new QLabel(tr("Pattern unit:")));
labelPatternUnit = new QLabel(tr("Pattern unit:"));
ui->toolBarGradation->addWidget(labelPatternUnit);
comboBoxUnits = new QComboBox(this);
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Cm, true), QVariant(static_cast<int>(Unit::Cm)));
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Mm, true), QVariant(static_cast<int>(Unit::Mm)));
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Inch, true), QVariant(static_cast<int>(Unit::Inch)));
InitComboBoxUnits();
// set default unit
const qint32 indexUnit = comboBoxUnits->findData(static_cast<int>(pUnit));
@ -2541,6 +2611,24 @@ void TMainWindow::InitUnits()
ui->toolBarGradation->addWidget(comboBoxUnits);
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitComboBoxUnits()
{
SCASSERT(comboBoxUnits != nullptr);
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Cm, true), QVariant(static_cast<int>(Unit::Cm)));
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Mm, true), QVariant(static_cast<int>(Unit::Mm)));
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Inch, true), QVariant(static_cast<int>(Unit::Inch)));
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitGender(QComboBox *gender)
{
SCASSERT(gender != nullptr);
gender->addItem(tr("unknown", "gender"), QVariant(static_cast<int>(GenderType::Unknown)));
gender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::ShowInGraphicalShell()
{

View File

@ -87,6 +87,7 @@ private slots:
void SaveGender(int index);
void SaveBirthDate(const QDate & date);
void SaveNotes();
void SavePMSystem(int index);
void ReadOnly(bool ro);
void Remove();
@ -138,12 +139,17 @@ private:
int formulaBaseHeight;
VLockGuardPtr<char> lock;
QSharedPointer<VTableSearch> search;
QLabel *labelGradationHeights;
QLabel *labelGradationSizes;
QLabel *labelPatternUnit;
void SetupMenu();
void InitWindow();
void InitTable();
void SetDecimals();
void InitUnits();
void InitComboBoxUnits();
void InitGender(QComboBox *gender);
void ShowUnits();
void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit);
@ -156,7 +162,7 @@ private:
QTableWidgetItem *AddCell(const QString &text, int row, int column, int aligment, bool ok = true);
QComboBox *SetGradationList(const QString &label, const QStringList &list);
QComboBox *SetGradationList(QLabel *label, const QStringList &list);
void SetDefaultHeight(int value);
void SetDefaultSize(int value);

View File

@ -566,70 +566,70 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="labelBaseSize">
<property name="text">
<string>Base size:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="labelBaseSizeValue">
<property name="text">
<string>Base size value</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="labelBaseHeight">
<property name="text">
<string>Base height:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLabel" name="labelBaseHeightValue">
<property name="text">
<string>Base height value</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="labelGivenName">
<property name="text">
<string>Given name:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditGivenName">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="labelFamilyName">
<property name="text">
<string>Family name:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditFamilyName">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="labelBirthDate">
<property name="text">
<string>Birth date:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QDateEdit" name="dateEditBirthDate">
<property name="enabled">
<bool>false</bool>
@ -652,42 +652,42 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="labelGender">
<property name="text">
<string>Gender:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="comboBoxGender">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="labelEmail">
<property name="text">
<string>Email:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QLineEdit" name="lineEditEmail">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="labelNotes">
<property name="text">
<string>Notes:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QPlainTextEdit" name="plainTextEditNotes">
<property name="enabled">
<bool>false</bool>
@ -700,6 +700,20 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPMSystem">
<property name="text">
<string>PM system:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxPMSystem">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -8,8 +8,10 @@
<file>schema/pattern/v0.2.0.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_measurements/v0.4.1.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.1.xsd</file>
<file>schema/individual_measurements/v0.3.2.xsd</file>
</qresource>
</RCC>

View File

@ -0,0 +1,72 @@
<?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="pm_system" type="psCode"></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()?%:;!.,`'\&quot;]){1,1}([^*/^+\-=\s()?%:;!.,`'\&quot;]){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: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:schema>

View 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="vst">
<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="pm_system" type="psCode"></xs:element>
<xs:element name="size">
<xs:complexType>
<xs:attribute name="base" type="xs:double" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="height">
<xs:complexType>
<xs:attribute name="base" type="xs:double" use="required"></xs:attribute>
</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="base" type="xs:double" use="required"></xs:attribute>
<xs:attribute name="height_increase" type="xs:double" use="required"></xs:attribute>
<xs:attribute name="size_increase" type="xs:double" 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()?%:;!.,`'\&quot;]){1,1}([^*/^+\-=\s()?%:;!.,`'\&quot;]){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|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</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:schema>

View File

@ -40,8 +40,8 @@
*/
const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.1");
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.1.xsd");
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.2");
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.2.xsd");
//---------------------------------------------------------------------------------------------------------------------
VVITConverter::VVITConverter(const QString &fileName)
@ -91,6 +91,8 @@ QString VVITConverter::XSDSchema(int ver) const
case (0x000300):
return QStringLiteral("://schema/individual_measurements/v0.3.0.xsd");
case (0x000301):
return QStringLiteral("://schema/individual_measurements/v0.3.1.xsd");
case (0x000302):
return CurrentSchema;
default:
{
@ -122,6 +124,13 @@ void VVITConverter::ApplyPatches()
V_FALLTHROUGH
}
case (0x000301):
{
ToV0_3_2();
const QString schema = XSDSchema(0x000302);
ValidateXML(schema, fileName);
V_FALLTHROUGH
}
case (0x000302):
break;
default:
break;
@ -235,6 +244,19 @@ void VVITConverter::GenderV0_3_1()
parent.replaceChild(gender, sex);
}
//---------------------------------------------------------------------------------------------------------------------
void VVITConverter::PM_SystemV0_3_2()
{
QDomElement pm_system = createElement(QStringLiteral("pm_system"));
pm_system.appendChild(createTextNode(QStringLiteral("998")));
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("personal"));
QDomElement personal = nodeList.at(0).toElement();
QDomElement parent = personal.parentNode().toElement();
parent.insertBefore(pm_system, personal);
}
//---------------------------------------------------------------------------------------------------------------------
void VVITConverter::ToV0_3_0()
{
@ -252,3 +274,11 @@ void VVITConverter::ToV0_3_1()
GenderV0_3_1();
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VVITConverter::ToV0_3_2()
{
SetVersion(QStringLiteral("0.3.2"));
PM_SystemV0_3_2();
Save();
}

View File

@ -60,9 +60,11 @@ private:
void ConvertMeasurementsToV0_3_0();
QDomElement AddMV0_3_0(const QString &name, qreal value);
void GenderV0_3_1();
void PM_SystemV0_3_2();
void ToV0_3_0();
void ToV0_3_1();
void ToV0_3_2();
};
#endif // VVITCONVERTER_H

View File

@ -40,8 +40,8 @@
*/
const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.0");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.0.xsd");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.1");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.1.xsd");
//---------------------------------------------------------------------------------------------------------------------
VVSTConverter::VVSTConverter(const QString &fileName)
@ -89,6 +89,8 @@ QString VVSTConverter::XSDSchema(int ver) const
case (0x000300):
return QStringLiteral("://schema/standard_measurements/v0.3.0.xsd");
case (0x000400):
return QStringLiteral("://schema/standard_measurements/v0.4.0.xsd");
case (0x000401):
return CurrentSchema;
default:
{
@ -113,6 +115,13 @@ void VVSTConverter::ApplyPatches()
V_FALLTHROUGH
}
case (0x000400):
{
ToV0_4_1();
const QString schema = XSDSchema(0x000401);
ValidateXML(schema, fileName);
V_FALLTHROUGH
}
case (0x000401):
break;
default:
break;
@ -241,6 +250,19 @@ QDomElement VVSTConverter::AddMV0_4_0(const QString &name, qreal value, qreal si
return element;
}
//---------------------------------------------------------------------------------------------------------------------
void VVSTConverter::PM_SystemV0_4_1()
{
QDomElement pm_system = createElement(QStringLiteral("pm_system"));
pm_system.appendChild(createTextNode(QStringLiteral("998")));
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("size"));
QDomElement personal = nodeList.at(0).toElement();
QDomElement parent = personal.parentNode().toElement();
parent.insertBefore(pm_system, personal);
}
//---------------------------------------------------------------------------------------------------------------------
void VVSTConverter::ToV0_4_0()
{
@ -251,3 +273,11 @@ void VVSTConverter::ToV0_4_0()
ConvertMeasurementsToV0_4_0();
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VVSTConverter::ToV0_4_1()
{
SetVersion(QStringLiteral("0.4.1"));
PM_SystemV0_4_1();
Save();
}

View File

@ -59,8 +59,10 @@ private:
void RemoveTagsForV0_4_0();
void ConvertMeasurementsToV0_4_0();
QDomElement AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease);
void PM_SystemV0_4_1();
void ToV0_4_0();
void ToV0_4_1();
};
#endif // VMEASUREMENTCONVERTER_H

View File

@ -45,6 +45,7 @@ const QString VMeasurements::TagFamilyName = QStringLiteral("family-name")
const QString VMeasurements::TagGivenName = QStringLiteral("given-name");
const QString VMeasurements::TagBirthDate = QStringLiteral("birth-date");
const QString VMeasurements::TagGender = QStringLiteral("gender");
const QString VMeasurements::TagPMSystem = QStringLiteral("pm_system");
const QString VMeasurements::TagEmail = QStringLiteral("email");
const QString VMeasurements::TagReadOnly = QStringLiteral("read-only");
const QString VMeasurements::TagMeasurement = QStringLiteral("m");
@ -411,6 +412,21 @@ void VMeasurements::SetGender(const GenderType &gender)
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VMeasurements::PMSystem() const
{
return UniqueTagText(TagPMSystem, ClearPMCode(p998_S));
}
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetPMSystem(const QString &system)
{
if (not ReadOnly())
{
setTagText(TagPMSystem, ClearPMCode(system));
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VMeasurements::Email() const
{
@ -676,6 +692,10 @@ void VMeasurements::CreateEmptyStandardFile(Unit unit, int baseSize, int baseHei
mUnit.appendChild(unitText);
mElement.appendChild(mUnit);
QDomElement system = createElement(TagPMSystem);
system.appendChild(createTextNode(ClearPMCode(p998_S)));
mElement.appendChild(system);
QDomElement size = createElement(TagSize);
SetAttribute(size, AttrBase, QString().setNum(baseSize));
mElement.appendChild(size);
@ -714,6 +734,10 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
mUnit.appendChild(createTextNode(UnitsToStr(unit)));
mElement.appendChild(mUnit);
QDomElement system = createElement(TagPMSystem);
system.appendChild(createTextNode(ClearPMCode(p998_S)));
mElement.appendChild(system);
QDomElement personal = createElement(TagPersonal);
personal.appendChild(createElement(TagFamilyName));
personal.appendChild(createElement(TagGivenName));
@ -862,3 +886,15 @@ qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool
}
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VMeasurements::ClearPMCode(const QString &code) const
{
QString clear = code;
const int index = clear.indexOf(QLatin1Char('p'));
if (index == 0)
{
clear.remove(0, 1);
}
return clear;
}

View File

@ -76,6 +76,9 @@ public:
GenderType Gender() const;
void SetGender(const GenderType &gender);
QString PMSystem() const;
void SetPMSystem(const QString &system);
QString Email() const;
void SetEmail(const QString &text);
@ -102,6 +105,7 @@ public:
static const QString TagGivenName;
static const QString TagBirthDate;
static const QString TagGender;
static const QString TagPMSystem;
static const QString TagEmail;
static const QString TagReadOnly;
static const QString TagMeasurement;
@ -146,6 +150,8 @@ private:
MeasurementsType ReadType() const;
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
QString ClearPMCode(const QString &code) const;
};
#endif // VMEASUREMENTS_H

View File

@ -27,8 +27,10 @@
*************************************************************************/
#include "def.h"
#include "vabstractapplication.h"
#include "../vpatterndb/vtranslatevars.h"
#include <QApplication>
#include <QComboBox>
// Keep synchronize all names with initialization in VTranslateVars class!!!!!
//measurements
@ -966,3 +968,77 @@ QStringList AllGroupNames()
return originalNames;
}
//---------------------------------------------------------------------------------------------------------------------
void InitPMSystems(QComboBox *systemCombo)
{
QMap<QString, QString> systems;
systems.insert(qApp->TrVars()->PMSystemName(p0_S), p0_S);
systems.insert(qApp->TrVars()->PMSystemName(p1_S), p1_S);
systems.insert(qApp->TrVars()->PMSystemName(p2_S), p2_S);
systems.insert(qApp->TrVars()->PMSystemName(p3_S), p3_S);
systems.insert(qApp->TrVars()->PMSystemName(p4_S), p4_S);
systems.insert(qApp->TrVars()->PMSystemName(p5_S), p5_S);
systems.insert(qApp->TrVars()->PMSystemName(p6_S), p6_S);
systems.insert(qApp->TrVars()->PMSystemName(p7_S), p7_S);
systems.insert(qApp->TrVars()->PMSystemName(p8_S), p8_S);
systems.insert(qApp->TrVars()->PMSystemName(p9_S), p9_S);
systems.insert(qApp->TrVars()->PMSystemName(p10_S), p10_S);
systems.insert(qApp->TrVars()->PMSystemName(p11_S), p11_S);
systems.insert(qApp->TrVars()->PMSystemName(p12_S), p12_S);
systems.insert(qApp->TrVars()->PMSystemName(p13_S), p13_S);
systems.insert(qApp->TrVars()->PMSystemName(p14_S), p14_S);
systems.insert(qApp->TrVars()->PMSystemName(p15_S), p15_S);
systems.insert(qApp->TrVars()->PMSystemName(p16_S), p16_S);
systems.insert(qApp->TrVars()->PMSystemName(p17_S), p17_S);
systems.insert(qApp->TrVars()->PMSystemName(p18_S), p18_S);
systems.insert(qApp->TrVars()->PMSystemName(p19_S), p19_S);
systems.insert(qApp->TrVars()->PMSystemName(p20_S), p20_S);
systems.insert(qApp->TrVars()->PMSystemName(p21_S), p21_S);
systems.insert(qApp->TrVars()->PMSystemName(p22_S), p22_S);
systems.insert(qApp->TrVars()->PMSystemName(p23_S), p23_S);
systems.insert(qApp->TrVars()->PMSystemName(p24_S), p24_S);
systems.insert(qApp->TrVars()->PMSystemName(p25_S), p25_S);
systems.insert(qApp->TrVars()->PMSystemName(p26_S), p26_S);
systems.insert(qApp->TrVars()->PMSystemName(p27_S), p27_S);
systems.insert(qApp->TrVars()->PMSystemName(p28_S), p28_S);
systems.insert(qApp->TrVars()->PMSystemName(p29_S), p29_S);
systems.insert(qApp->TrVars()->PMSystemName(p30_S), p30_S);
systems.insert(qApp->TrVars()->PMSystemName(p31_S), p31_S);
systems.insert(qApp->TrVars()->PMSystemName(p32_S), p32_S);
systems.insert(qApp->TrVars()->PMSystemName(p33_S), p33_S);
systems.insert(qApp->TrVars()->PMSystemName(p34_S), p34_S);
systems.insert(qApp->TrVars()->PMSystemName(p35_S), p35_S);
systems.insert(qApp->TrVars()->PMSystemName(p36_S), p36_S);
systems.insert(qApp->TrVars()->PMSystemName(p37_S), p37_S);
systems.insert(qApp->TrVars()->PMSystemName(p38_S), p38_S);
systems.insert(qApp->TrVars()->PMSystemName(p39_S), p39_S);
systems.insert(qApp->TrVars()->PMSystemName(p40_S), p40_S);
systems.insert(qApp->TrVars()->PMSystemName(p41_S), p41_S);
systems.insert(qApp->TrVars()->PMSystemName(p42_S), p42_S);
systems.insert(qApp->TrVars()->PMSystemName(p43_S), p43_S);
systems.insert(qApp->TrVars()->PMSystemName(p44_S), p44_S);
systems.insert(qApp->TrVars()->PMSystemName(p45_S), p45_S);
systems.insert(qApp->TrVars()->PMSystemName(p46_S), p46_S);
systems.insert(qApp->TrVars()->PMSystemName(p47_S), p47_S);
systems.insert(qApp->TrVars()->PMSystemName(p48_S), p48_S);
systems.insert(qApp->TrVars()->PMSystemName(p49_S), p49_S);
systems.insert(qApp->TrVars()->PMSystemName(p50_S), p50_S);
systems.insert(qApp->TrVars()->PMSystemName(p51_S), p51_S);
systems.insert(qApp->TrVars()->PMSystemName(p52_S), p52_S);
systems.insert(qApp->TrVars()->PMSystemName(p53_S), p53_S);
systems.insert(qApp->TrVars()->PMSystemName(p54_S), p54_S);
// * The default option (blank field or 'None') should appear at the top of the list.
// * The list should be sorted alphabetically so users can find their system easily.
SCASSERT(systemCombo != nullptr);
systemCombo->addItem(qApp->TrVars()->PMSystemName(p998_S), p998_S);
QMap<QString, QString>::const_iterator i = systems.constBegin();
while (i != systems.constEnd())
{
systemCombo->addItem(i.key(), i.value());
++i;
}
}

View File

@ -38,6 +38,8 @@
#include "debugbreak.h"
class QComboBox;
#define SceneSize 50000
#define DefPointRadius 1.5//mm
@ -517,6 +519,8 @@ extern const QString p53_S;
extern const QString p54_S;
extern const QString p998_S;
void InitPMSystems(QComboBox *systemCombo);
// functions
extern const QString sin_F;
extern const QString cos_F;