Check Measurement file unit.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-18 10:24:51 +03:00
parent 0c73e7f760
commit f3d24856be
3 changed files with 33 additions and 1 deletions

View File

@ -273,6 +273,21 @@ void MainWindow::LoadMeasurements(const QString &path)
throw e; throw e;
} }
if (m->Type() == MeasurementsType::Standard)
{
if (m->MUnit() == Unit::Inch)
{
QMessageBox::critical(this, tr("Wrong units."),
tr("Application doesn't support standard table with inches."));
qCDebug(vMainWindow, "Application doesn't support standard table with inches.");
return;
}
m->SetDataSize();
m->SetDataHeight();
}
qApp->setPatternType(m->Type());
ToolBarOption();
pattern->ClearVariables(VarType::Measurement); pattern->ClearVariables(VarType::Measurement);
m->ReadMeasurements(); m->ReadMeasurements();
delete m; delete m;
@ -992,6 +1007,7 @@ void MainWindow::LoadStandard()
*/ */
void MainWindow::ToolBarOption() void MainWindow::ToolBarOption()
{ {
ui->toolBarOption->clear();
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
{ {
const QStringList listHeights = VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit()); const QStringList listHeights = VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit());
@ -2127,7 +2143,6 @@ void MainWindow::New()
//Set scene size to size scene view //Set scene size to size scene view
VMainGraphicsView::NewSceneRect(sceneDraw, ui->view); VMainGraphicsView::NewSceneRect(sceneDraw, ui->view);
VMainGraphicsView::NewSceneRect(sceneDetails, ui->view); VMainGraphicsView::NewSceneRect(sceneDetails, ui->view);
ToolBarOption();
AddPP(patternPieceName); AddPP(patternPieceName);
} }

View File

@ -533,6 +533,20 @@ QStringList VMeasurements::ListKnown() const
return listNames; return listNames;
} }
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetDataSize()
{
data->SetSize(UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit()));
data->SetSizeName(size_M);
}
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetDataHeight()
{
data->SetHeight(UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit()));
data->SetHeightName(height_M);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VMeasurements::CreateEmptyStandardFile(Unit unit, int baseSize, int baseHeight) void VMeasurements::CreateEmptyStandardFile(Unit unit, int baseSize, int baseHeight)
{ {

View File

@ -121,6 +121,9 @@ public:
QStringList ListAll() const; QStringList ListAll() const;
QStringList ListKnown() const; QStringList ListKnown() const;
void SetDataSize();
void SetDataHeight();
private: private:
Q_DISABLE_COPY(VMeasurements) Q_DISABLE_COPY(VMeasurements)