Minor refactoring.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-02-11 14:16:49 +02:00
parent 7d1c4bc3ba
commit 61173f75c4
5 changed files with 31 additions and 42 deletions

View File

@ -768,11 +768,14 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint); const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
Tool tool; Tool tool;
const QStringList types = QStringList() << VAbstractPattern::NodePoint const QStringList types
<< VAbstractPattern::NodeArc {
<< VAbstractPattern::NodeSpline VAbstractPattern::NodePoint,
<< VAbstractPattern::NodeSplinePath VAbstractPattern::NodeArc,
<< VAbstractPattern::NodeElArc; VAbstractPattern::NodeSpline,
VAbstractPattern::NodeSplinePath,
VAbstractPattern::NodeElArc
};
switch (types.indexOf(t)) switch (types.indexOf(t))
{ {

View File

@ -462,14 +462,7 @@ bool VMeasurements::IsReadOnly() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetReadOnly(bool ro) void VMeasurements::SetReadOnly(bool ro)
{ {
if (ro) setTagText(TagReadOnly, ro ? trueStr : falseStr);
{
setTagText(TagReadOnly, trueStr);
}
else
{
setTagText(TagReadOnly, falseStr);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -1428,7 +1428,7 @@ void VToolSeamAllowance::ShowOptions()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::ToggleInLayout(bool checked) void VToolSeamAllowance::ToggleInLayout(bool checked)
{ {
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc); auto togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc);
connect(togglePrint, &TogglePieceInLayout::Toggled, doc, &VAbstractPattern::CheckInLayoutList); connect(togglePrint, &TogglePieceInLayout::Toggled, doc, &VAbstractPattern::CheckInLayoutList);
qApp->getUndoStack()->push(togglePrint); qApp->getUndoStack()->push(togglePrint);
} }

View File

@ -115,19 +115,10 @@ bool SavePlaceLabelOptions::mergeWith(const QUndoCommand *command)
const SavePlaceLabelOptions *saveCommand = static_cast<const SavePlaceLabelOptions *>(command); const SavePlaceLabelOptions *saveCommand = static_cast<const SavePlaceLabelOptions *>(command);
SCASSERT(saveCommand != nullptr); SCASSERT(saveCommand != nullptr);
if (saveCommand->LabelId() != nodeId) if (saveCommand->LabelId() != nodeId || m_newLabel.GetCenterPoint() != saveCommand->NewLabel().GetCenterPoint())
{ {
return false; return false;
} }
else
{
const VPlaceLabelItem candidate = saveCommand->NewLabel();
if (m_newLabel.GetCenterPoint() != candidate.GetCenterPoint())
{
return false;
}
}
m_newLabel = saveCommand->NewLabel(); m_newLabel = saveCommand->NewLabel();
return true; return true;

View File

@ -43,24 +43,26 @@
Q_DECLARE_LOGGING_CATEGORY(vUndo) Q_DECLARE_LOGGING_CATEGORY(vUndo)
enum class UndoCommand: char { AddPatternPiece, enum class UndoCommand: char
AddToCalc, {
MoveSpline, AddPatternPiece,
MoveSplinePath, AddToCalc,
MoveSPoint, MoveSpline,
SaveToolOptions, MoveSplinePath,
SaveDetailOptions, MoveSPoint,
SavePieceOptions, SaveToolOptions,
SavePiecePathOptions, SaveDetailOptions,
SavePlaceLabelOptions, SavePieceOptions,
MovePiece, SavePiecePathOptions,
DeleteTool, SavePlaceLabelOptions,
DeletePatternPiece, MovePiece,
RenamePP, DeleteTool,
MoveLabel, DeletePatternPiece,
MoveDoubleLabel, RenamePP,
RotationMoveLabel MoveLabel,
}; MoveDoubleLabel,
RotationMoveLabel
};
class VPattern; class VPattern;