+QVariantList BufferSyncer::initLastMsg() const
+{
+ QVariantList list;
+ QHash<BufferId, MsgId>::const_iterator iter = _lastMsg.constBegin();
+ while (iter != _lastMsg.constEnd()) {
+ list << QVariant::fromValue<BufferId>(iter.key()) << QVariant::fromValue<MsgId>(iter.value());
+ ++iter;
+ }
+ return list;
+}
+
+void BufferSyncer::initSetLastMsg(const QVariantList& list)
+{
+ _lastMsg.clear();
+ Q_ASSERT(list.count() % 2 == 0);
+ for (int i = 0; i < list.count(); i += 2) {
+ setLastMsg(list.at(i).value<BufferId>(), list.at(i + 1).value<MsgId>());
+ }
+}
+
+QVariantList BufferSyncer::initLastSeenMsg() const
+{
+ QVariantList list;
+ QHash<BufferId, MsgId>::const_iterator iter = _lastSeenMsg.constBegin();
+ while (iter != _lastSeenMsg.constEnd()) {
+ list << QVariant::fromValue(iter.key()) << QVariant::fromValue(iter.value());
+ ++iter;
+ }
+ return list;
+}
+
+void BufferSyncer::initSetLastSeenMsg(const QVariantList& list)
+{
+ _lastSeenMsg.clear();
+ Q_ASSERT(list.count() % 2 == 0);
+ for (int i = 0; i < list.count(); i += 2) {
+ setLastSeenMsg(list.at(i).value<BufferId>(), list.at(i + 1).value<MsgId>());
+ }
+}
+
+QVariantList BufferSyncer::initMarkerLines() const
+{
+ QVariantList list;
+ QHash<BufferId, MsgId>::const_iterator iter = _markerLines.constBegin();
+ while (iter != _markerLines.constEnd()) {
+ list << QVariant::fromValue(iter.key()) << QVariant::fromValue(iter.value());
+ ++iter;
+ }
+ return list;
+}
+
+void BufferSyncer::initSetMarkerLines(const QVariantList& list)
+{
+ _markerLines.clear();
+ Q_ASSERT(list.count() % 2 == 0);
+ for (int i = 0; i < list.count(); i += 2) {
+ setMarkerLine(list.at(i).value<BufferId>(), list.at(i + 1).value<MsgId>());
+ }
+}
+
+QVariantList BufferSyncer::initActivities() const
+{
+ QVariantList list;
+ auto iter = _bufferActivities.constBegin();
+ while (iter != _bufferActivities.constEnd()) {
+ list << QVariant::fromValue(iter.key()) << QVariant::fromValue((int)iter.value());
+ ++iter;
+ }
+ return list;
+}
+
+void BufferSyncer::initSetActivities(const QVariantList& list)
+{
+ _bufferActivities.clear();
+ Q_ASSERT(list.count() % 2 == 0);
+ for (int i = 0; i < list.count(); i += 2) {
+ setBufferActivity(list.at(i).value<BufferId>(), list.at(i + 1).value<int>());
+ }