aboutsummaryrefslogtreecommitdiff
path: root/lib/syncdata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syncdata.cpp')
-rw-r--r--lib/syncdata.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp
index 396e77eb..9c54888c 100644
--- a/lib/syncdata.cpp
+++ b/lib/syncdata.cpp
@@ -99,6 +99,34 @@ SyncRoomData::SyncRoomData(QString roomId_, JoinState joinState,
fromJson(unreadJson.value(HighlightCountKey), highlightCount);
}
+QDebug Quotient::operator<<(QDebug dbg, const DevicesList& devicesList)
+{
+ QDebugStateSaver _(dbg);
+ QStringList sl;
+ if (!devicesList.changed.isEmpty())
+ sl << QStringLiteral("changed: %1").arg(devicesList.changed.join(", "));
+ if (!devicesList.left.isEmpty())
+ sl << QStringLiteral("left %1").arg(devicesList.left.join(", "));
+ dbg.nospace().noquote() << sl.join(QStringLiteral("; "));
+ return dbg;
+}
+
+void JsonObjectConverter<DevicesList>::dumpTo(QJsonObject& jo,
+ const DevicesList& rs)
+{
+ addParam<IfNotEmpty>(jo, QStringLiteral("changed"),
+ rs.changed);
+ addParam<IfNotEmpty>(jo, QStringLiteral("left"),
+ rs.left);
+}
+
+void JsonObjectConverter<DevicesList>::fillFrom(const QJsonObject& jo,
+ DevicesList& rs)
+{
+ fromJson(jo["changed"_ls], rs.changed);
+ fromJson(jo["left"_ls], rs.left);
+}
+
SyncData::SyncData(const QString& cacheFileName)
{
QFileInfo cacheFileInfo { cacheFileName };
@@ -133,6 +161,8 @@ std::pair<int, int> SyncData::cacheVersion()
return { MajorCacheVersion, 2 };
}
+DevicesList&& SyncData::takeDevicesList() { return std::move(devicesList); }
+
QJsonObject SyncData::loadJson(const QString& fileName)
{
QFile roomFile { fileName };