optimization current piece tab
This commit is contained in:
parent
f5e325a235
commit
9a8fabc25e
|
@ -72,7 +72,6 @@ PuzzleMainWindow::PuzzleMainWindow(const VPuzzleCommandLinePtr &cmd, QWidget *pa
|
|||
InitProperties();
|
||||
InitPieceCarrousel();
|
||||
|
||||
|
||||
SetPropertiesData();
|
||||
}
|
||||
|
||||
|
@ -328,14 +327,22 @@ void PuzzleMainWindow::SetPropertyTabCurrentPieceData()
|
|||
else
|
||||
{
|
||||
// TODO : update current piece data to show a "no current piece selected"
|
||||
ui->containerCurrentPieceNoData->setVisible(true);
|
||||
ui->containerCurrentPieceData->setVisible(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->containerCurrentPieceNoData->setVisible(false);
|
||||
ui->containerCurrentPieceData->setVisible(true);
|
||||
|
||||
// set the value to the current piece
|
||||
ui->lineEditCurrentPieceName->setText(m_selectedPiece->GetName());
|
||||
|
||||
// TODO: checkbox show seamline, mirror piece, rotation and placement;
|
||||
ui->checkBoxCurrentPieceShowSeamline->setChecked(m_selectedPiece->GetShowSeamLine());
|
||||
ui->checkBoxCurrentPieceMirrorPiece->setChecked(m_selectedPiece->GetPieceMirrored());
|
||||
|
||||
// TODO:rotation and placement;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,29 +759,19 @@ void PuzzleMainWindow::on_pushButtonLayoutExport_clicked()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::on_checkBoxCurrentPieceShowSeamline_toggled(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
|
||||
if(m_selectedPiece != nullptr)
|
||||
{
|
||||
m_selectedPiece->SetShowSeamLine(checked);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::on_checkBoxCurrentPieceMirrorPiece_toggled(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
|
||||
if(m_selectedPiece != nullptr)
|
||||
{
|
||||
m_selectedPiece->SetPieceMirrored(checked);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -175,7 +175,7 @@
|
|||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -232,8 +232,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>356</width>
|
||||
<height>760</height>
|
||||
<width>342</width>
|
||||
<height>894</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -254,44 +254,24 @@
|
|||
</widget>
|
||||
</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">
|
||||
<widget class="QWidget" name="containerCurrentPieceNoData" native="true">
|
||||
<layout class="QVBoxLayout" name="containerCurrentPieceNoDataLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxCurrentPieceShowSeamline">
|
||||
<property name="text">
|
||||
<string>Show Seamline</string>
|
||||
<widget class="QLabel" name="labelCurrentPieceNoPieceSelected">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<property name="text">
|
||||
<string>No piece selected</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -299,85 +279,136 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxCurrentPieceGeometry">
|
||||
<property name="title">
|
||||
<string>Geometry</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<widget class="QWidget" name="containerCurrentPieceData" native="true">
|
||||
<layout class="QVBoxLayout" name="containerCurrentPieceDataLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxCurrentPieceMirrorPiece">
|
||||
<property name="text">
|
||||
<string>Mirror piece</string>
|
||||
<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>
|
||||
</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>
|
||||
<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 row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurrentPieceAngle">
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
<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>
|
||||
</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>
|
||||
<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 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>
|
||||
<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>
|
||||
</layout>
|
||||
|
|
|
@ -78,3 +78,29 @@ void VPuzzlePiece::SetCuttingLine(const QVector<QPointF> &cuttingLine)
|
|||
{
|
||||
m_cuttingLine = cuttingLine;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzlePiece::GetShowSeamLine()
|
||||
{
|
||||
return m_showSeamline;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzlePiece::SetShowSeamLine(bool value)
|
||||
{
|
||||
m_showSeamline = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzlePiece::GetPieceMirrored()
|
||||
{
|
||||
return m_mirrorPiece;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzlePiece::SetPieceMirrored(bool value)
|
||||
{
|
||||
m_mirrorPiece = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,11 +65,37 @@ public:
|
|||
|
||||
void SetCuttingLine(const QVector<QPointF> &cuttingLine);
|
||||
|
||||
/**
|
||||
* @brief GetShowSeamLine returns wether the seam line of the piece has to be shown or not
|
||||
* @return true if the seamline has to be shown
|
||||
*/
|
||||
bool GetShowSeamLine();
|
||||
|
||||
/**
|
||||
* @brief SetShowSeamLine sets wether the seam line of the piece has to be shown or not
|
||||
* @param value true if the seamline has to be shown
|
||||
*/
|
||||
void SetShowSeamLine(bool value);
|
||||
|
||||
/**
|
||||
* @brief GetMirrorPiece returns wether the piece is mirrored or not
|
||||
* @return true if the piece is mirrored
|
||||
*/
|
||||
bool GetPieceMirrored();
|
||||
|
||||
/**
|
||||
* @brief SetMirrorPiece sets wether the piece is mirrored or not
|
||||
* @param value true if the piece will be mirrored
|
||||
*/
|
||||
void SetPieceMirrored(bool value);
|
||||
|
||||
|
||||
private:
|
||||
QUuid m_uuid{QUuid()};
|
||||
QString m_name{QString()};
|
||||
QVector<QPointF> m_cuttingLine{QVector<QPointF>()};
|
||||
bool m_showSeamline{true};
|
||||
bool m_mirrorPiece{false};
|
||||
};
|
||||
|
||||
#endif // VPUZZLEPIECE_H
|
||||
|
|
|
@ -60,4 +60,5 @@ const QString AttrFollowGrainLine = QStringLiteral("followGrainLine");
|
|||
const QString AttrID = QStringLiteral("id");
|
||||
const QString AttrMirrored = QStringLiteral("mirrored");
|
||||
const QString AttrTransform = QStringLiteral("transform");
|
||||
const QString AttrShowSeamline = QStringLiteral("showSeamline");
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ extern const QString AttrFollowGrainLine;
|
|||
extern const QString AttrID;
|
||||
extern const QString AttrMirrored;
|
||||
extern const QString AttrTransform;
|
||||
extern const QString AttrShowSeamline;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -249,9 +249,15 @@ void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece)
|
|||
|
||||
QXmlStreamAttributes attribs = attributes();
|
||||
piece->SetName(ReadAttributeString(attribs, ML::AttrName, tr("Piece")));
|
||||
|
||||
QString uuidStr = ReadAttributeString(attribs, ML::AttrID, QUuid().toString());// FIXME: is that correct to have a default value here?
|
||||
piece->SetUuid(QUuid(uuidStr));
|
||||
|
||||
bool showSeamline = ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr);
|
||||
piece->SetShowSeamLine(showSeamline);
|
||||
|
||||
bool pieceMirrored = ReadAttributeBool(attribs, ML::AttrMirrored, falseStr);
|
||||
piece->SetPieceMirrored(pieceMirrored);
|
||||
// TODO read the further attributes
|
||||
|
||||
|
||||
|
|
|
@ -165,7 +165,8 @@ void VPuzzleLayoutFileWriter::WritePiece(VPuzzlePiece *piece)
|
|||
writeStartElement(ML::TagPiece);
|
||||
SetAttribute(ML::AttrID, piece->GetUuid().toString());
|
||||
SetAttribute(ML::AttrName, piece->GetName());
|
||||
SetAttribute(ML::AttrMirrored, "false"); // TODO / Fixme get the right value
|
||||
SetAttribute(ML::AttrMirrored, piece->GetPieceMirrored()); // TODO / Fixme get the right value
|
||||
SetAttribute(ML::AttrShowSeamline, piece->GetShowSeamLine()); // TODO / Fixme get the right value
|
||||
SetAttribute(ML::AttrTransform, "string representation of the transformation"); // TODO / Fixme get the right value
|
||||
|
||||
// TODO cuttingLine
|
||||
|
|
Loading…
Reference in New Issue
Block a user