diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 59f504ae2..1c466d4c3 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -2818,7 +2818,7 @@ void MainWindow::LoadPattern(const QString &fileName) if (qApp->patternType() == MeasurementsType::Standard) { VStandardMeasurements m(pattern); - VDomDocument::ValidateXML("://schema/standard_measurements.xsd", path); + VDomDocument::ValidateXML(VVSTConverter::CurrentSchema, path); m.setXMLContent(path); if (m.MUnit() == Unit::Inch) { @@ -2833,7 +2833,7 @@ void MainWindow::LoadPattern(const QString &fileName) } else { - VDomDocument::ValidateXML("://schema/individual_measurements.xsd", path); + VDomDocument::ValidateXML(VVITConverter::CurrentSchema, path); } ToolBarOption(); } @@ -3084,20 +3084,27 @@ QString MainWindow::CheckPathToMeasurements(const QString &path) if (patternType == MeasurementsType::Standard) { - VVSTConverter converter(mPath); - converter.Convert(); - VDomDocument::ValidateXML(VVSTConverter::CurrentSchema, mPath); } else { - VVITConverter converter(mPath); - converter.Convert(); - VDomDocument::ValidateXML(VVITConverter::CurrentSchema, mPath); } + const QStringList mList = m->ListAll(); + const QStringList pList = doc->ListMeasurements(); + delete m; + + const QSet match = pList.toSet().subtract(mList.toSet()); + if (not match.isEmpty()) + { + VException e("Measurement file doesn't include all required measurements."); + e.AddMoreInformation(QString("Please, additionaly provide: %1") + .arg(QStringList(match.toList()).join(", "))); + throw e; + } + doc->SetPath(mPath); PatternWasModified(false); return mPath;