From 2d91455ed55afe8bdbbcc486ca2f8e3f9e20b7db Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 4 Feb 2022 17:15:42 +0200 Subject: [PATCH] Allow size to have values from 1 to 100 if not a circumference. --- ChangeLog.txt | 1 + src/libs/ifc/schema.qrc | 1 + .../schema/multisize_measurements/v0.5.2.xsd | 137 ++++++++++++++++++ src/libs/ifc/xml/vvstconverter.cpp | 24 ++- src/libs/ifc/xml/vvstconverter.h | 3 +- src/libs/vformat/vdimensions.cpp | 4 +- 6 files changed, 163 insertions(+), 7 deletions(-) create mode 100644 src/libs/ifc/schema/multisize_measurements/v0.5.2.xsd diff --git a/ChangeLog.txt b/ChangeLog.txt index 7ed74c780..e817881fe 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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. diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index 41e597e8b..2a771f02f 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -82,6 +82,7 @@ schema/individual_measurements/v0.4.0.xsd schema/individual_measurements/v0.5.0.xsd schema/individual_measurements/v0.5.1.xsd + schema/multisize_measurements/v0.5.2.xsd schema/label_template/v1.0.0.xsd schema/watermark/v1.0.0.xsd schema/watermark/v1.1.0.xsd diff --git a/src/libs/ifc/schema/multisize_measurements/v0.5.2.xsd b/src/libs/ifc/schema/multisize_measurements/v0.5.2.xsd new file mode 100644 index 000000000..f95b93e6f --- /dev/null +++ b/src/libs/ifc/schema/multisize_measurements/v0.5.2.xsd @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index ff247acdd..b63f3add9 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -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(); +} diff --git a/src/libs/ifc/xml/vvstconverter.h b/src/libs/ifc/xml/vvstconverter.h index a4eea6bca..f1db82a47 100644 --- a/src/libs/ifc/xml/vvstconverter.h +++ b/src/libs/ifc/xml/vvstconverter.h @@ -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(); }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vformat/vdimensions.cpp b/src/libs/vformat/vdimensions.cpp index d49e61f8c..548cbce79 100644 --- a/src/libs/vformat/vdimensions.cpp +++ b/src/libs/vformat/vdimensions.cpp @@ -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; } }