slots for the layout properties

This commit is contained in:
Ronan Le Tiec 2020-04-11 16:25:23 +02:00
parent 132bc819b3
commit 44bf83a089
3 changed files with 264 additions and 6 deletions

View File

@ -82,14 +82,87 @@ void PuzzleMainWindow::InitMenuBar()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::InitPropertyTabs() void PuzzleMainWindow::InitPropertyTabs()
{ {
// for the MVP we don't want the tiles and current layer tabs. InitPropertyTabCurrentPiece();
// we remove them. As soon as we need them, delete / update this code InitPropertyTabLayout();
ui->tabWidgetProperties->removeTab(3); // remove layers InitPropertyTabLayers();
ui->tabWidgetProperties->removeTab(2); // remove tiles InitPropertyTabTiles();
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::InitPropertyTabCurrentPiece()
{
} }
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::InitPropertyTabLayout()
{
// -------------------- init the unit combobox ---------------------
ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm)));
ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm)));
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
// set default unit - TODO when we have the setting for the unit
const qint32 indexUnit = -1;//ui->comboBoxLayoutUnit->findData(qApp->ValentinaSettings()->GetUnit());
if (indexUnit != -1)
{
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
}
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PuzzleMainWindow::LayoutUnitChanged);
// -------------------- init the template combobox ---------------------
// TODO
connect(ui->comboBoxLayoutTemplate, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PuzzleMainWindow::LayoutTemplateChanged);
// -------------------- layout width, length, orientation ------------------------
connect(ui->doubleSpinBoxLayoutWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutSizeChanged);
connect(ui->doubleSpinBoxLayoutLength, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutSizeChanged);
connect(ui->radioButtonLayoutPortrait, QOverload<bool>::of(&QRadioButton::toggled), this, &PuzzleMainWindow::LayoutOrientationChanged);
connect(ui->radioButtonLayoutLandscape, QOverload<bool>::of(&QRadioButton::toggled), this, &PuzzleMainWindow::LayoutOrientationChanged);
connect(ui->pushButtonLayoutRemoveUnusedLength, QOverload<bool>::of(&QPushButton::clicked), this, &PuzzleMainWindow::LayoutRemoveUnusedLength);
// -------------------- margins ------------------------
connect(ui->doubleSpinBoxLayoutMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutMarginChanged);
connect(ui->doubleSpinBoxLayoutMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &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 -----------------------
connect(ui->radioButtonLayoutFollowGrainlineNo, 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 ---------------
connect(ui->doubleSpinBoxLayoutPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &PuzzleMainWindow::LayoutPiecesGapChanged);
connect(ui->checkBoxLayoutWarningPiecesSuperposition, QOverload<bool>::of(&QCheckBox::toggled), this, &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 ---------------------------
connect(ui->pushButtonLayoutExport, QOverload<bool>::of(&QPushButton::clicked), this, &PuzzleMainWindow::LayoutExport);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::InitPropertyTabTiles()
{
// for the MVP we don't want the tiles tab.
// we remove it. As soon as we need it, update this code
ui->tabWidgetProperties->removeTab(2); // remove tiles
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::InitPropertyTabLayers()
{
// for the MVP we don't want the layers tab.
// we remove it. As soon as we need it, update this code
ui->tabWidgetProperties->removeTab(3); // remove layers
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::New() void PuzzleMainWindow::New()
{ {
@ -98,6 +171,8 @@ void PuzzleMainWindow::New()
msgBox.setText("TODO PuzzleMainWindow::New"); msgBox.setText("TODO PuzzleMainWindow::New");
int ret = msgBox.exec(); int ret = msgBox.exec();
Q_UNUSED(ret);
// TODO // TODO
@ -111,6 +186,8 @@ void PuzzleMainWindow::Open()
msgBox.setText("TODO PuzzleMainWindow::Open"); msgBox.setText("TODO PuzzleMainWindow::Open");
int ret = msgBox.exec(); int ret = msgBox.exec();
Q_UNUSED(ret);
// TODO // TODO
} }
@ -122,6 +199,8 @@ void PuzzleMainWindow::Save()
msgBox.setText("TODO PuzzleMainWindow::Save"); msgBox.setText("TODO PuzzleMainWindow::Save");
int ret = msgBox.exec(); int ret = msgBox.exec();
Q_UNUSED(ret);
// TODO // TODO
} }
@ -133,6 +212,8 @@ void PuzzleMainWindow::SaveAs()
msgBox.setText("TODO PuzzleMainWindow::SaveAs"); msgBox.setText("TODO PuzzleMainWindow::SaveAs");
int ret = msgBox.exec(); int ret = msgBox.exec();
Q_UNUSED(ret);
// TODO // TODO
} }
@ -144,6 +225,8 @@ void PuzzleMainWindow::ImportRawLayout()
msgBox.setText("TODO PuzzleMainWindow::ImportRawLayout"); msgBox.setText("TODO PuzzleMainWindow::ImportRawLayout");
int ret = msgBox.exec(); int ret = msgBox.exec();
Q_UNUSED(ret);
// TODO // TODO
} }
@ -155,6 +238,8 @@ void PuzzleMainWindow::CloseLayout()
msgBox.setText("TODO PuzzleMainWindow::CloseLayout"); msgBox.setText("TODO PuzzleMainWindow::CloseLayout");
int ret = msgBox.exec(); int ret = msgBox.exec();
Q_UNUSED(ret);
// TODO // TODO
} }
@ -172,4 +257,154 @@ void PuzzleMainWindow::AboutPuzzle()
aboutDialog->show(); aboutDialog->show();
} }
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutUnitChanged(int index)
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutUnitChanged");
int ret = msgBox.exec();
Q_UNUSED(index);
Q_UNUSED(ret);
// TODO
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutTemplateChanged(int index)
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutTemplateChanged");
int ret = msgBox.exec();
Q_UNUSED(index);
Q_UNUSED(ret);
// TODO
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutSizeChanged()
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutSizeChanged");
int ret = msgBox.exec();
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutOrientationChanged()
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutOrientationChanged");
int ret = msgBox.exec();
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutRemoveUnusedLength()
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutRemoveUnusedLength");
int ret = msgBox.exec();
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutMarginChanged()
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutMarginChanged");
int ret = msgBox.exec();
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutFollowGrainlineChanged()
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutFollowGrainlineChanged");
int ret = msgBox.exec();
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutPiecesGapChanged(double value)
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutPieceGapChanged");
int ret = msgBox.exec();
Q_UNUSED(value);
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutWarningPiecesSuperpositionChanged(bool checked)
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutWarningPiecesSuperpositionChanged");
int ret = msgBox.exec();
Q_UNUSED(checked);
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutWarningPiecesOutOfBoundChanged(bool checked)
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutWarningPiecesOutOfBoundChanged");
int ret = msgBox.exec();
Q_UNUSED(checked);
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutStickyEdgesChanged(bool checked)
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutStickyEdgesChanged");
int ret = msgBox.exec();
Q_UNUSED(checked);
Q_UNUSED(ret);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzleMainWindow::LayoutExport()
{
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText("TODO PuzzleMainWindow::LayoutExport");
int ret = msgBox.exec();
Q_UNUSED(ret);
}

