Since we get previous piece from database we don't need to save them in dialog.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-08 17:41:48 +03:00
parent f90c612287
commit 00f9139150
2 changed files with 32 additions and 51 deletions

View File

@ -115,13 +115,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
flagFormulaAfter(true), flagFormulaAfter(true),
flagMainPathIsValid(true), flagMainPathIsValid(true),
m_bAddMode(true), m_bAddMode(true),
m_mx(0),
m_my(0),
m_dialog(), m_dialog(),
m_visSpecialPoints(), m_visSpecialPoints(),
m_oldData(),
m_oldGeom(),
m_oldGrainline(),
m_iRotBaseHeight(0), m_iRotBaseHeight(0),
m_iLenBaseHeight(0), m_iLenBaseHeight(0),
m_DLWidthBaseHeight(0), m_DLWidthBaseHeight(0),
@ -317,48 +312,45 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
uiTabPaths->plainTextEditFormulaWidth->setPlainText(width); uiTabPaths->plainTextEditFormulaWidth->setPlainText(width);
m_saWidth = piece.GetSAWidth(); m_saWidth = piece.GetSAWidth();
m_mx = piece.GetMx(); const VPieceLabelData &ppData = piece.GetPatternPieceData();
m_my = piece.GetMy(); uiTabLabels->lineEditLetter->setText(ppData.GetLetter());
uiTabLabels->lineEditAnnotation->setText(ppData.GetAnnotation());
m_oldData = piece.GetPatternPieceData(); uiTabLabels->lineEditOrientation->setText(ppData.GetOrientation());
uiTabLabels->lineEditLetter->setText(m_oldData.GetLetter()); uiTabLabels->lineEditRotation->setText(ppData.GetRotationWay());
uiTabLabels->lineEditAnnotation->setText(m_oldData.GetAnnotation()); uiTabLabels->lineEditTilt->setText(ppData.GetTilt());
uiTabLabels->lineEditOrientation->setText(m_oldData.GetOrientation()); uiTabLabels->lineEditFoldPosition->setText(ppData.GetFoldPosition());
uiTabLabels->lineEditRotation->setText(m_oldData.GetRotationWay()); uiTabLabels->spinBoxQuantity->setValue(ppData.GetQuantity());
uiTabLabels->lineEditTilt->setText(m_oldData.GetTilt()); uiTabLabels->checkBoxFold->setChecked(ppData.IsOnFold());
uiTabLabels->lineEditFoldPosition->setText(m_oldData.GetFoldPosition()); m_templateLines = ppData.GetLabelTemplate();
uiTabLabels->spinBoxQuantity->setValue(m_oldData.GetQuantity());
uiTabLabels->checkBoxFold->setChecked(m_oldData.IsOnFold());
m_templateLines = m_oldData.GetLabelTemplate();
uiTabLabels->groupBoxDetailLabel->setEnabled(not m_templateLines.isEmpty()); uiTabLabels->groupBoxDetailLabel->setEnabled(not m_templateLines.isEmpty());
uiTabGrainline->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); uiTabGrainline->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType()));
uiTabLabels->groupBoxDetailLabel->setChecked(m_oldData.IsVisible()); uiTabLabels->groupBoxDetailLabel->setChecked(ppData.IsVisible());
ChangeCurrentData(uiTabLabels->comboBoxDLCenterPin, m_oldData.CenterPin()); ChangeCurrentData(uiTabLabels->comboBoxDLCenterPin, ppData.CenterPin());
ChangeCurrentData(uiTabLabels->comboBoxDLTopLeftPin, m_oldData.TopLeftPin()); ChangeCurrentData(uiTabLabels->comboBoxDLTopLeftPin, ppData.TopLeftPin());
ChangeCurrentData(uiTabLabels->comboBoxDLBottomRightPin, m_oldData.BottomRightPin()); ChangeCurrentData(uiTabLabels->comboBoxDLBottomRightPin, ppData.BottomRightPin());
SetDLWidth(m_oldData.GetLabelWidth()); SetDLWidth(ppData.GetLabelWidth());
SetDLHeight(m_oldData.GetLabelHeight()); SetDLHeight(ppData.GetLabelHeight());
SetDLAngle(m_oldData.GetRotation()); SetDLAngle(ppData.GetRotation());
m_oldGeom = piece.GetPatternInfo(); const VPatternLabelData &patternInfo = piece.GetPatternInfo();
uiTabLabels->groupBoxPatternLabel->setChecked(m_oldGeom.IsVisible()); uiTabLabels->groupBoxPatternLabel->setChecked(patternInfo.IsVisible());
ChangeCurrentData(uiTabLabels->comboBoxPLCenterPin, m_oldGeom.CenterPin()); ChangeCurrentData(uiTabLabels->comboBoxPLCenterPin, patternInfo.CenterPin());
ChangeCurrentData(uiTabLabels->comboBoxPLTopLeftPin, m_oldGeom.TopLeftPin()); ChangeCurrentData(uiTabLabels->comboBoxPLTopLeftPin, patternInfo.TopLeftPin());
ChangeCurrentData(uiTabLabels->comboBoxPLBottomRightPin, m_oldGeom.BottomRightPin()); ChangeCurrentData(uiTabLabels->comboBoxPLBottomRightPin, patternInfo.BottomRightPin());
SetPLWidth(m_oldGeom.GetLabelWidth()); SetPLWidth(patternInfo.GetLabelWidth());
SetPLHeight(m_oldGeom.GetLabelHeight()); SetPLHeight(patternInfo.GetLabelHeight());
SetPLAngle(m_oldGeom.GetRotation()); SetPLAngle(patternInfo.GetRotation());
m_oldGrainline = piece.GetGrainlineGeometry(); const VGrainlineData &grainlineGeometry = piece.GetGrainlineGeometry();
uiTabGrainline->groupBoxGrainline->setChecked(m_oldGrainline.IsVisible()); uiTabGrainline->groupBoxGrainline->setChecked(grainlineGeometry.IsVisible());
ChangeCurrentData(uiTabGrainline->comboBoxGrainlineCenterPin, m_oldGrainline.CenterPin()); ChangeCurrentData(uiTabGrainline->comboBoxGrainlineCenterPin, grainlineGeometry.CenterPin());
ChangeCurrentData(uiTabGrainline->comboBoxGrainlineTopPin, m_oldGrainline.TopPin()); ChangeCurrentData(uiTabGrainline->comboBoxGrainlineTopPin, grainlineGeometry.TopPin());
ChangeCurrentData(uiTabGrainline->comboBoxGrainlineBottomPin, m_oldGrainline.BottomPin()); ChangeCurrentData(uiTabGrainline->comboBoxGrainlineBottomPin, grainlineGeometry.BottomPin());
SetGrainlineAngle(m_oldGrainline.GetRotation()); SetGrainlineAngle(grainlineGeometry.GetRotation());
SetGrainlineLength(m_oldGrainline.GetLength()); SetGrainlineLength(grainlineGeometry.GetLength());
ValidObjects(MainPathIsValid()); ValidObjects(MainPathIsValid());
EnabledGrainline(); EnabledGrainline();
@ -2328,8 +2320,6 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked()); piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());
piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked()); piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked());
piece.SetName(uiTabPaths->lineEditName->text()); piece.SetName(uiTabPaths->lineEditName->text());
piece.SetMx(m_mx);
piece.SetMy(m_my);
piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth); piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth);
piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text()); piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text());
piece.GetPatternPieceData().SetAnnotation(uiTabLabels->lineEditAnnotation->text()); piece.GetPatternPieceData().SetAnnotation(uiTabLabels->lineEditAnnotation->text());
@ -2340,17 +2330,14 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.GetPatternPieceData().SetQuantity(uiTabLabels->spinBoxQuantity->value()); piece.GetPatternPieceData().SetQuantity(uiTabLabels->spinBoxQuantity->value());
piece.GetPatternPieceData().SetOnFold(uiTabLabels->checkBoxFold->isChecked()); piece.GetPatternPieceData().SetOnFold(uiTabLabels->checkBoxFold->isChecked());
piece.GetPatternPieceData().SetLabelTemplate(m_templateLines); piece.GetPatternPieceData().SetLabelTemplate(m_templateLines);
piece.GetPatternPieceData().SetPos(m_oldData.GetPos());
piece.GetPatternPieceData().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditDLWidthFormula)); piece.GetPatternPieceData().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditDLWidthFormula));
piece.GetPatternPieceData().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditDLHeightFormula)); piece.GetPatternPieceData().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditDLHeightFormula));
piece.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize());
piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula)); piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula));
piece.GetPatternPieceData().SetVisible(uiTabLabels->groupBoxDetailLabel->isChecked()); piece.GetPatternPieceData().SetVisible(uiTabLabels->groupBoxDetailLabel->isChecked());
piece.GetPatternPieceData().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxDLCenterPin)); piece.GetPatternPieceData().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxDLCenterPin));
piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxDLTopLeftPin)); piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxDLTopLeftPin));
piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxDLBottomRightPin)); piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxDLBottomRightPin));
piece.GetPatternInfo() = m_oldGeom;
piece.GetPatternInfo().SetVisible(uiTabLabels->groupBoxPatternLabel->isChecked()); piece.GetPatternInfo().SetVisible(uiTabLabels->groupBoxPatternLabel->isChecked());
piece.GetPatternInfo().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxPLCenterPin)); piece.GetPatternInfo().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxPLCenterPin));
piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxPLTopLeftPin)); piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxPLTopLeftPin));
@ -2359,7 +2346,6 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.GetPatternInfo().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditPLHeightFormula)); piece.GetPatternInfo().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditPLHeightFormula));
piece.GetPatternInfo().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditPLAngleFormula)); piece.GetPatternInfo().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditPLAngleFormula));
piece.GetGrainlineGeometry() = m_oldGrainline;
piece.GetGrainlineGeometry().SetVisible(uiTabGrainline->groupBoxGrainline->isChecked()); piece.GetGrainlineGeometry().SetVisible(uiTabGrainline->groupBoxGrainline->isChecked());
piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(uiTabGrainline->lineEditRotFormula)); piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(uiTabGrainline->lineEditRotFormula));
piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(uiTabGrainline->lineEditLenFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(uiTabGrainline->lineEditLenFormula));

View File

@ -191,15 +191,10 @@ private:
bool flagFormulaAfter; bool flagFormulaAfter;
bool flagMainPathIsValid; bool flagMainPathIsValid;
bool m_bAddMode; bool m_bAddMode;
qreal m_mx;
qreal m_my;
QPointer<DialogTool> m_dialog; QPointer<DialogTool> m_dialog;
QPointer<VisPieceSpecialPoints> m_visSpecialPoints; QPointer<VisPieceSpecialPoints> m_visSpecialPoints;
VPieceLabelData m_oldData;
VPatternLabelData m_oldGeom;
VGrainlineData m_oldGrainline;
int m_iRotBaseHeight; int m_iRotBaseHeight;
int m_iLenBaseHeight; int m_iLenBaseHeight;
int m_DLWidthBaseHeight; int m_DLWidthBaseHeight;