aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-20 14:52:58 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-20 14:52:58 +0900
commit3bfb1d9736e05fe216c016ae2dbb8eac4ac78048 (patch)
tree5bd9aea085ccd9db0e6a0c2b62b56b6a86f36611 /room.cpp
parent72ff8cf1e77e859de08e343df964f496dc2f9dd8 (diff)
downloadlibquotient-3bfb1d9736e05fe216c016ae2dbb8eac4ac78048.tar.gz
libquotient-3bfb1d9736e05fe216c016ae2dbb8eac4ac78048.zip
Room: store the first displayed event as well; Room::*DisplayedMarker() methods
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/room.cpp b/room.cpp
index 68762a8a..8c6465e2 100644
--- a/room.cpp
+++ b/room.cpp
@@ -91,6 +91,7 @@ class Room::Private
QList<User*> membersLeft;
bool unreadMessages = false;
bool displayed = false;
+ QString firstDisplayedEventId;
QString lastDisplayedEventId;
QHash<const User*, QString> lastReadEventIds;
QString prevBatch;
@@ -436,18 +437,48 @@ void Room::setDisplayed(bool displayed)
}
}
+QString Room::firstDisplayedEventId() const
+{
+ return d->firstDisplayedEventId;
+}
+
+Room::rev_iter_t Room::firstDisplayedMarker() const
+{
+ return findInTimeline(firstDisplayedEventId());
+}
+
+void Room::setFirstDisplayedEventId(const QString& eventId)
+{
+ if (d->firstDisplayedEventId == eventId)
+ return;
+
+ d->firstDisplayedEventId = eventId;
+ emit firstDisplayedEventChanged();
+}
+
+void Room::setFirstDisplayedEvent(TimelineItem::index_t index)
+{
+ Q_ASSERT(isValidIndex(index));
+ setFirstDisplayedEventId(findInTimeline(index)->event()->id());
+}
+
QString Room::lastDisplayedEventId() const
{
return d->lastDisplayedEventId;
}
+Room::rev_iter_t Room::lastDisplayedMarker() const
+{
+ return findInTimeline(lastDisplayedEventId());
+}
+
void Room::setLastDisplayedEventId(const QString& eventId)
{
if (d->lastDisplayedEventId == eventId)
return;
d->lastDisplayedEventId = eventId;
- emit lastDisplayedEventIdChanged();
+ emit lastDisplayedEventChanged();
}
void Room::setLastDisplayedEvent(TimelineItem::index_t index)