current piece property, slot and code format

This commit is contained in:
Ronan Le Tiec 2020-04-11 17:04:44 +02:00
parent e35e80a242
commit 1b0b30eb77
3 changed files with 245 additions and 20 deletions

View File

@ -91,6 +91,23 @@ void PuzzleMainWindow::InitPropertyTabs()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::InitPropertyTabCurrentPiece() void PuzzleMainWindow::InitPropertyTabCurrentPiece()
{ {
// ------------------------------ seamline ------------------------------------
connect(ui->checkBoxCurrentPieceShowSeamline, QOverload<bool>::of(&QCheckBox::toggled), this,
&PuzzleMainWindow::CurrentPieceShowSeamlineChanged);
// ------------------------------ geometry ------------------------------------
connect(ui->checkBoxCurrentPieceMirrorPiece, QOverload<bool>::of(&QCheckBox::toggled), this,
&PuzzleMainWindow::CurrentPieceMirrorPieceChanged);
// ------------------------------ rotation ------------------------------------
connect(ui->doubleSpinBoxCurrentPieceAngle, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&PuzzleMainWindow::CurrentPieceAngleChanged);
// ------------------------------ placement -----------------------------------
connect(ui->doubleSpinBoxCurrentPieceBoxPositionX, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&PuzzleMainWindow::CurrentPiecePositionChanged);
connect(ui->doubleSpinBoxCurrentPieceBoxPositionY, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&PuzzleMainWindow::CurrentPiecePositionChanged);
} }
@ -110,44 +127,63 @@ void PuzzleMainWindow::InitPropertyTabLayout()
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit); ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
} }
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PuzzleMainWindow::LayoutUnitChanged); connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&PuzzleMainWindow::LayoutUnitChanged);
// -------------------- init the template combobox --------------------- // -------------------- init the template combobox ---------------------
// TODO // TODO
connect(ui->comboBoxLayoutTemplate, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PuzzleMainWindow::LayoutTemplateChanged); connect(ui->comboBoxLayoutTemplate, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&PuzzleMainWindow::LayoutTemplateChanged);
// -------------------- layout width, length, orientation ------------------------ // -------------------- layout width, length, orientation ------------------------
connect(ui->doubleSpinBoxLayoutWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutSizeChanged); connect(ui->doubleSpinBoxLayoutWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
connect(ui->doubleSpinBoxLayoutLength, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutSizeChanged); &PuzzleMainWindow::LayoutSizeChanged);
connect(ui->radioButtonLayoutPortrait, QOverload<bool>::of(&QRadioButton::toggled), this, &PuzzleMainWindow::LayoutOrientationChanged); connect(ui->doubleSpinBoxLayoutLength, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
connect(ui->radioButtonLayoutLandscape, QOverload<bool>::of(&QRadioButton::toggled), this, &PuzzleMainWindow::LayoutOrientationChanged); &PuzzleMainWindow::LayoutSizeChanged);
connect(ui->pushButtonLayoutRemoveUnusedLength, QOverload<bool>::of(&QPushButton::clicked), this, &PuzzleMainWindow::LayoutRemoveUnusedLength); connect(ui->radioButtonLayoutPortrait, QOverload<bool>::of(&QRadioButton::clicked), this,
&PuzzleMainWindow::LayoutOrientationChanged);
connect(ui->radioButtonLayoutLandscape, QOverload<bool>::of(&QRadioButton::clicked), this,
&PuzzleMainWindow::LayoutOrientationChanged);
connect(ui->pushButtonLayoutRemoveUnusedLength, QOverload<bool>::of(&QPushButton::clicked), this,
&PuzzleMainWindow::LayoutRemoveUnusedLength);
// -------------------- margins ------------------------ // -------------------- margins ------------------------
connect(ui->doubleSpinBoxLayoutMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); connect(ui->doubleSpinBoxLayoutMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
connect(ui->doubleSpinBoxLayoutMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); &PuzzleMainWindow::LayoutMarginChanged);
connect(ui->doubleSpinBoxLayoutMarginBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); connect(ui->doubleSpinBoxLayoutMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
connect(ui->doubleSpinBoxLayoutMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged); &PuzzleMainWindow::LayoutMarginChanged);
connect(ui->doubleSpinBoxLayoutMarginBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&PuzzleMainWindow::LayoutMarginChanged);
connect(ui->doubleSpinBoxLayoutMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&PuzzleMainWindow::LayoutMarginChanged);
// ------------------- follow grainline ----------------------- // ------------------- follow grainline -----------------------
connect(ui->radioButtonLayoutFollowGrainlineNo, QOverload<bool>::of(&QRadioButton::clicked), this, &PuzzleMainWindow::LayoutFollowGrainlineChanged); connect(ui->radioButtonLayoutFollowGrainlineNo, QOverload<bool>::of(&QRadioButton::clicked), this,
connect(ui->radioButtonLayoutFollowGrainlineVertical, QOverload<bool>::of(&QRadioButton::clicked), this, &PuzzleMainWindow::LayoutFollowGrainlineChanged); &PuzzleMainWindow::LayoutFollowGrainlineChanged);
connect(ui->radioButtonLayoutFollowGrainlineHorizontal, QOverload<bool>::of(&QRadioButton::clicked), this, &PuzzleMainWindow::LayoutFollowGrainlineChanged); connect(ui->radioButtonLayoutFollowGrainlineVertical, QOverload<bool>::of(&QRadioButton::clicked), this,
&PuzzleMainWindow::LayoutFollowGrainlineChanged);
connect(ui->radioButtonLayoutFollowGrainlineHorizontal, QOverload<bool>::of(&QRadioButton::clicked), this,
&PuzzleMainWindow::LayoutFollowGrainlineChanged);
// -------------------- pieces gap and checkboxes --------------- // -------------------- pieces gap and checkboxes ---------------
connect(ui->doubleSpinBoxLayoutPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutPiecesGapChanged); connect(ui->doubleSpinBoxLayoutPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
connect(ui->checkBoxLayoutWarningPiecesSuperposition, QOverload<bool>::of(&QCheckBox::toggled), this, &PuzzleMainWindow::LayoutWarningPiecesSuperpositionChanged); &PuzzleMainWindow::LayoutPiecesGapChanged);
connect(ui->checkBoxLayoutWarningPiecesOutOfBound, QOverload<bool>::of(&QCheckBox::toggled), this, &PuzzleMainWindow::LayoutWarningPiecesOutOfBoundChanged); connect(ui->checkBoxLayoutWarningPiecesSuperposition, QOverload<bool>::of(&QCheckBox::toggled), this,
connect(ui->checkBoxLayoutStickyEdges, QOverload<bool>::of(&QCheckBox::toggled), this, &PuzzleMainWindow::LayoutStickyEdgesChanged); &PuzzleMainWindow::LayoutWarningPiecesSuperpositionChanged);
connect(ui->checkBoxLayoutWarningPiecesOutOfBound, QOverload<bool>::of(&QCheckBox::toggled), this,
&PuzzleMainWindow::LayoutWarningPiecesOutOfBoundChanged);
connect(ui->checkBoxLayoutStickyEdges, QOverload<bool>::of(&QCheckBox::toggled), this,
&PuzzleMainWindow::LayoutStickyEdgesChanged);
// -------------------- export --------------------------- // -------------------- export ---------------------------
// TODO init the file format export combobox // TODO init the file format export combobox
connect(ui->pushButtonLayoutExport, QOverload<bool>::of(&QPushButton::clicked), this, &PuzzleMainWindow::LayoutExport); connect(ui->pushButtonLayoutExport, QOverload<bool>::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
}

