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">
|
||||
|
@ -253,6 +253,34 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="groupBoxCurrentPieceInfo">
|
||||
<property name="title">
|
||||
|
@ -383,6 +411,9 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacerCurrentPiece">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -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