diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 47863a255..32317f765 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -37,8 +37,10 @@ #include "../vpatterndb/vcontainer.h" #include "../core/vapplication.h" -#define MAX_HEIGHTS 18 -#define MAX_SIZES 18 +// calc how many combinations we have +static const int heightsCount = (static_cast(GHeights::H194) - + (static_cast(GHeights::H50) - heightStep))/heightStep; +static const int sizesCount = (static_cast(GSizes::S72) - (static_cast(GSizes::S22) - sizeStep))/sizeStep; //--------------------------------------------------------------------------------------------------------------------- DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPattern *doc, VContainer *pattern, @@ -47,8 +49,8 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte ui(new Ui::DialogPatternProperties), doc(doc), pattern(pattern), - heightsChecked(MAX_HEIGHTS), - sizesChecked(MAX_SIZES), + heightsChecked(heightsCount), + sizesChecked(sizesCount), heights (QMap()), sizes(QMap()), data(QMap()), @@ -334,7 +336,7 @@ void DialogPatternProperties::CheckStateHeight(int state) if (state == Qt::Checked) { ++heightsChecked; - if (heightsChecked == MAX_HEIGHTS) + if (heightsChecked == heightsCount) { ui->checkBoxAllHeights->blockSignals(true);//don't touch anothers checkboxes ui->checkBoxAllHeights->setCheckState(Qt::Checked); @@ -344,7 +346,7 @@ void DialogPatternProperties::CheckStateHeight(int state) } else if (state == Qt::Unchecked) { - if (heightsChecked == MAX_HEIGHTS) + if (heightsChecked == heightsCount) { ui->checkBoxAllHeights->blockSignals(true);//don't touch anothers checkboxes ui->checkBoxAllHeights->setCheckState(Qt::Unchecked); @@ -376,7 +378,7 @@ void DialogPatternProperties::CheckStateSize(int state) if (state == Qt::Checked) { ++sizesChecked; - if (sizesChecked == MAX_SIZES) + if (sizesChecked == sizesCount) { ui->checkBoxAllSizes->blockSignals(true);//don't touch anothers checkboxes ui->checkBoxAllSizes->setCheckState(Qt::Checked); @@ -386,7 +388,7 @@ void DialogPatternProperties::CheckStateSize(int state) } else if (state == Qt::Unchecked) { - if (sizesChecked == MAX_SIZES) + if (sizesChecked == sizesCount) { ui->checkBoxAllSizes->blockSignals(true);//don't touch anothers checkboxes ui->checkBoxAllSizes->setCheckState(Qt::Unchecked); @@ -490,6 +492,14 @@ void DialogPatternProperties::SetSizesChecked(bool enabled) ui->checkBoxS52->setChecked(enabled); ui->checkBoxS54->setChecked(enabled); ui->checkBoxS56->setChecked(enabled); + ui->checkBoxS58->setChecked(enabled); + ui->checkBoxS60->setChecked(enabled); + ui->checkBoxS62->setChecked(enabled); + ui->checkBoxS64->setChecked(enabled); + ui->checkBoxS66->setChecked(enabled); + ui->checkBoxS68->setChecked(enabled); + ui->checkBoxS70->setChecked(enabled); + ui->checkBoxS72->setChecked(enabled); } //--------------------------------------------------------------------------------------------------------------------- @@ -547,6 +557,14 @@ void DialogPatternProperties::InitSizes() Init(ui->checkBoxS52, static_cast(GSizes::S52), &DialogPatternProperties::CheckStateSize); Init(ui->checkBoxS54, static_cast(GSizes::S54), &DialogPatternProperties::CheckStateSize); Init(ui->checkBoxS56, static_cast(GSizes::S56), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS58, static_cast(GSizes::S58), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS60, static_cast(GSizes::S60), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS62, static_cast(GSizes::S62), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS64, static_cast(GSizes::S64), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS66, static_cast(GSizes::S66), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS68, static_cast(GSizes::S68), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS70, static_cast(GSizes::S70), &DialogPatternProperties::CheckStateSize); + Init(ui->checkBoxS72, static_cast(GSizes::S72), &DialogPatternProperties::CheckStateSize); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialogpatternproperties.h b/src/app/valentina/dialogs/dialogpatternproperties.h index 0c26a8661..cbb963d09 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.h +++ b/src/app/valentina/dialogs/dialogpatternproperties.h @@ -69,8 +69,8 @@ private: Ui::DialogPatternProperties *ui; VPattern *doc; VContainer *pattern; - char heightsChecked; - char sizesChecked; + int heightsChecked; + int sizesChecked; QMap heights; QMap sizes; QMap data; diff --git a/src/app/valentina/dialogs/dialogpatternproperties.ui b/src/app/valentina/dialogs/dialogpatternproperties.ui index 7738866db..173d4e34e 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.ui +++ b/src/app/valentina/dialogs/dialogpatternproperties.ui @@ -748,6 +748,63 @@ QFrame::Raised + + + + true + + + + 0 + 0 + + + + 46 + + + true + + + + + + + true + + + + 0 + 0 + + + + 48 + + + true + + + + + + + true + + + + 0 + 0 + + + + 38 + + + true + + + @@ -767,25 +824,6 @@ - - - - true - - - - 0 - 0 - - - - 40 - - - true - - - @@ -805,8 +843,8 @@ - - + + true @@ -817,7 +855,45 @@ - 42 + 50 + + + true + + + + + + + true + + + + 0 + 0 + + + + 36 + + + true + + + + + + + true + + + + 0 + 0 + + + + 56 true @@ -843,6 +919,139 @@ + + + + true + + + + 0 + 0 + + + + 30 + + + true + + + + + + + true + + + + 0 + 0 + + + + 54 + + + true + + + + + + + true + + + + 0 + 0 + + + + 40 + + + true + + + + + + + true + + + + 0 + 0 + + + + 52 + + + true + + + + + + + true + + + + 0 + 0 + + + + 32 + + + true + + + + + + + true + + + + 0 + 0 + + + + 42 + + + true + + + + + + + true + + + + 0 + 0 + + + + 34 + + + true + + + @@ -881,209 +1090,80 @@ - - - - true - - - - 0 - 0 - - + + - 46 + 60 true - - - - true - - - - 0 - 0 - - + + - 30 + 62 true - - - - true - - - - 0 - 0 - - + + - 48 + 64 true - - - - true - - - - 0 - 0 - - + + - 32 + 66 true - - - - true - - - - 0 - 0 - - + + - 50 + 68 true - - - - true - - - - 0 - 0 - - + + - 34 + 58 true - - - - true - - - - 0 - 0 - - + + - 52 + 70 true - - - - true - - - - 0 - 0 - - + + - 36 - - - true - - - - - - - true - - - - 0 - 0 - - - - 54 - - - true - - - - - - - true - - - - 0 - 0 - - - - 38 - - - true - - - - - - - true - - - - 0 - 0 - - - - 56 + 72 true diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index aa5a46d40..cd7354cea 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -24,6 +24,7 @@ schema/pattern/v0.3.8.xsd schema/pattern/v0.3.9.xsd schema/pattern/v0.4.0.xsd + schema/pattern/v0.4.1.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.4.1.xsd b/src/libs/ifc/schema/pattern/v0.4.1.xsd new file mode 100644 index 000000000..e80f71afd --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.4.1.xsd @@ -0,0 +1,833 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 122428173..af913858e 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -162,6 +162,14 @@ const QString VAbstractPattern::AttrS50 = QStringLiteral("s50"); const QString VAbstractPattern::AttrS52 = QStringLiteral("s52"); const QString VAbstractPattern::AttrS54 = QStringLiteral("s54"); const QString VAbstractPattern::AttrS56 = QStringLiteral("s56"); +const QString VAbstractPattern::AttrS58 = QStringLiteral("s58"); +const QString VAbstractPattern::AttrS60 = QStringLiteral("s60"); +const QString VAbstractPattern::AttrS62 = QStringLiteral("s62"); +const QString VAbstractPattern::AttrS64 = QStringLiteral("s64"); +const QString VAbstractPattern::AttrS66 = QStringLiteral("s66"); +const QString VAbstractPattern::AttrS68 = QStringLiteral("s68"); +const QString VAbstractPattern::AttrS70 = QStringLiteral("s70"); +const QString VAbstractPattern::AttrS72 = QStringLiteral("s72"); const QString VAbstractPattern::AttrCustom = QStringLiteral("custom"); const QString VAbstractPattern::AttrDefHeight = QStringLiteral("defHeight"); @@ -1021,6 +1029,14 @@ QMap VAbstractPattern::GetGradationSizes() const map.insert(GSizes::S52, true); map.insert(GSizes::S54, true); map.insert(GSizes::S56, true); + map.insert(GSizes::S58, true); + map.insert(GSizes::S60, true); + map.insert(GSizes::S62, true); + map.insert(GSizes::S64, true); + map.insert(GSizes::S66, true); + map.insert(GSizes::S68, true); + map.insert(GSizes::S70, true); + map.insert(GSizes::S72, true); QDomNodeList tags = elementsByTagName(TagGradation); if (tags.size() == 0) @@ -1070,6 +1086,14 @@ QMap VAbstractPattern::GetGradationSizes() const map.insert(GSizes::S52, GetParametrBool(domElement, AttrS52, defValue)); map.insert(GSizes::S54, GetParametrBool(domElement, AttrS54, defValue)); map.insert(GSizes::S56, GetParametrBool(domElement, AttrS56, defValue)); + map.insert(GSizes::S58, GetParametrBool(domElement, AttrS58, defValue)); + map.insert(GSizes::S60, GetParametrBool(domElement, AttrS60, defValue)); + map.insert(GSizes::S62, GetParametrBool(domElement, AttrS62, defValue)); + map.insert(GSizes::S64, GetParametrBool(domElement, AttrS64, defValue)); + map.insert(GSizes::S66, GetParametrBool(domElement, AttrS66, defValue)); + map.insert(GSizes::S68, GetParametrBool(domElement, AttrS68, defValue)); + map.insert(GSizes::S70, GetParametrBool(domElement, AttrS70, defValue)); + map.insert(GSizes::S72, GetParametrBool(domElement, AttrS72, defValue)); return map; break; default: @@ -1128,6 +1152,14 @@ void VAbstractPattern::SetGradationSizes(const QMap &options) domElement.removeAttribute(AttrS52); domElement.removeAttribute(AttrS54); domElement.removeAttribute(AttrS56); + domElement.removeAttribute(AttrS58); + domElement.removeAttribute(AttrS60); + domElement.removeAttribute(AttrS62); + domElement.removeAttribute(AttrS64); + domElement.removeAttribute(AttrS66); + domElement.removeAttribute(AttrS68); + domElement.removeAttribute(AttrS70); + domElement.removeAttribute(AttrS72); } else { @@ -1149,6 +1181,14 @@ void VAbstractPattern::SetGradationSizes(const QMap &options) SetAttribute(domElement, AttrS52, options.value(GSizes::S52)); SetAttribute(domElement, AttrS54, options.value(GSizes::S54)); SetAttribute(domElement, AttrS56, options.value(GSizes::S56)); + SetAttribute(domElement, AttrS58, options.value(GSizes::S58)); + SetAttribute(domElement, AttrS60, options.value(GSizes::S60)); + SetAttribute(domElement, AttrS62, options.value(GSizes::S62)); + SetAttribute(domElement, AttrS64, options.value(GSizes::S64)); + SetAttribute(domElement, AttrS66, options.value(GSizes::S66)); + SetAttribute(domElement, AttrS68, options.value(GSizes::S68)); + SetAttribute(domElement, AttrS70, options.value(GSizes::S70)); + SetAttribute(domElement, AttrS72, options.value(GSizes::S72)); } modified = true; diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 2e590c9a1..672f38845 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -271,6 +271,14 @@ public: static const QString AttrS52; static const QString AttrS54; static const QString AttrS56; + static const QString AttrS58; + static const QString AttrS60; + static const QString AttrS62; + static const QString AttrS64; + static const QString AttrS66; + static const QString AttrS68; + static const QString AttrS70; + static const QString AttrS72; static const QString AttrCustom; static const QString AttrDefHeight; diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 7bcc178ed..2d44c09cb 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.0"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.0.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.1"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.1.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -198,6 +198,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000309): return QStringLiteral("://schema/pattern/v0.3.9.xsd"); case (0x000400): + return QStringLiteral("://schema/pattern/v0.4.0.xsd"); + case (0x000401): return CurrentSchema; default: InvalidVersion(ver); @@ -303,6 +305,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(0x000400), m_convertedFileName); V_FALLTHROUGH case (0x000400): + ToV0_4_1(); + ValidateXML(XSDSchema(0x000401), m_convertedFileName); + V_FALLTHROUGH + case (0x000401): break; default: InvalidVersion(m_ver); @@ -321,7 +327,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion() bool VPatternConverter::IsReadOnly() const { // Check if attribute readOnly was not changed in file format - Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 0), + Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 1), "Check attribute readOnly."); // Possibly in future attribute readOnly will change position etc. @@ -582,6 +588,10 @@ void VPatternConverter::ToV0_3_8() //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::ToV0_3_9() { + // TODO. Delete if minimal supported version is 0.3.9 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 9), + "Time to refactor the code."); + SetVersion(QStringLiteral("0.3.9")); Save(); } @@ -600,6 +610,17 @@ void VPatternConverter::ToV0_4_0() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_4_1() +{ + // TODO. Delete if minimal supported version is 0.4.1 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 1), + "Time to refactor the code."); + + SetVersion(QStringLiteral("0.4.1")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index ccf873331..f6348ba60 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -55,10 +55,10 @@ public: // 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 PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0); + static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1); #else static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0); + static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1); #endif protected: @@ -101,6 +101,7 @@ private: void ToV0_3_8(); void ToV0_3_9(); void ToV0_4_0(); + void ToV0_4_1(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 3aa82b402..e74ad2e67 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -198,15 +198,18 @@ enum class Vis : ToolVisHolderType enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, ArcRadius, Unknown }; +static const int heightStep = 6; enum class GHeights : unsigned char { ALL, H50=50, H56=56, H62=62, H68=68, H74=74, H80=80, H86=86, H92=92, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, H140=140, H146=146, H152=152, H158=158, H164=164, H170=170, H176=176, H182=182, H188=188, H194=194}; +static const int sizeStep = 2; enum class GSizes : unsigned char { ALL, S22=22, S24=24, S26=26, S28=28, S30=30, S32=32, S34=34, S36=36, S38=38, S40=40, - S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56 }; + S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56, S58=58, S60=60, + S62=62, S64=64, S66=66, S68=68, S70=70, S72=72 }; /* QImage supports a maximum of 32768x32768 px images (signed short). * This follows from the condition: width * height * colordepth < INT_MAX (4 billion) -> 32768 * 32768 * 4 = 4 billion. diff --git a/src/libs/vpatterndb/variables/vmeasurement.cpp b/src/libs/vpatterndb/variables/vmeasurement.cpp index 19ac3a419..52a5cd874 100644 --- a/src/libs/vpatterndb/variables/vmeasurement.cpp +++ b/src/libs/vpatterndb/variables/vmeasurement.cpp @@ -116,7 +116,6 @@ QStringList VMeasurement::ListHeights(QMap heights, Unit pattern if (list.isEmpty()) { - // from 50 cm to 194 cm list = VMeasurement::WholeListHeights(patternUnit); } return list; @@ -144,7 +143,6 @@ QStringList VMeasurement::ListSizes(QMap sizes, Unit patternUnit) if (list.isEmpty()) { - // from 22 cm to 56 cm list = VMeasurement::WholeListSizes(patternUnit); } return list; @@ -159,8 +157,8 @@ QStringList VMeasurement::WholeListHeights(Unit patternUnit) qWarning()<<"Standard table doesn't support inches."; return list; } - // from 50 cm to 194 cm - for (int i = 50; i<= 194; i = i+6) + + for (int i = static_cast(GHeights::H50); i<= static_cast(GHeights::H194); i = i+heightStep) { ListValue(list, i, patternUnit); } @@ -178,8 +176,7 @@ QStringList VMeasurement::WholeListSizes(Unit patternUnit) return list; } - // from 22 cm to 56 cm - for (int i = 22; i<= 56; i = i+2) + for (int i = static_cast(GSizes::S22); i<= static_cast(GSizes::S72); i = i+sizeStep) { ListValue(list, i, patternUnit); }