View File

@ -83,6 +83,11 @@ private slots:
void LayoutStickyEdgesChanged(bool checked); void LayoutStickyEdgesChanged(bool checked);
void LayoutExport(); void LayoutExport();
void CurrentPieceShowSeamlineChanged(bool checked);
void CurrentPieceMirrorPieceChanged(bool checked);
void CurrentPieceAngleChanged(double value);
void CurrentPiecePositionChanged();
}; };
#endif // PUZZLEMAINWINDOW_H #endif // PUZZLEMAINWINDOW_H

View File

@ -123,6 +123,136 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceInfo">
<property name="title">
<string>Infos</string>
</property>
<layout class="QFormLayout" name="formLayout_4">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditCurrentPieceName">
<property name="text">
<string>DummyName</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCurrentPieceName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceSeamline">
<property name="title">
<string>Seamline</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceShowSeamline">
<property name="text">
<string>Show Seamline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceGeometry">
<property name="title">
<string>Geometry</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceMirrorPiece">
<property name="text">
<string>Mirror piece</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceRotation">
<property name="title">
<string>Rotation</string>
</property>
<layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="labelCurrentPieceAngle">
<property name="text">
<string>Angle:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurrentPieceAngle">
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPiecePlacement">
<property name="title">
<string>Placement</string>
</property>
<layout class="QFormLayout" name="formLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="labelCurrentPiecePositionX">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurrentPieceBoxPositionX">
<property name="maximum">
<double>10000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCurrentPiecePositionY">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurrentPieceBoxPositionY">
<property name="maximum">
<double>10000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacerCurrentPiece"> <spacer name="verticalSpacerCurrentPiece">
<property name="orientation"> <property name="orientation">
@ -868,7 +998,6 @@
<tabstop>doubleSpinBoxLayoutMarginLeft</tabstop> <tabstop>doubleSpinBoxLayoutMarginLeft</tabstop>
<tabstop>doubleSpinBoxLayoutMarginRight</tabstop> <tabstop>doubleSpinBoxLayoutMarginRight</tabstop>
<tabstop>doubleSpinBoxLayoutMarginBottom</tabstop> <tabstop>doubleSpinBoxLayoutMarginBottom</tabstop>
<tabstop>scrollAreaCurrentPiece</tabstop>
<tabstop>scrollAreaLayers</tabstop> <tabstop>scrollAreaLayers</tabstop>
<tabstop>scrollAreaTiles</tabstop> <tabstop>scrollAreaTiles</tabstop>
</tabstops> </tabstops>