View File

@ -28,6 +28,8 @@
#ifndef PUZZLEMAINWINDOW_H #ifndef PUZZLEMAINWINDOW_H
#define PUZZLEMAINWINDOW_H #define PUZZLEMAINWINDOW_H
#include "../vmisc/def.h"
#include <QMainWindow> #include <QMainWindow>
#include <QMessageBox> #include <QMessageBox>
@ -51,6 +53,11 @@ private:
void InitMenuBar(); void InitMenuBar();
void InitPropertyTabs(); void InitPropertyTabs();
void InitPropertyTabCurrentPiece();
void InitPropertyTabLayout();
void InitPropertyTabTiles();
void InitPropertyTabLayers();
private slots: private slots:
void New(); void New();
@ -63,6 +70,19 @@ private slots:
void AboutQt(); void AboutQt();
void AboutPuzzle(); void AboutPuzzle();
void LayoutUnitChanged(int index);
void LayoutTemplateChanged(int index);
void LayoutSizeChanged();
void LayoutOrientationChanged();
void LayoutRemoveUnusedLength();
void LayoutMarginChanged();
void LayoutFollowGrainlineChanged();
void LayoutPiecesGapChanged(double value);
void LayoutWarningPiecesSuperpositionChanged(bool checked);
void LayoutWarningPiecesOutOfBoundChanged(bool checked);
void LayoutStickyEdgesChanged(bool checked);
void LayoutExport();
}; };
#endif // PUZZLEMAINWINDOW_H #endif // PUZZLEMAINWINDOW_H

View File

@ -419,6 +419,9 @@
<property name="text"> <property name="text">
<string>No</string> <string>No</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -471,14 +474,14 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox"/> <widget class="QDoubleSpinBox" name="doubleSpinBoxLayoutPiecesGap"/>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBoxLayoutWarningPiecesSuperposition"> <widget class="QCheckBox" name="checkBoxLayoutWarningPiecesSuperposition">
<property name="text"> <property name="text">
<string>Wargnin superposition of pieces</string> <string>Warning superposition of pieces</string>
</property> </property>
</widget> </widget>
</item> </item>