From 1b0b30eb7744f6830cfb9e05eec183f4d74efbbe Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Sat, 11 Apr 2020 17:04:44 +0200 Subject: [PATCH] current piece property, slot and code format --- src/app/puzzle/puzzlemainwindow.cpp | 129 +++++++++++++++++++++++---- src/app/puzzle/puzzlemainwindow.h | 5 ++ src/app/puzzle/puzzlemainwindow.ui | 131 +++++++++++++++++++++++++++- 3 files changed, 245 insertions(+), 20 deletions(-) diff --git a/src/app/puzzle/puzzlemainwindow.cpp b/src/app/puzzle/puzzlemainwindow.cpp index e2ee73152..4fc6ab236 100644 --- a/src/app/puzzle/puzzlemainwindow.cpp +++ b/src/app/puzzle/puzzlemainwindow.cpp @@ -91,6 +91,23 @@ void PuzzleMainWindow::InitPropertyTabs() //--------------------------------------------------------------------------------------------------------------------- void PuzzleMainWindow::InitPropertyTabCurrentPiece() { + // ------------------------------ seamline ------------------------------------ + connect(ui->checkBoxCurrentPieceShowSeamline, QOverload::of(&QCheckBox::toggled), this, + &PuzzleMainWindow::CurrentPieceShowSeamlineChanged); + + // ------------------------------ geometry ------------------------------------ + connect(ui->checkBoxCurrentPieceMirrorPiece, QOverload::of(&QCheckBox::toggled), this, + &PuzzleMainWindow::CurrentPieceMirrorPieceChanged); + + // ------------------------------ rotation ------------------------------------ + connect(ui->doubleSpinBoxCurrentPieceAngle, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::CurrentPieceAngleChanged); + + // ------------------------------ placement ----------------------------------- + connect(ui->doubleSpinBoxCurrentPieceBoxPositionX, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::CurrentPiecePositionChanged); + connect(ui->doubleSpinBoxCurrentPieceBoxPositionY, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::CurrentPiecePositionChanged); } @@ -110,44 +127,63 @@ void PuzzleMainWindow::InitPropertyTabLayout() ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit); } - connect(ui->comboBoxLayoutUnit, QOverload::of(&QComboBox::currentIndexChanged), this, &PuzzleMainWindow::LayoutUnitChanged); + connect(ui->comboBoxLayoutUnit, QOverload::of(&QComboBox::currentIndexChanged), this, + &PuzzleMainWindow::LayoutUnitChanged); // -------------------- init the template combobox --------------------- // TODO - connect(ui->comboBoxLayoutTemplate, QOverload::of(&QComboBox::currentIndexChanged), this, &PuzzleMainWindow::LayoutTemplateChanged); + connect(ui->comboBoxLayoutTemplate, QOverload::of(&QComboBox::currentIndexChanged), this, + &PuzzleMainWindow::LayoutTemplateChanged); // -------------------- layout width, length, orientation ------------------------ - connect(ui->doubleSpinBoxLayoutWidth, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutSizeChanged); - connect(ui->doubleSpinBoxLayoutLength, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutSizeChanged); - connect(ui->radioButtonLayoutPortrait, QOverload::of(&QRadioButton::toggled), this, &PuzzleMainWindow::LayoutOrientationChanged); - connect(ui->radioButtonLayoutLandscape, QOverload::of(&QRadioButton::toggled), this, &PuzzleMainWindow::LayoutOrientationChanged); - connect(ui->pushButtonLayoutRemoveUnusedLength, QOverload::of(&QPushButton::clicked), this, &PuzzleMainWindow::LayoutRemoveUnusedLength); + connect(ui->doubleSpinBoxLayoutWidth, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutSizeChanged); + connect(ui->doubleSpinBoxLayoutLength, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutSizeChanged); + connect(ui->radioButtonLayoutPortrait, QOverload::of(&QRadioButton::clicked), this, + &PuzzleMainWindow::LayoutOrientationChanged); + connect(ui->radioButtonLayoutLandscape, QOverload::of(&QRadioButton::clicked), this, + &PuzzleMainWindow::LayoutOrientationChanged); + connect(ui->pushButtonLayoutRemoveUnusedLength, QOverload::of(&QPushButton::clicked), this, + &PuzzleMainWindow::LayoutRemoveUnusedLength); // -------------------- margins ------------------------ - connect(ui->doubleSpinBoxLayoutMarginTop, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); - connect(ui->doubleSpinBoxLayoutMarginRight, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); - connect(ui->doubleSpinBoxLayoutMarginBottom, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); - connect(ui->doubleSpinBoxLayoutMarginLeft, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); + connect(ui->doubleSpinBoxLayoutMarginTop, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutMarginChanged); + connect(ui->doubleSpinBoxLayoutMarginRight, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutMarginChanged); + connect(ui->doubleSpinBoxLayoutMarginBottom, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutMarginChanged); + connect(ui->doubleSpinBoxLayoutMarginLeft, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutMarginChanged); // ------------------- follow grainline ----------------------- - connect(ui->radioButtonLayoutFollowGrainlineNo, QOverload::of(&QRadioButton::clicked), this, &PuzzleMainWindow::LayoutFollowGrainlineChanged); - connect(ui->radioButtonLayoutFollowGrainlineVertical, QOverload::of(&QRadioButton::clicked), this, &PuzzleMainWindow::LayoutFollowGrainlineChanged); - connect(ui->radioButtonLayoutFollowGrainlineHorizontal, QOverload::of(&QRadioButton::clicked), this, &PuzzleMainWindow::LayoutFollowGrainlineChanged); + connect(ui->radioButtonLayoutFollowGrainlineNo, QOverload::of(&QRadioButton::clicked), this, + &PuzzleMainWindow::LayoutFollowGrainlineChanged); + connect(ui->radioButtonLayoutFollowGrainlineVertical, QOverload::of(&QRadioButton::clicked), this, + &PuzzleMainWindow::LayoutFollowGrainlineChanged); + connect(ui->radioButtonLayoutFollowGrainlineHorizontal, QOverload::of(&QRadioButton::clicked), this, + &PuzzleMainWindow::LayoutFollowGrainlineChanged); // -------------------- pieces gap and checkboxes --------------- - connect(ui->doubleSpinBoxLayoutPiecesGap, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutPiecesGapChanged); - connect(ui->checkBoxLayoutWarningPiecesSuperposition, QOverload::of(&QCheckBox::toggled), this, &PuzzleMainWindow::LayoutWarningPiecesSuperpositionChanged); - connect(ui->checkBoxLayoutWarningPiecesOutOfBound, QOverload::of(&QCheckBox::toggled), this, &PuzzleMainWindow::LayoutWarningPiecesOutOfBoundChanged); - connect(ui->checkBoxLayoutStickyEdges, QOverload::of(&QCheckBox::toggled), this, &PuzzleMainWindow::LayoutStickyEdgesChanged); + connect(ui->doubleSpinBoxLayoutPiecesGap, QOverload::of(&QDoubleSpinBox::valueChanged), this, + &PuzzleMainWindow::LayoutPiecesGapChanged); + connect(ui->checkBoxLayoutWarningPiecesSuperposition, QOverload::of(&QCheckBox::toggled), this, + &PuzzleMainWindow::LayoutWarningPiecesSuperpositionChanged); + connect(ui->checkBoxLayoutWarningPiecesOutOfBound, QOverload::of(&QCheckBox::toggled), this, + &PuzzleMainWindow::LayoutWarningPiecesOutOfBoundChanged); + connect(ui->checkBoxLayoutStickyEdges, QOverload::of(&QCheckBox::toggled), this, + &PuzzleMainWindow::LayoutStickyEdgesChanged); // -------------------- export --------------------------- // TODO init the file format export combobox - connect(ui->pushButtonLayoutExport, QOverload::of(&QPushButton::clicked), this, &PuzzleMainWindow::LayoutExport); + connect(ui->pushButtonLayoutExport, QOverload::of(&QPushButton::clicked), this, + &PuzzleMainWindow::LayoutExport); } //--------------------------------------------------------------------------------------------------------------------- @@ -434,3 +470,58 @@ void PuzzleMainWindow::LayoutExport() } +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::CurrentPieceShowSeamlineChanged(bool checked) +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::CurrentPieceShowSeamlineChanged"); + int ret = msgBox.exec(); + + Q_UNUSED(checked); + Q_UNUSED(ret); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::CurrentPieceMirrorPieceChanged(bool checked) +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::CurrentPieceMirrorPieceChanged"); + int ret = msgBox.exec(); + + Q_UNUSED(checked); + Q_UNUSED(ret); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::CurrentPieceAngleChanged(double value) +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::CurrentPieceAngleChanged"); + int ret = msgBox.exec(); + + Q_UNUSED(value); + Q_UNUSED(ret); + + // TODO +} + + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::CurrentPiecePositionChanged() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::CurrentPiecePositionChanged"); + int ret = msgBox.exec(); + + Q_UNUSED(ret); + + // TODO +} diff --git a/src/app/puzzle/puzzlemainwindow.h b/src/app/puzzle/puzzlemainwindow.h index 6eb86aaed..b54bc0abd 100644 --- a/src/app/puzzle/puzzlemainwindow.h +++ b/src/app/puzzle/puzzlemainwindow.h @@ -83,6 +83,11 @@ private slots: void LayoutStickyEdgesChanged(bool checked); void LayoutExport(); + void CurrentPieceShowSeamlineChanged(bool checked); + void CurrentPieceMirrorPieceChanged(bool checked); + void CurrentPieceAngleChanged(double value); + void CurrentPiecePositionChanged(); + }; #endif // PUZZLEMAINWINDOW_H diff --git a/src/app/puzzle/puzzlemainwindow.ui b/src/app/puzzle/puzzlemainwindow.ui index f98fe7ec3..e36180443 100644 --- a/src/app/puzzle/puzzlemainwindow.ui +++ b/src/app/puzzle/puzzlemainwindow.ui @@ -123,6 +123,136 @@ + + + + Infos + + + + + + DummyName + + + true + + + + + + + Name: + + + + + + + + + + Seamline + + + + + + Show Seamline + + + true + + + + + + + + + + Geometry + + + + + + Mirror piece + + + + + + + + + + Rotation + + + + + + Angle: + + + + + + + 360.000000000000000 + + + 0.100000000000000 + + + + + + + + + + Placement + + + + + + X: + + + + + + + 10000.000000000000000 + + + 0.100000000000000 + + + + + + + Y: + + + + + + + 10000.000000000000000 + + + 0.100000000000000 + + + + + + @@ -868,7 +998,6 @@ doubleSpinBoxLayoutMarginLeft doubleSpinBoxLayoutMarginRight doubleSpinBoxLayoutMarginBottom - scrollAreaCurrentPiece scrollAreaLayers scrollAreaTiles