Explore rooms page RoundedItemDelegate
Move the explore rooms page to using the new RoundedItemDelegate
This commit is contained in:
@@ -171,7 +171,7 @@ QVariant PublicRoomListModel::data(const QModelIndex &index, int role) const
|
||||
return {};
|
||||
}
|
||||
auto room = rooms.at(index.row());
|
||||
if (role == NameRole) {
|
||||
if (role == DisplayNameRole) {
|
||||
auto displayName = room.name;
|
||||
if (!displayName.isEmpty()) {
|
||||
return displayName;
|
||||
@@ -188,18 +188,17 @@ QVariant PublicRoomListModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
return room.roomId;
|
||||
}
|
||||
if (role == AvatarRole) {
|
||||
if (role == AvatarUrlRole) {
|
||||
auto avatarUrl = room.avatarUrl;
|
||||
|
||||
if (avatarUrl.isEmpty()) {
|
||||
return {};
|
||||
if (avatarUrl.isEmpty() || !m_connection) {
|
||||
return QUrl();
|
||||
}
|
||||
return avatarUrl.url().remove(0, 6);
|
||||
return m_connection->makeMediaUrl(avatarUrl);
|
||||
}
|
||||
if (role == TopicRole) {
|
||||
return room.topic;
|
||||
}
|
||||
if (role == RoomIDRole) {
|
||||
if (role == RoomIdRole) {
|
||||
return room.roomId;
|
||||
}
|
||||
if (role == AliasRole) {
|
||||
@@ -232,10 +231,10 @@ QHash<int, QByteArray> PublicRoomListModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles;
|
||||
|
||||
roles[NameRole] = "name";
|
||||
roles[AvatarRole] = "avatar";
|
||||
roles[DisplayNameRole] = "displayName";
|
||||
roles[AvatarUrlRole] = "avatarUrl";
|
||||
roles[TopicRole] = "topic";
|
||||
roles[RoomIDRole] = "roomID";
|
||||
roles[RoomIdRole] = "roomId";
|
||||
roles[MemberCountRole] = "memberCount";
|
||||
roles[AllowGuestsRole] = "allowGuests";
|
||||
roles[WorldReadableRole] = "worldReadable";
|
||||
|
||||
@@ -58,10 +58,10 @@ public:
|
||||
* @brief Defines the model roles.
|
||||
*/
|
||||
enum EventRoles {
|
||||
NameRole = Qt::DisplayRole + 1, /**< The name of the room. */
|
||||
AvatarRole, /**< The source URL for the room's avatar. */
|
||||
DisplayNameRole = Qt::DisplayRole + 1, /**< The name of the room. */
|
||||
AvatarUrlRole, /**< The source URL for the room's avatar. */
|
||||
TopicRole, /**< The room topic. */
|
||||
RoomIDRole, /**< The room matrix ID. */
|
||||
RoomIdRole, /**< The room matrix ID. */
|
||||
AliasRole, /**< The room canonical alias. */
|
||||
MemberCountRole, /**< The number of members in the room. */
|
||||
AllowGuestsRole, /**< Whether the room allows guest users. */
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
*
|
||||
* @sa QAbstractItemModel::data
|
||||
*/
|
||||
[[nodiscard]] QVariant data(const QModelIndex &index, int role = NameRole) const override;
|
||||
[[nodiscard]] QVariant data(const QModelIndex &index, int role = DisplayNameRole) const override;
|
||||
|
||||
/**
|
||||
* @brief Number of rows in the model.
|
||||
|
||||
Reference in New Issue
Block a user