Refactoring.

This commit is contained in:
Roman Telezhynskyi 2024-04-06 18:52:43 +03:00
parent 54ee9e0629
commit fbaf5f0f38
7 changed files with 10 additions and 10 deletions

View File

@ -244,7 +244,7 @@ void VPLayoutSettings::SetStickyEdges(bool state)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPLayoutSettings::GetStickyEdges() const -> bool auto VPLayoutSettings::IsStickyEdges() const -> bool
{ {
return m_stickyEdges; return m_stickyEdges;
} }

View File

@ -81,7 +81,7 @@ public:
auto GetDescription() const -> QString; auto GetDescription() const -> QString;
void SetStickyEdges(bool state); void SetStickyEdges(bool state);
auto GetStickyEdges() const -> bool; auto IsStickyEdges() const -> bool;
// Piece // Piece

View File

@ -342,7 +342,7 @@ void VPPiece::FlipHorizontally()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPPiece::StickyPosition(qreal &dx, qreal &dy) const -> bool auto VPPiece::StickyPosition(qreal &dx, qreal &dy) const -> bool
{ {
if (VPLayoutPtr const layout = Layout(); layout.isNull() || not layout->LayoutSettings().GetStickyEdges()) if (VPLayoutPtr const layout = Layout(); layout.isNull() || not layout->LayoutSettings().IsStickyEdges())
{ {
return false; return false;
} }

View File

@ -297,7 +297,7 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (VPLayoutPtr const layout = piece->Layout(); not layout.isNull()) if (VPLayoutPtr const layout = piece->Layout(); not layout.isNull())
{ {
if (layout->LayoutSettings().GetStickyEdges() && m_hasStickyPosition) if (layout->LayoutSettings().IsStickyEdges() && m_hasStickyPosition)
{ {
auto *command = auto *command =
new VPUndoPieceMove(piece, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge); new VPUndoPieceMove(piece, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge);
@ -1106,7 +1106,7 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
auto *command = new VPUndoPieceMove(piece, newPos.x(), newPos.y(), m_allowChangeMerge); auto *command = new VPUndoPieceMove(piece, newPos.x(), newPos.y(), m_allowChangeMerge);
layout->UndoStack()->push(command); layout->UndoStack()->push(command);
if (layout->LayoutSettings().GetStickyEdges()) if (layout->LayoutSettings().IsStickyEdges())
{ {
QVector<QPointF> path; QVector<QPointF> path;
if (not p.isNull() && p->StickyPosition(m_stickyTranslateX, m_stickyTranslateY)) if (not p.isNull() && p->StickyPosition(m_stickyTranslateX, m_stickyTranslateY))

View File

@ -516,7 +516,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
auto *command = new VPUndoPieceMove(p, dx, dy, m_allowChangeMerge); auto *command = new VPUndoPieceMove(p, dx, dy, m_allowChangeMerge);
layout->UndoStack()->push(command); layout->UndoStack()->push(command);
if (layout->LayoutSettings().GetStickyEdges()) if (layout->LayoutSettings().IsStickyEdges())
{ {
QVector<QPointF> path; QVector<QPointF> path;
if (not p.isNull() && p->StickyPosition(m_stickyTranslateX, m_stickyTranslateY)) if (not p.isNull() && p->StickyPosition(m_stickyTranslateX, m_stickyTranslateY))
@ -677,7 +677,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
if (const QList<VPGraphicsPiece *> &graphicsPieces = sheet->SceneData()->GraphicsPieces(); if (const QList<VPGraphicsPiece *> &graphicsPieces = sheet->SceneData()->GraphicsPieces();
m_hasStickyPosition && not graphicsPieces.isEmpty()) m_hasStickyPosition && not graphicsPieces.isEmpty())
{ {
if (layout->LayoutSettings().GetStickyEdges()) if (layout->LayoutSettings().IsStickyEdges())
{ {
auto PreparePieces = [layout]() auto PreparePieces = [layout]()
{ {

View File

@ -1611,7 +1611,7 @@ void VPMainWindow::SetPropertyTabLayoutData()
m_layout->LayoutSettings().GetWarningPiecesOutOfBound()); m_layout->LayoutSettings().GetWarningPiecesOutOfBound());
SetCheckBoxValue(ui->checkBoxLayoutWarningPiecesSuperposition, SetCheckBoxValue(ui->checkBoxLayoutWarningPiecesSuperposition,
m_layout->LayoutSettings().GetWarningSuperpositionOfPieces()); m_layout->LayoutSettings().GetWarningSuperpositionOfPieces());
SetCheckBoxValue(ui->checkBoxSheetStickyEdges, m_layout->LayoutSettings().GetStickyEdges()); SetCheckBoxValue(ui->checkBoxSheetStickyEdges, m_layout->LayoutSettings().IsStickyEdges());
SetCheckBoxValue(ui->checkBoxFollowGainline, m_layout->LayoutSettings().GetFollowGrainline()); SetCheckBoxValue(ui->checkBoxFollowGainline, m_layout->LayoutSettings().GetFollowGrainline());
SetCheckBoxValue(ui->checkBoxTogetherWithNotches, m_layout->LayoutSettings().IsBoundaryTogetherWithNotches()); SetCheckBoxValue(ui->checkBoxTogetherWithNotches, m_layout->LayoutSettings().IsBoundaryTogetherWithNotches());
SetCheckBoxValue(ui->checkBoxCutOnFold, m_layout->LayoutSettings().IsCutOnFold()); SetCheckBoxValue(ui->checkBoxCutOnFold, m_layout->LayoutSettings().IsCutOnFold());
@ -3440,7 +3440,7 @@ void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRect
auto *command = new VPUndoPieceMove(piece, pieceDx, pieceDy); auto *command = new VPUndoPieceMove(piece, pieceDx, pieceDy);
m_layout->UndoStack()->push(command); m_layout->UndoStack()->push(command);
if (m_layout->LayoutSettings().GetStickyEdges()) if (m_layout->LayoutSettings().IsStickyEdges())
{ {
qreal stickyTranslateX = 0; qreal stickyTranslateX = 0;
qreal stickyTranslateY = 0; qreal stickyTranslateY = 0;

View File

@ -172,7 +172,7 @@ void VPLayoutFileWriter::WriteLayoutProperties(const VPLayoutPtr &layout)
writeStartElement(ML::TagControl); writeStartElement(ML::TagControl);
SetAttribute(ML::AttrWarningSuperposition, layout->LayoutSettings().GetWarningSuperpositionOfPieces()); SetAttribute(ML::AttrWarningSuperposition, layout->LayoutSettings().GetWarningSuperpositionOfPieces());
SetAttribute(ML::AttrWarningOutOfBound, layout->LayoutSettings().GetWarningPiecesOutOfBound()); SetAttribute(ML::AttrWarningOutOfBound, layout->LayoutSettings().GetWarningPiecesOutOfBound());
SetAttribute(ML::AttrStickyEdges, layout->LayoutSettings().GetStickyEdges()); SetAttribute(ML::AttrStickyEdges, layout->LayoutSettings().IsStickyEdges());
SetAttribute(ML::AttrPiecesGap, layout->LayoutSettings().GetPiecesGap()); SetAttribute(ML::AttrPiecesGap, layout->LayoutSettings().GetPiecesGap());
SetAttribute(ML::AttrFollowGrainline, layout->LayoutSettings().GetFollowGrainline()); SetAttribute(ML::AttrFollowGrainline, layout->LayoutSettings().GetFollowGrainline());
SetAttribute(ML::AttrBoundaryTogetherWithNotches, layout->LayoutSettings().IsBoundaryTogetherWithNotches()); SetAttribute(ML::AttrBoundaryTogetherWithNotches, layout->LayoutSettings().IsBoundaryTogetherWithNotches());