aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 8b9f9688..e28ffb22 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -1982,9 +1982,16 @@ void Connection::Private::saveDevicesList()
rootObj.insert(QStringLiteral("sync_token"), q->nextBatchToken());
}
-
- QJsonDocument json { rootObj };
- const auto data = json.toJson();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ const auto data =
+ cacheToBinary
+ ? QCborValue::fromJsonValue(rootObj).toCbor()
+ : QJsonDocument(rootObj).toJson(QJsonDocument::Compact);
+#else
+ QJsonDocument json { rootObj };
+ const auto data = cacheToBinary ? json.toBinaryData()
+ : json.toJson(QJsonDocument::Compact);
+#endif
qCDebug(PROFILER) << "DeviceList generated in" << et;
outFile.write(data.data(), data.size());