diff --git a/src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp b/src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp index 8fd1de929..be52922c3 100644 --- a/src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp +++ b/src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp @@ -247,7 +247,13 @@ void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece) Q_UNUSED(piece); 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()) { diff --git a/src/app/puzzle/xml/vpuzzlelayoutfilewriter.cpp b/src/app/puzzle/xml/vpuzzlelayoutfilewriter.cpp index c85f725b9..f9d4ef1c7 100644 --- a/src/app/puzzle/xml/vpuzzlelayoutfilewriter.cpp +++ b/src/app/puzzle/xml/vpuzzlelayoutfilewriter.cpp @@ -163,8 +163,8 @@ void VPuzzleLayoutFileWriter::WritePiece(VPuzzlePiece *piece) Q_UNUSED(piece); writeStartElement(ML::TagPiece); - SetAttribute(ML::AttrID, "uuid1"); // TODO / Fixme get the right value - SetAttribute(ML::AttrName, "Piece name"); // TODO / Fixme get the right value + SetAttribute(ML::AttrID, piece->GetUuid().toString()); + SetAttribute(ML::AttrName, piece->GetName()); SetAttribute(ML::AttrMirrored, "false"); // TODO / Fixme get the right value SetAttribute(ML::AttrTransform, "string representation of the transformation"); // TODO / Fixme get the right value