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;
}

View File

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

View File

@ -342,7 +342,7 @@ void VPPiece::FlipHorizontally()
//---------------------------------------------------------------------------------------------------------------------
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;
}

View File

@ -297,7 +297,7 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (VPLayoutPtr const layout = piece->Layout(); not layout.isNull())
{
if (layout->LayoutSettings().GetStickyEdges() && m_hasStickyPosition)
if (layout->LayoutSettings().IsStickyEdges() && m_hasStickyPosition)
{
auto *command =
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);
layout->UndoStack()->push(command);
if (layout->LayoutSettings().GetStickyEdges())
if (layout->LayoutSettings().IsStickyEdges())
{
QVector<QPointF> path;
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);
layout->UndoStack()->push(command);
if (layout->LayoutSettings().GetStickyEdges())
if (layout->LayoutSettings().IsStickyEdges())
{
QVector<QPointF> path;
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();
m_hasStickyPosition && not graphicsPieces.isEmpty())
{
if (layout->LayoutSettings().GetStickyEdges())
if (layout->LayoutSettings().IsStickyEdges())
{
auto PreparePieces = [layout]()
{

View File

@ -1611,7 +1611,7 @@ void VPMainWindow::SetPropertyTabLayoutData()
m_layout->LayoutSettings().GetWarningPiecesOutOfBound());
SetCheckBoxValue(ui->checkBoxLayoutWarningPiecesSuperposition,
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->checkBoxTogetherWithNotches, m_layout->LayoutSettings().IsBoundaryTogetherWithNotches());
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);
m_layout->UndoStack()->push(command);
if (m_layout->LayoutSettings().GetStickyEdges())
if (m_layout->LayoutSettings().IsStickyEdges())
{
qreal stickyTranslateX = 0;
qreal stickyTranslateY = 0;

View File

@ -172,7 +172,7 @@ void VPLayoutFileWriter::WriteLayoutProperties(const VPLayoutPtr &layout)
writeStartElement(ML::TagControl);
SetAttribute(ML::AttrWarningSuperposition, layout->LayoutSettings().GetWarningSuperpositionOfPieces());
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::AttrFollowGrainline, layout->LayoutSettings().GetFollowGrainline());
SetAttribute(ML::AttrBoundaryTogetherWithNotches, layout->LayoutSettings().IsBoundaryTogetherWithNotches());