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();
|
InitProperties();
|
||||||
InitPieceCarrousel();
|
InitPieceCarrousel();
|
||||||
|
|
||||||
|
|
||||||
SetPropertiesData();
|
SetPropertiesData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,14 +327,22 @@ void PuzzleMainWindow::SetPropertyTabCurrentPieceData()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO : update current piece data to show a "no current piece selected"
|
// TODO : update current piece data to show a "no current piece selected"
|
||||||
|
ui->containerCurrentPieceNoData->setVisible(true);
|
||||||
|
ui->containerCurrentPieceData->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ui->containerCurrentPieceNoData->setVisible(false);
|
||||||
|
ui->containerCurrentPieceData->setVisible(true);
|
||||||
|
|
||||||
// set the value to the current piece
|
// set the value to the current piece
|
||||||
ui->lineEditCurrentPieceName->setText(m_selectedPiece->GetName());
|
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)
|
void PuzzleMainWindow::on_checkBoxCurrentPieceShowSeamline_toggled(bool checked)
|
||||||
{
|
{
|
||||||
// just for test purpuses, to be removed:
|
if(m_selectedPiece != nullptr)
|
||||||
QMessageBox msgBox;
|
{
|
||||||
msgBox.setText("TODO PuzzleMainWindow::CurrentPieceShowSeamlineChanged");
|
m_selectedPiece->SetShowSeamLine(checked);
|
||||||
int ret = msgBox.exec();
|
}
|
||||||
|
|
||||||
Q_UNUSED(checked);
|
|
||||||
Q_UNUSED(ret);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PuzzleMainWindow::on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked)
|
void PuzzleMainWindow::on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked)
|
||||||
{
|
{
|
||||||
// just for test purpuses, to be removed:
|
if(m_selectedPiece != nullptr)
|
||||||
QMessageBox msgBox;
|
{
|
||||||
msgBox.setText("TODO PuzzleMainWindow::CurrentPieceMirrorPieceChanged");
|
m_selectedPiece->SetPieceMirrored(checked);
|
||||||
int ret = msgBox.exec();
|
}
|
||||||
|
|
||||||
Q_UNUSED(checked);
|
|
||||||
Q_UNUSED(ret);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -175,7 +175,7 @@
|
||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -232,8 +232,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>356</width>
|
<width>342</width>
|
||||||
<height>760</height>
|
<height>894</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
@ -253,6 +253,34 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="containerCurrentPieceNoData" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="containerCurrentPieceNoDataLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelCurrentPieceNoPieceSelected">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>400</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>No piece selected</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="containerCurrentPieceData" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="containerCurrentPieceDataLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBoxCurrentPieceInfo">
|
<widget class="QGroupBox" name="groupBoxCurrentPieceInfo">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -383,6 +411,9 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacerCurrentPiece">
|
<spacer name="verticalSpacerCurrentPiece">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -78,3 +78,29 @@ void VPuzzlePiece::SetCuttingLine(const QVector<QPointF> &cuttingLine)
|
||||||
{
|
{
|
||||||
m_cuttingLine = 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);
|
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:
|
private:
|
||||||
QUuid m_uuid{QUuid()};
|
QUuid m_uuid{QUuid()};
|
||||||
QString m_name{QString()};
|
QString m_name{QString()};
|
||||||
QVector<QPointF> m_cuttingLine{QVector<QPointF>()};
|
QVector<QPointF> m_cuttingLine{QVector<QPointF>()};
|
||||||
|
bool m_showSeamline{true};
|
||||||
|
bool m_mirrorPiece{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPUZZLEPIECE_H
|
#endif // VPUZZLEPIECE_H
|
||||||
|
|
|
@ -60,4 +60,5 @@ const QString AttrFollowGrainLine = QStringLiteral("followGrainLine");
|
||||||
const QString AttrID = QStringLiteral("id");
|
const QString AttrID = QStringLiteral("id");
|
||||||
const QString AttrMirrored = QStringLiteral("mirrored");
|
const QString AttrMirrored = QStringLiteral("mirrored");
|
||||||
const QString AttrTransform = QStringLiteral("transform");
|
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 AttrID;
|
||||||
extern const QString AttrMirrored;
|
extern const QString AttrMirrored;
|
||||||
extern const QString AttrTransform;
|
extern const QString AttrTransform;
|
||||||
|
extern const QString AttrShowSeamline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -249,9 +249,15 @@ void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece)
|
||||||
|
|
||||||
QXmlStreamAttributes attribs = attributes();
|
QXmlStreamAttributes attribs = attributes();
|
||||||
piece->SetName(ReadAttributeString(attribs, ML::AttrName, tr("Piece")));
|
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?
|
QString uuidStr = ReadAttributeString(attribs, ML::AttrID, QUuid().toString());// FIXME: is that correct to have a default value here?
|
||||||
piece->SetUuid(QUuid(uuidStr));
|
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
|
// TODO read the further attributes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,8 @@ void VPuzzleLayoutFileWriter::WritePiece(VPuzzlePiece *piece)
|
||||||
writeStartElement(ML::TagPiece);
|
writeStartElement(ML::TagPiece);
|
||||||
SetAttribute(ML::AttrID, piece->GetUuid().toString());
|
SetAttribute(ML::AttrID, piece->GetUuid().toString());
|
||||||
SetAttribute(ML::AttrName, piece->GetName());
|
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
|
SetAttribute(ML::AttrTransform, "string representation of the transformation"); // TODO / Fixme get the right value
|
||||||
|
|
||||||
// TODO cuttingLine
|
// TODO cuttingLine
|
||||||
|
|
Loading…
Reference in New Issue
Block a user