From e81088283318b42227177315045b8ccd241c934f Mon Sep 17 00:00:00 2001 From: Dmitry Svetlichny Date: Wed, 15 May 2024 21:29:51 +0300 Subject: [PATCH 1/2] Fix write empty copyright author tags and sync with android --- src/GpxDocument.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GpxDocument.cpp b/src/GpxDocument.cpp index 3780e518c..2bc06b405 100644 --- a/src/GpxDocument.cpp +++ b/src/GpxDocument.cpp @@ -184,14 +184,14 @@ void OsmAnd::GpxDocument::writeMetadata(const Ref& metadata, const QSt writeNotNullText(xmlWriter, QStringLiteral("name"), trackName); writeNotNullText(xmlWriter, QStringLiteral("desc"), metadata->description); - if (metadata->author) + if (metadata->author && !metadata->author->name.isEmpty()) { xmlWriter.writeStartElement(QStringLiteral("author")); writeAuthor(xmlWriter, metadata->author); xmlWriter.writeEndElement(); } - if (metadata->copyright) + if (metadata->copyright && !metadata->copyright->author.isEmpty()) { xmlWriter.writeStartElement(QStringLiteral("copyright")); writeCopyright(xmlWriter, metadata->copyright); @@ -412,7 +412,9 @@ void OsmAnd::GpxDocument::writeAuthor(QXmlStreamWriter& xmlWriter, const Ref& copyright) { - xmlWriter.writeTextElement(QStringLiteral("author"), copyright->author); + if (!copyright->author.isEmpty()) + xmlWriter.writeTextElement(QStringLiteral("author"), copyright->author); + writeNotNullText(xmlWriter, QStringLiteral("year"), copyright->year); writeNotNullText(xmlWriter, QStringLiteral("license"), copyright->license); } From 8c80419e4ae5eb5f4aa65b6eabe6e2ac23941c30 Mon Sep 17 00:00:00 2001 From: Dmitry Svetlichny Date: Mon, 20 May 2024 15:58:11 +0300 Subject: [PATCH 2/2] add writeAttribute --- src/GpxDocument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GpxDocument.cpp b/src/GpxDocument.cpp index 2bc06b405..a824b2f7d 100644 --- a/src/GpxDocument.cpp +++ b/src/GpxDocument.cpp @@ -413,7 +413,7 @@ void OsmAnd::GpxDocument::writeAuthor(QXmlStreamWriter& xmlWriter, const Ref& copyright) { if (!copyright->author.isEmpty()) - xmlWriter.writeTextElement(QStringLiteral("author"), copyright->author); + xmlWriter.writeAttribute(QStringLiteral("author"), copyright->author); writeNotNullText(xmlWriter, QStringLiteral("year"), copyright->year); writeNotNullText(xmlWriter, QStringLiteral("license"), copyright->license);