Actually we check measurements in two palces. Forgot about this.
--HG-- branch : feature
This commit is contained in:
parent
669d295804
commit
ef9411cf5a
|
@ -400,19 +400,7 @@ QSharedPointer<VMeasurements> MainWindow::OpenMeasurementFile(const QString &pat
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QSet<QString> match = doc->ListMeasurements().toSet().subtract(m->ListAll().toSet());
|
CheckRequiredMeasurements(m.data());
|
||||||
if (not match.isEmpty())
|
|
||||||
{
|
|
||||||
QList<QString> list = match.toList();
|
|
||||||
for (int i = 0; i < list.size(); ++i)
|
|
||||||
{
|
|
||||||
list[i] = qApp->TrVars()->MToUser(list.at(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
VException e(tr("Measurement file doesn't include all required measurements."));
|
|
||||||
e.AddMoreInformation(tr("Please, additionaly provide: %1").arg(QStringList(list).join(", ")));
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m->Type() == MeasurementsType::Standard)
|
if (m->Type() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
|
@ -529,6 +517,24 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::CheckRequiredMeasurements(const VMeasurements *m)
|
||||||
|
{
|
||||||
|
const QSet<QString> match = doc->ListMeasurements().toSet().subtract(m->ListAll().toSet());
|
||||||
|
if (not match.isEmpty())
|
||||||
|
{
|
||||||
|
QList<QString> list = match.toList();
|
||||||
|
for (int i = 0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
list[i] = qApp->TrVars()->MToUser(list.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
VException e(tr("Measurement file doesn't include all required measurements."));
|
||||||
|
e.AddMoreInformation(tr("Please, additionaly provide: %1").arg(QStringList(list).join(", ")));
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SetToolButton set tool and show dialog.
|
* @brief SetToolButton set tool and show dialog.
|
||||||
|
@ -4279,7 +4285,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VMeasurements *m = new VMeasurements(pattern);
|
QScopedPointer<VMeasurements> m(new VMeasurements(pattern));
|
||||||
m->setXMLContent(mPath);
|
m->setXMLContent(mPath);
|
||||||
|
|
||||||
patternType = m->Type();
|
patternType = m->Type();
|
||||||
|
@ -4313,19 +4319,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList mList = m->ListAll();
|
CheckRequiredMeasurements(m.data());
|
||||||
const QStringList pList = doc->ListMeasurements();
|
|
||||||
|
|
||||||
delete m;
|
|
||||||
|
|
||||||
const QSet<QString> match = pList.toSet().subtract(mList.toSet());
|
|
||||||
if (not match.isEmpty())
|
|
||||||
{
|
|
||||||
VException e(tr("Measurement file doesn't include all required measurements."));
|
|
||||||
e.AddMoreInformation(tr("Please, additionaly provide: %1")
|
|
||||||
.arg(QStringList(match.toList()).join(", ")));
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
doc->SetPath(RelativeMPath(patternPath, mPath));
|
doc->SetPath(RelativeMPath(patternPath, mPath));
|
||||||
PatternChangesWereSaved(false);
|
PatternChangesWereSaved(false);
|
||||||
|
|
|
@ -339,6 +339,7 @@ private:
|
||||||
QSharedPointer<VMeasurements> OpenMeasurementFile(const QString &path);
|
QSharedPointer<VMeasurements> OpenMeasurementFile(const QString &path);
|
||||||
bool LoadMeasurements(const QString &path);
|
bool LoadMeasurements(const QString &path);
|
||||||
bool UpdateMeasurements(const QString &path, int size, int height);
|
bool UpdateMeasurements(const QString &path, int size, int height);
|
||||||
|
void CheckRequiredMeasurements(const VMeasurements *m);
|
||||||
|
|
||||||
void ReopenFilesAfterCrash(QStringList &args);
|
void ReopenFilesAfterCrash(QStringList &args);
|
||||||
void DoExport(const VCommandLinePtr& expParams);
|
void DoExport(const VCommandLinePtr& expParams);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user