Merge with develop.
--HG-- branch : feature
This commit is contained in:
commit
795438c202
|
@ -110,8 +110,7 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
ui->lineEditFind->setClearButtonEnabled(true);
|
ui->lineEditFind->setClearButtonEnabled(true);
|
||||||
ui->lineEditName->setClearButtonEnabled(true);
|
ui->lineEditName->setClearButtonEnabled(true);
|
||||||
ui->lineEditFullName->setClearButtonEnabled(true);
|
ui->lineEditFullName->setClearButtonEnabled(true);
|
||||||
ui->lineEditGivenName->setClearButtonEnabled(true);
|
ui->lineEditCustomerName->setClearButtonEnabled(true);
|
||||||
ui->lineEditFamilyName->setClearButtonEnabled(true);
|
|
||||||
ui->lineEditEmail->setClearButtonEnabled(true);
|
ui->lineEditEmail->setClearButtonEnabled(true);
|
||||||
|
|
||||||
ui->lineEditFind->installEventFilter(this);
|
ui->lineEditFind->installEventFilter(this);
|
||||||
|
@ -990,21 +989,11 @@ void TMainWindow::OpenAt(QAction *where)
|
||||||
#endif //defined(Q_OS_MAC)
|
#endif //defined(Q_OS_MAC)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::SaveGivenName()
|
void TMainWindow::SaveCustomerName()
|
||||||
{
|
{
|
||||||
if (m->GivenName() != ui->lineEditGivenName->text())
|
if (m->Customer() != ui->lineEditCustomerName->text())
|
||||||
{
|
{
|
||||||
m->SetGivenName(ui->lineEditGivenName->text());
|
m->SetCustomer(ui->lineEditCustomerName->text());
|
||||||
MeasurementsWasSaved(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TMainWindow::SaveFamilyName()
|
|
||||||
{
|
|
||||||
if (m->FamilyName() != ui->lineEditFamilyName->text())
|
|
||||||
{
|
|
||||||
m->SetFamilyName(ui->lineEditFamilyName->text());
|
|
||||||
MeasurementsWasSaved(false);
|
MeasurementsWasSaved(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2019,12 +2008,10 @@ void TMainWindow::InitWindow()
|
||||||
HackWidget(&ui->pushButtonGrow);
|
HackWidget(&ui->pushButtonGrow);
|
||||||
|
|
||||||
// Tab Information
|
// Tab Information
|
||||||
HackWidget(&ui->lineEditGivenName);
|
HackWidget(&ui->lineEditCustomerName);
|
||||||
HackWidget(&ui->lineEditFamilyName);
|
|
||||||
HackWidget(&ui->comboBoxGender);
|
HackWidget(&ui->comboBoxGender);
|
||||||
HackWidget(&ui->lineEditEmail);
|
HackWidget(&ui->lineEditEmail);
|
||||||
HackWidget(&ui->labelGivenName);
|
HackWidget(&ui->labelCustomerName);
|
||||||
HackWidget(&ui->labelFamilyName);
|
|
||||||
HackWidget(&ui->labelBirthDate);
|
HackWidget(&ui->labelBirthDate);
|
||||||
HackWidget(&ui->dateEditBirthDate);
|
HackWidget(&ui->dateEditBirthDate);
|
||||||
HackWidget(&ui->labelGender);
|
HackWidget(&ui->labelGender);
|
||||||
|
@ -2061,8 +2048,7 @@ void TMainWindow::InitWindow()
|
||||||
{
|
{
|
||||||
ui->labelMType->setText(tr("Individual measurements"));
|
ui->labelMType->setText(tr("Individual measurements"));
|
||||||
|
|
||||||
ui->lineEditGivenName->setEnabled(true);
|
ui->lineEditCustomerName->setEnabled(true);
|
||||||
ui->lineEditFamilyName->setEnabled(true);
|
|
||||||
ui->dateEditBirthDate->setEnabled(true);
|
ui->dateEditBirthDate->setEnabled(true);
|
||||||
ui->comboBoxGender->setEnabled(true);
|
ui->comboBoxGender->setEnabled(true);
|
||||||
ui->lineEditEmail->setEnabled(true);
|
ui->lineEditEmail->setEnabled(true);
|
||||||
|
@ -2081,8 +2067,7 @@ void TMainWindow::InitWindow()
|
||||||
HackWidget(&ui->labelBaseHeight);
|
HackWidget(&ui->labelBaseHeight);
|
||||||
HackWidget(&ui->labelBaseHeightValue);
|
HackWidget(&ui->labelBaseHeightValue);
|
||||||
|
|
||||||
ui->lineEditGivenName->setText(m->GivenName());
|
ui->lineEditCustomerName->setText(m->Customer());
|
||||||
ui->lineEditFamilyName->setText(m->FamilyName());
|
|
||||||
|
|
||||||
ui->comboBoxGender->clear();
|
ui->comboBoxGender->clear();
|
||||||
InitGender(ui->comboBoxGender);
|
InitGender(ui->comboBoxGender);
|
||||||
|
@ -2098,8 +2083,7 @@ void TMainWindow::InitWindow()
|
||||||
|
|
||||||
ui->lineEditEmail->setText(m->Email());
|
ui->lineEditEmail->setText(m->Email());
|
||||||
|
|
||||||
connect(ui->lineEditGivenName, &QLineEdit::editingFinished, this, &TMainWindow::SaveGivenName);
|
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &TMainWindow::SaveCustomerName);
|
||||||
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->comboBoxGender, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(ui->comboBoxGender, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&TMainWindow::SaveGender);
|
&TMainWindow::SaveGender);
|
||||||
|
|
|
@ -91,8 +91,7 @@ private slots:
|
||||||
void OpenAt(QAction *where);
|
void OpenAt(QAction *where);
|
||||||
#endif //defined(Q_OS_MAC)
|
#endif //defined(Q_OS_MAC)
|
||||||
|
|
||||||
void SaveGivenName();
|
void SaveCustomerName();
|
||||||
void SaveFamilyName();
|
|
||||||
void SaveEmail();
|
void SaveEmail();
|
||||||
void SaveGender(int index);
|
void SaveGender(int index);
|
||||||
void SaveBirthDate(const QDate & date);
|
void SaveBirthDate(const QDate & date);
|
||||||
|
|
|
@ -682,14 +682,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="labelGivenName">
|
<widget class="QLabel" name="labelCustomerName">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Given name:</string>
|
<string>Customer name:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QLineEdit" name="lineEditGivenName">
|
<widget class="QLineEdit" name="lineEditCustomerName">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -705,36 +705,13 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="labelFamilyName">
|
|
||||||
<property name="text">
|
|
||||||
<string>Family name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineEditFamilyName">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Customer's family name</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="labelBirthDate">
|
<widget class="QLabel" name="labelBirthDate">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Birth date:</string>
|
<string>Birth date:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QDateEdit" name="dateEditBirthDate">
|
<widget class="QDateEdit" name="dateEditBirthDate">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -769,14 +746,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="labelGender">
|
<widget class="QLabel" name="labelGender">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gender:</string>
|
<string>Gender:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxGender">
|
<widget class="QComboBox" name="comboBoxGender">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -795,14 +772,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="labelEmail">
|
<widget class="QLabel" name="labelEmail">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Email:</string>
|
<string>Email:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QLineEdit" name="lineEditEmail">
|
<widget class="QLineEdit" name="lineEditEmail">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -818,14 +795,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="labelNotes">
|
<widget class="QLabel" name="labelNotes">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Notes:</string>
|
<string>Notes:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="QPlainTextEdit" name="plainTextEditNotes">
|
<widget class="QPlainTextEdit" name="plainTextEditNotes">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -850,7 +827,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>835</width>
|
<width>835</width>
|
||||||
<height>19</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|
|
@ -180,7 +180,17 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
ui->lineEditPatternName->setText(doc->GetPatternName());
|
ui->lineEditPatternName->setText(doc->GetPatternName());
|
||||||
ui->lineEditPatternNumber->setText(doc->GetPatternNumber());
|
ui->lineEditPatternNumber->setText(doc->GetPatternNumber());
|
||||||
ui->lineEditCompanyName->setText(doc->GetCompanyName());
|
ui->lineEditCompanyName->setText(doc->GetCompanyName());
|
||||||
|
|
||||||
|
if (qApp->patternType() == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
ui->lineEditCustomerName->setText(qApp->GetCustomerName());
|
||||||
|
ui->lineEditCustomerName->setReadOnly(true);
|
||||||
|
ui->lineEditCustomerName->setToolTip(tr("The customer name from individual measurements"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->lineEditCustomerName->setText(doc->GetCustomerName());
|
ui->lineEditCustomerName->setText(doc->GetCustomerName());
|
||||||
|
}
|
||||||
|
|
||||||
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
|
@ -601,7 +611,10 @@ void DialogPatternProperties::SaveLabelData()
|
||||||
doc->SetPatternName(ui->lineEditPatternName->text());
|
doc->SetPatternName(ui->lineEditPatternName->text());
|
||||||
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
||||||
doc->SetCompanyName(ui->lineEditCompanyName->text());
|
doc->SetCompanyName(ui->lineEditCompanyName->text());
|
||||||
|
if (qApp->patternType() != MeasurementsType::Individual)
|
||||||
|
{
|
||||||
doc->SetCustomerName(ui->lineEditCustomerName->text());
|
doc->SetCustomerName(ui->lineEditCustomerName->text());
|
||||||
|
}
|
||||||
doc->SetLabelDateFormat(ui->comboBoxDateFormat->currentText());
|
doc->SetLabelDateFormat(ui->comboBoxDateFormat->currentText());
|
||||||
doc->SetLabelTimeFormat(ui->comboBoxTimeFormat->currentText());
|
doc->SetLabelTimeFormat(ui->comboBoxTimeFormat->currentText());
|
||||||
|
|
||||||
|
|
|
@ -465,6 +465,10 @@ bool MainWindow::LoadMeasurements(const QString &path)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
qApp->setPatternType(m->Type());
|
qApp->setPatternType(m->Type());
|
||||||
|
if (m->Type() == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
qApp->SetCustomerName(m->Customer());
|
||||||
|
}
|
||||||
ToolBarOption();
|
ToolBarOption();
|
||||||
pattern->ClearVariables(VarType::Measurement);
|
pattern->ClearVariables(VarType::Measurement);
|
||||||
m->ReadMeasurements();
|
m->ReadMeasurements();
|
||||||
|
@ -520,6 +524,10 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height)
|
||||||
{
|
{
|
||||||
pattern->ClearVariables(VarType::Measurement);
|
pattern->ClearVariables(VarType::Measurement);
|
||||||
m->ReadMeasurements();
|
m->ReadMeasurements();
|
||||||
|
if (m->Type() == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
qApp->SetCustomerName(m->Customer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (VExceptionEmptyParameter &e)
|
catch (VExceptionEmptyParameter &e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.3.2.xsd</file>
|
<file>schema/individual_measurements/v0.3.2.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
||||||
|
<file>schema/individual_measurements/v0.4.0.xsd</file>
|
||||||
<file>schema/label_template/v1.0.0.xsd</file>
|
<file>schema/label_template/v1.0.0.xsd</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
71
src/libs/ifc/schema/individual_measurements/v0.4.0.xsd
Normal file
71
src/libs/ifc/schema/individual_measurements/v0.4.0.xsd
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<?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 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="personal">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="customer" type="xs:string"/>
|
||||||
|
<xs:element name="birth-date" type="xs:date"/>
|
||||||
|
<xs:element name="gender" type="gender"/>
|
||||||
|
<xs:element name="email" type="xs:string"/>
|
||||||
|
</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 name="value" type="xs:string" use="required"/>
|
||||||
|
<xs:attribute name="full_name" type="xs:string"/>
|
||||||
|
<xs:attribute name="description" type="xs:string"/>
|
||||||
|
</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="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>
|
|
@ -53,13 +53,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
|
const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
|
||||||
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.3");
|
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.4.0");
|
||||||
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.3.xsd");
|
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.4.0.xsd");
|
||||||
|
|
||||||
//VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
|
||||||
|
// The list of all string we use for conversion
|
||||||
|
// Better to use global variables because repeating QStringLiteral blows up code size
|
||||||
static const QString strTagRead_Only = QStringLiteral("read-only");
|
static const QString strTagRead_Only = QStringLiteral("read-only");
|
||||||
|
static const QString strGivenName = QStringLiteral("given-name");
|
||||||
|
static const QString strFamilyName = QStringLiteral("family-name");
|
||||||
|
static const QString strCustomer = QStringLiteral("customer");
|
||||||
|
static const QString strPersonal = QStringLiteral("personal");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVITConverter::VVITConverter(const QString &fileName)
|
VVITConverter::VVITConverter(const QString &fileName)
|
||||||
|
@ -82,6 +88,8 @@ QString VVITConverter::XSDSchema(int ver) const
|
||||||
case (0x000302):
|
case (0x000302):
|
||||||
return QStringLiteral("://schema/individual_measurements/v0.3.2.xsd");
|
return QStringLiteral("://schema/individual_measurements/v0.3.2.xsd");
|
||||||
case (0x000303):
|
case (0x000303):
|
||||||
|
return QStringLiteral("://schema/individual_measurements/v0.3.3.xsd");
|
||||||
|
case (0x000400):
|
||||||
return CurrentSchema;
|
return CurrentSchema;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(ver);
|
InvalidVersion(ver);
|
||||||
|
@ -112,6 +120,10 @@ void VVITConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(0x000303), m_convertedFileName);
|
ValidateXML(XSDSchema(0x000303), m_convertedFileName);
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000303):
|
case (0x000303):
|
||||||
|
ToV0_4_0();
|
||||||
|
ValidateXML(XSDSchema(0x000400), m_convertedFileName);
|
||||||
|
V_FALLTHROUGH
|
||||||
|
case (0x000400):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
|
@ -130,7 +142,7 @@ void VVITConverter::DowngradeToCurrentMaxVersion()
|
||||||
bool VVITConverter::IsReadOnly() const
|
bool VVITConverter::IsReadOnly() const
|
||||||
{
|
{
|
||||||
// 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(VVITConverter::MeasurementMaxVer == CONVERTER_VERSION_CHECK(0, 3, 3),
|
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == CONVERTER_VERSION_CHECK(0, 4, 0),
|
||||||
"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.
|
||||||
|
@ -299,6 +311,43 @@ void VVITConverter::ConvertMeasurementsToV0_3_3()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VVITConverter::ConverCustomerNameToV0_4_0()
|
||||||
|
{
|
||||||
|
// Find root tag
|
||||||
|
const QDomNodeList personalList = this->elementsByTagName(strPersonal);
|
||||||
|
if (personalList.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomNode personal = personalList.at(0);
|
||||||
|
|
||||||
|
// Given name
|
||||||
|
QString givenName;
|
||||||
|
const QDomNodeList givenNameList = this->elementsByTagName(strGivenName);
|
||||||
|
if (not givenNameList.isEmpty())
|
||||||
|
{
|
||||||
|
QDomNode givenNameNode = givenNameList.at(0);
|
||||||
|
givenName = givenNameNode.toElement().text();
|
||||||
|
personal.removeChild(givenNameNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Family name
|
||||||
|
QString familyName;
|
||||||
|
const QDomNodeList familyNameList = this->elementsByTagName(strFamilyName);
|
||||||
|
if (not familyNameList.isEmpty())
|
||||||
|
{
|
||||||
|
QDomNode familyNameNode = familyNameList.at(0);
|
||||||
|
familyName = familyNameNode.toElement().text();
|
||||||
|
personal.removeChild(familyNameNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement customer = createElement(strCustomer);
|
||||||
|
customer.appendChild(createTextNode(givenName + QLatin1Char(' ') + familyName));
|
||||||
|
personal.insertBefore(customer, personal.firstChild());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VVITConverter::ToV0_3_0()
|
void VVITConverter::ToV0_3_0()
|
||||||
{
|
{
|
||||||
|
@ -348,3 +397,15 @@ void VVITConverter::ToV0_3_3()
|
||||||
ConvertMeasurementsToV0_3_3();
|
ConvertMeasurementsToV0_3_3();
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VVITConverter::ToV0_4_0()
|
||||||
|
{
|
||||||
|
// TODO. Delete if minimal supported version is 0.4.0
|
||||||
|
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < CONVERTER_VERSION_CHECK(0, 4, 0),
|
||||||
|
"Time to refactor the code.");
|
||||||
|
|
||||||
|
SetVersion(QStringLiteral("0.4.0"));
|
||||||
|
ConverCustomerNameToV0_4_0();
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
|
@ -48,14 +48,8 @@ public:
|
||||||
|
|
||||||
static const QString MeasurementMaxVerStr;
|
static const QString MeasurementMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
// GCC 4.6 doesn't allow constexpr and const together
|
|
||||||
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
|
|
||||||
static Q_DECL_CONSTEXPR int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 2, 0);
|
|
||||||
static Q_DECL_CONSTEXPR int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
|
|
||||||
#else
|
|
||||||
static Q_DECL_CONSTEXPR const int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 2, 0);
|
static Q_DECL_CONSTEXPR const int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 2, 0);
|
||||||
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
|
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int MinVer() const Q_DECL_OVERRIDE;
|
virtual int MinVer() const Q_DECL_OVERRIDE;
|
||||||
|
@ -80,11 +74,13 @@ private:
|
||||||
void GenderV0_3_1();
|
void GenderV0_3_1();
|
||||||
void PM_SystemV0_3_2();
|
void PM_SystemV0_3_2();
|
||||||
void ConvertMeasurementsToV0_3_3();
|
void ConvertMeasurementsToV0_3_3();
|
||||||
|
void ConverCustomerNameToV0_4_0();
|
||||||
|
|
||||||
void ToV0_3_0();
|
void ToV0_3_0();
|
||||||
void ToV0_3_1();
|
void ToV0_3_1();
|
||||||
void ToV0_3_2();
|
void ToV0_3_2();
|
||||||
void ToV0_3_3();
|
void ToV0_3_3();
|
||||||
|
void ToV0_4_0();
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -62,8 +62,7 @@ const QString VMeasurements::TagNotes = QStringLiteral("notes");
|
||||||
const QString VMeasurements::TagSize = QStringLiteral("size");
|
const QString VMeasurements::TagSize = QStringLiteral("size");
|
||||||
const QString VMeasurements::TagHeight = QStringLiteral("height");
|
const QString VMeasurements::TagHeight = QStringLiteral("height");
|
||||||
const QString VMeasurements::TagPersonal = QStringLiteral("personal");
|
const QString VMeasurements::TagPersonal = QStringLiteral("personal");
|
||||||
const QString VMeasurements::TagFamilyName = QStringLiteral("family-name");
|
const QString VMeasurements::TagCustomer = QStringLiteral("customer");
|
||||||
const QString VMeasurements::TagGivenName = QStringLiteral("given-name");
|
|
||||||
const QString VMeasurements::TagBirthDate = QStringLiteral("birth-date");
|
const QString VMeasurements::TagBirthDate = QStringLiteral("birth-date");
|
||||||
const QString VMeasurements::TagGender = QStringLiteral("gender");
|
const QString VMeasurements::TagGender = QStringLiteral("gender");
|
||||||
const QString VMeasurements::TagPMSystem = QStringLiteral("pm_system");
|
const QString VMeasurements::TagPMSystem = QStringLiteral("pm_system");
|
||||||
|
@ -402,32 +401,17 @@ void VMeasurements::SetNotes(const QString &text)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VMeasurements::FamilyName() const
|
QString VMeasurements::Customer() const
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagFamilyName, "");
|
return UniqueTagText(TagCustomer, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMeasurements::SetFamilyName(const QString &text)
|
void VMeasurements::SetCustomer(const QString &text)
|
||||||
{
|
{
|
||||||
if (not IsReadOnly())
|
if (not IsReadOnly())
|
||||||
{
|
{
|
||||||
setTagText(TagFamilyName, text);
|
setTagText(TagCustomer, text);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VMeasurements::GivenName() const
|
|
||||||
{
|
|
||||||
return UniqueTagText(TagGivenName, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VMeasurements::SetGivenName(const QString &text)
|
|
||||||
{
|
|
||||||
if (not IsReadOnly())
|
|
||||||
{
|
|
||||||
setTagText(TagGivenName, text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,8 +770,7 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
||||||
mElement.appendChild(system);
|
mElement.appendChild(system);
|
||||||
|
|
||||||
QDomElement personal = createElement(TagPersonal);
|
QDomElement personal = createElement(TagPersonal);
|
||||||
personal.appendChild(createElement(TagFamilyName));
|
personal.appendChild(createElement(TagCustomer));
|
||||||
personal.appendChild(createElement(TagGivenName));
|
|
||||||
|
|
||||||
QDomElement date = createElement(TagBirthDate);
|
QDomElement date = createElement(TagBirthDate);
|
||||||
date.appendChild(createTextNode(defBirthDate));
|
date.appendChild(createTextNode(defBirthDate));
|
||||||
|
|
|
@ -72,11 +72,8 @@ public:
|
||||||
QString Notes() const;
|
QString Notes() const;
|
||||||
void SetNotes(const QString &text);
|
void SetNotes(const QString &text);
|
||||||
|
|
||||||
QString FamilyName() const;
|
QString Customer() const;
|
||||||
void SetFamilyName(const QString &text);
|
void SetCustomer(const QString &text);
|
||||||
|
|
||||||
QString GivenName() const;
|
|
||||||
void SetGivenName(const QString &text);
|
|
||||||
|
|
||||||
QDate BirthDate() const;
|
QDate BirthDate() const;
|
||||||
void SetBirthDate(const QDate &date);
|
void SetBirthDate(const QDate &date);
|
||||||
|
@ -111,8 +108,7 @@ public:
|
||||||
static const QString TagSize;
|
static const QString TagSize;
|
||||||
static const QString TagHeight;
|
static const QString TagHeight;
|
||||||
static const QString TagPersonal;
|
static const QString TagPersonal;
|
||||||
static const QString TagFamilyName;
|
static const QString TagCustomer;
|
||||||
static const QString TagGivenName;
|
|
||||||
static const QString TagBirthDate;
|
static const QString TagBirthDate;
|
||||||
static const QString TagGender;
|
static const QString TagGender;
|
||||||
static const QString TagPMSystem;
|
static const QString TagPMSystem;
|
||||||
|
|
|
@ -77,7 +77,16 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
|
||||||
placeholders.insert(pl_patternName, doc->GetPatternName());
|
placeholders.insert(pl_patternName, doc->GetPatternName());
|
||||||
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
|
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
|
||||||
placeholders.insert(pl_author, doc->GetCompanyName());
|
placeholders.insert(pl_author, doc->GetCompanyName());
|
||||||
|
|
||||||
|
if (qApp->patternType() == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
placeholders.insert(pl_customer, qApp->GetCustomerName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
placeholders.insert(pl_customer, doc->GetCustomerName());
|
placeholders.insert(pl_customer, doc->GetCustomerName());
|
||||||
|
}
|
||||||
|
|
||||||
placeholders.insert(pl_pExt, QString("val"));
|
placeholders.insert(pl_pExt, QString("val"));
|
||||||
placeholders.insert(pl_pFileName, QFileInfo(qApp->GetPPath()).baseName());
|
placeholders.insert(pl_pFileName, QFileInfo(qApp->GetPPath()).baseName());
|
||||||
placeholders.insert(pl_mFileName, QFileInfo(doc->MPath()).baseName());
|
placeholders.insert(pl_mFileName, QFileInfo(doc->MPath()).baseName());
|
||||||
|
|
|
@ -58,6 +58,7 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
||||||
currentScene(nullptr),
|
currentScene(nullptr),
|
||||||
sceneView(nullptr),
|
sceneView(nullptr),
|
||||||
doc(nullptr),
|
doc(nullptr),
|
||||||
|
m_customerName(),
|
||||||
openingPattern(false)
|
openingPattern(false)
|
||||||
{
|
{
|
||||||
QString rules;
|
QString rules;
|
||||||
|
|
|
@ -77,6 +77,9 @@ public:
|
||||||
MeasurementsType patternType() const;
|
MeasurementsType patternType() const;
|
||||||
void setPatternType(const MeasurementsType &patternType);
|
void setPatternType(const MeasurementsType &patternType);
|
||||||
|
|
||||||
|
QString GetCustomerName() const;
|
||||||
|
void SetCustomerName(const QString &name);
|
||||||
|
|
||||||
virtual void OpenSettings()=0;
|
virtual void OpenSettings()=0;
|
||||||
VCommonSettings *Settings();
|
VCommonSettings *Settings();
|
||||||
|
|
||||||
|
@ -140,6 +143,7 @@ private:
|
||||||
VMainGraphicsView *sceneView;
|
VMainGraphicsView *sceneView;
|
||||||
|
|
||||||
VAbstractPattern *doc;
|
VAbstractPattern *doc;
|
||||||
|
QString m_customerName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
|
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
|
||||||
|
@ -150,6 +154,18 @@ private:
|
||||||
void ClearTranslation();
|
void ClearTranslation();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline QString VAbstractApplication::GetCustomerName() const
|
||||||
|
{
|
||||||
|
return m_customerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline void VAbstractApplication::SetCustomerName(const QString &name)
|
||||||
|
{
|
||||||
|
m_customerName = name;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VAbstractApplication::GetPPath() const
|
inline QString VAbstractApplication::GetPPath() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -457,9 +457,17 @@ void DialogEditLabel::InitPlaceholders()
|
||||||
|
|
||||||
m_placeholders.insert(pl_patternName, qMakePair(tr("Pattern name"), m_doc->GetPatternName()));
|
m_placeholders.insert(pl_patternName, qMakePair(tr("Pattern name"), m_doc->GetPatternName()));
|
||||||
m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber()));
|
m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber()));
|
||||||
m_placeholders.insert(pl_author, qMakePair(tr("Company name or designer name"),
|
m_placeholders.insert(pl_author, qMakePair(tr("Company name or designer name"), m_doc->GetCompanyName()));
|
||||||
m_doc->GetCompanyName()));
|
|
||||||
|
if (qApp->patternType() == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), qApp->GetCustomerName()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), m_doc->GetCustomerName()));
|
m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), m_doc->GetCustomerName()));
|
||||||
|
}
|
||||||
|
|
||||||
m_placeholders.insert(pl_pExt, qMakePair(tr("Pattern extension"), QString("val")));
|
m_placeholders.insert(pl_pExt, qMakePair(tr("Pattern extension"), QString("val")));
|
||||||
|
|
||||||
const QString patternFilePath = QFileInfo(qApp->GetPPath()).baseName();
|
const QString patternFilePath = QFileInfo(qApp->GetPPath()).baseName();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user