aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-09 20:04:45 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-09 20:04:45 +0900
commit9b3e437f3268e251f1950000b210cf849d49c24e (patch)
tree3382080db7554796b0cf2aa471a56de048fcd777
parent9225eaec426ecd44a1c203e11e1aafe7772c46d7 (diff)
downloadlibquotient-9b3e437f3268e251f1950000b210cf849d49c24e.tar.gz
libquotient-9b3e437f3268e251f1950000b210cf849d49c24e.zip
Room: defer memberListChanged(); track room summary changes
This concludes beta-version of lazy-loading support in libQMatrixClient (#253).
-rw-r--r--lib/room.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index ca5495ea..84072d3e 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -282,9 +282,6 @@ Room::Room(Connection* connection, QString id, JoinState initialJoinState)
// See "Accessing the Public Class" section in
// https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl-%E2%80%94-reloaded/
d->q = this;
- connect(this, &Room::userAdded, this, &Room::memberListChanged);
- connect(this, &Room::userRemoved, this, &Room::memberListChanged);
- connect(this, &Room::memberRenamed, this, &Room::memberListChanged);
qCDebug(MAIN) << "New" << toCString(initialJoinState) << "Room:" << id;
}
@@ -1018,12 +1015,9 @@ Room::Changes Room::Private::setSummary(RoomSummary&& newSummary)
{
if (!summary.merge(newSummary))
return Change::NoChange;
- summary = move(newSummary);
- qCDebug(MAIN).nospace()
- << "Updated room summary for" << q->objectName()
- << ": joined " << summary.joinedMemberCount
- << ", invited " << summary.invitedMemberCount
- << ", heroes: " << summary.heroes.value().join(',');
+ qCDebug(MAIN).nospace().noquote()
+ << "Updated room summary for " << q->objectName() << ": " << summary;
+ emit q->memberListChanged();
return Change::SummaryChange;
}
@@ -1194,7 +1188,10 @@ void Room::updateData(SyncRoomData&& data, bool fromCache)
if (roomChanges&NameChange)
emit namesChanged(this);
- d->setSummary(move(data.summary));
+ if (roomChanges&MembersChange)
+ emit memberListChanged();
+
+ roomChanges |= d->setSummary(move(data.summary));
d->updateDisplayname();
for( auto&& ephemeralEvent: data.ephemeral )