Piece Name and UUID taken into account in *vlt reader / writer

This commit is contained in:
Ronan Le Tiec 2020-04-26 14:12:20 +02:00
parent 25cb7f9e6e
commit 39c889d43b
2 changed files with 9 additions and 3 deletions

View File

@ -247,7 +247,13 @@ void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece)
Q_UNUSED(piece); Q_UNUSED(piece);
Q_ASSERT(isStartElement() && name() == ML::TagPiece); Q_ASSERT(isStartElement() && name() == ML::TagPiece);
// TODO read the attributes 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));
// TODO read the further attributes
while (readNextStartElement()) while (readNextStartElement())
{ {

View File

@ -163,8 +163,8 @@ void VPuzzleLayoutFileWriter::WritePiece(VPuzzlePiece *piece)
Q_UNUSED(piece); Q_UNUSED(piece);
writeStartElement(ML::TagPiece); writeStartElement(ML::TagPiece);
SetAttribute(ML::AttrID, "uuid1"); // TODO / Fixme get the right value SetAttribute(ML::AttrID, piece->GetUuid().toString());
SetAttribute(ML::AttrName, "Piece name"); // TODO / Fixme get the right value SetAttribute(ML::AttrName, piece->GetName());
SetAttribute(ML::AttrMirrored, "false"); // TODO / Fixme get the right value SetAttribute(ML::AttrMirrored, "false"); // 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