Working public room directory.

Fix "no known servers".
Rename all QMatrixClient to Quotient.
This commit is contained in:
Black Hat
2019-12-25 19:53:50 +08:00
parent 9d2dc3e96a
commit d25a9fb3a4
14 changed files with 297 additions and 161 deletions

View File

@@ -167,6 +167,24 @@ QVariant PublicRoomListModel::data(const QModelIndex& index, int role) const {
if (role == TopicRole) {
return room.topic;
}
if (role == RoomIDRole) {
return room.roomId;
}
if (role == MemberCountRole) {
return room.numJoinedMembers;
}
if (role == AllowGuestsRole) {
return room.guestCanJoin;
}
if (role == WorldReadableRole) {
return room.worldReadable;
}
if (role == IsJoinedRole) {
if (!m_connection)
return {};
return m_connection->room(room.roomId, JoinState::Join) != nullptr;
}
return {};
}
@@ -177,6 +195,11 @@ QHash<int, QByteArray> PublicRoomListModel::roleNames() const {
roles[NameRole] = "name";
roles[AvatarRole] = "avatar";
roles[TopicRole] = "topic";
roles[RoomIDRole] = "roomID";
roles[MemberCountRole] = "memberCount";
roles[AllowGuestsRole] = "allowGuests";
roles[WorldReadableRole] = "worldReadable";
roles[IsJoinedRole] = "isJoined";
return roles;
}