Allow size to have values from 1 to 100 if not a circumference.

This commit is contained in:
Roman Telezhynskyi 2022-02-04 17:15:42 +02:00
parent 750c31dcd8
commit 2d91455ed5
6 changed files with 163 additions and 7 deletions

View File

@ -31,6 +31,7 @@
- Fix alias for tool Cut Arc.
- Fix infinite loop in tool cut spline.
- Added scroll area to layout settings dialog.
- Allow size to have values from 1 to 100 if not a circumference.
# Valentina 0.7.49 July 1, 2021
- Fix crash.

View File

@ -82,6 +82,7 @@
<file>schema/individual_measurements/v0.4.0.xsd</file>
<file>schema/individual_measurements/v0.5.0.xsd</file>
<file>schema/individual_measurements/v0.5.1.xsd</file>
<file>schema/multisize_measurements/v0.5.2.xsd</file>
<file>schema/label_template/v1.0.0.xsd</file>
<file>schema/watermark/v1.0.0.xsd</file>
<file>schema/watermark/v1.1.0.xsd</file>

View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="vst">
<xs:complexType>
<xs:sequence>
<xs:element name="version" type="formatVersion"/>
<xs:element name="read-only" type="xs:boolean"/>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="unit" type="units"/>
<xs:element name="pm_system" type="psCode"/>
<xs:element name="dimensions">
<xs:complexType>
<xs:sequence>
<xs:element name="dimension" minOccurs="1" maxOccurs="3">
<xs:complexType>
<xs:sequence>
<xs:element name="labels" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="label" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="value" type="dimesionValue" use="required"/>
<xs:attribute name="label" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="type" type="dimensionType" use="required"/>
<xs:attribute name="base" type="dimesionValue" use="required"/>
<xs:attribute name="min" type="dimesionValue" use="required"/>
<xs:attribute name="max" type="dimesionValue" use="required"/>
<xs:attribute name="step" type="dimensionStep" use="required"/>
<xs:attribute name="circumference" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="fullCircumference" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="restrictions">
<xs:complexType>
<xs:sequence>
<xs:element name="restriction" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="coordinates" type="xs:string" use="required"/>
<xs:attribute name="min" type="dimesionValue"/>
<xs:attribute name="max" type="dimesionValue"/>
<xs:attribute name="exclude" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="body-measurements">
<xs:complexType>
<xs:sequence>
<xs:element name="m" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="corrections" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="correction" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="coordinates" type="xs:string" use="required"/>
<xs:attribute name="correction" type="xs:double" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="base" type="xs:double" use="required"/>
<xs:attribute name="shiftA" type="xs:double"/>
<xs:attribute name="shiftB" type="xs:double"/>
<xs:attribute name="shiftC" type="xs:double"/>
<xs:attribute name="full_name" type="xs:string"/>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="specialUnits" type="xs:boolean"/>
</xs: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}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&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-9]{1,}\.[0-9]{1,}\.[0-9]{1,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="psCode">
<xs:restriction base="xs:string">
<xs:pattern value="(([0-9]|[1-4][0-9]|5[0-4])|998)"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="dimensionType">
<xs:restriction base="xs:string">
<xs:enumeration value="x"/>
<xs:enumeration value="y"/>
<xs:enumeration value="w"/>
<xs:enumeration value="z"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="dimesionValue">
<xs:restriction base="xs:double">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="2720"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="dimensionStep">
<xs:restriction base="xs:double">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="80"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -54,8 +54,8 @@
*/
const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.5.1");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/multisize_measurements/v0.5.1.xsd");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.5.2");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/multisize_measurements/v0.5.2.xsd");
//VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -84,7 +84,8 @@ QString VVSTConverter::XSDSchema(unsigned ver) const
std::make_pair(FormatVersion(0, 4, 3), QStringLiteral("://schema/multisize_measurements/v0.4.3.xsd")),
std::make_pair(FormatVersion(0, 4, 4), QStringLiteral("://schema/multisize_measurements/v0.4.4.xsd")),
std::make_pair(FormatVersion(0, 5, 0), QStringLiteral("://schema/multisize_measurements/v0.5.0.xsd")),
std::make_pair(FormatVersion(0, 5, 1), CurrentSchema),
std::make_pair(FormatVersion(0, 5, 1), QStringLiteral("://schema/multisize_measurements/v0.5.1.xsd")),
std::make_pair(FormatVersion(0, 5, 2), CurrentSchema),
};
if (schemas.contains(ver))
@ -131,6 +132,10 @@ void VVSTConverter::ApplyPatches()
ValidateXML(XSDSchema(FormatVersion(0, 5, 1)));
Q_FALLTHROUGH();
case (FormatVersion(0, 5, 1)):
ToV0_5_2();
ValidateXML(XSDSchema(FormatVersion(0, 5, 2)));
Q_FALLTHROUGH();
case (FormatVersion(0, 5, 2)):
break;
default:
InvalidVersion(m_ver);
@ -149,7 +154,7 @@ void VVSTConverter::DowngradeToCurrentMaxVersion()
bool VVSTConverter::IsReadOnly() const
{
// Check if attribute read-only was not changed in file format
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FormatVersion(0, 5, 1),
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FormatVersion(0, 5, 2),
"Check attribute read-only.");
// Possibly in future attribute read-only will change position etc.
@ -508,3 +513,14 @@ void VVSTConverter::ToV0_5_1()
SetVersion(QStringLiteral("0.5.1"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VVSTConverter::ToV0_5_2()
{
// TODO. Delete if minimal supported version is 0.5.2
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 2),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.5.2"));
Save();
}

View File

@ -49,7 +49,7 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 1);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 2);
protected:
virtual unsigned MinVer() const override;
@ -85,6 +85,7 @@ private:
void ToV0_4_4();
void ToV0_5_0();
void ToV0_5_1();
void ToV0_5_2();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -332,7 +332,7 @@ auto VYMeasurementDimension::RangeMin() const -> int
}
else
{
const int rangeMinCir = 6;
const int rangeMinCir = 1;
return rangeMinCir;
}
}
@ -360,7 +360,7 @@ auto VYMeasurementDimension::RangeMax() const -> int
}
else
{
const int rangeMaxCir = 60;
const int rangeMaxCir = 100;
return rangeMaxCir;
}
}