+
+QVariantList BufferSyncer::initLastSeenMsg() const
+{
+ QVariantList list;
+ QHash<BufferId, MsgId>::const_iterator iter = _lastSeenMsg.constBegin();
+ while (iter != _lastSeenMsg.constEnd()) {
+ list << QVariant::fromValue<BufferId>(iter.key())
+ << QVariant::fromValue<MsgId>(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<BufferId>(iter.key())
+ << QVariant::fromValue<MsgId>(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<BufferId>(iter.key())
+ << QVariant::fromValue<int>((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>());
+ }
+}
+
+
+Message::Types BufferSyncer::activity(BufferId buffer) const
+{
+ return _bufferActivities.value(buffer, Message::Types());
+}
+
+
+void BufferSyncer::removeBuffer(BufferId buffer)
+{
+ if (_lastSeenMsg.contains(buffer))
+ _lastSeenMsg.remove(buffer);
+ if (_markerLines.contains(buffer))
+ _markerLines.remove(buffer);
+ if (_bufferActivities.contains(buffer))
+ _bufferActivities.remove(buffer);
+ if (_highlightCounts.contains(buffer))
+ _highlightCounts.remove(buffer);
+ SYNC(ARG(buffer))
+ emit bufferRemoved(buffer);