diff --git a/qml/form/RoomListForm.qml b/qml/form/RoomListForm.qml index 7f89764..754a4e9 100644 --- a/qml/form/RoomListForm.qml +++ b/qml/form/RoomListForm.qml @@ -37,7 +37,7 @@ Item { bottomPadding: 0 anchors.verticalCenter: parent.verticalCenter - background: Item { + background: Item { Row { anchors.fill: parent @@ -142,6 +142,13 @@ Item { ToolTip.visible: mini && hovered ToolTip.text: name + Rectangle { + width: 4 + height: parent.height + color: Qt.tint(Material.accent, "#20FFFFFF") + visible: unreadCount > 0 + } + contentItem: RowLayout { anchors.fill: parent anchors.margins: 16 diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp index b6eeb30..8b65951 100644 --- a/src/roomlistmodel.cpp +++ b/src/roomlistmodel.cpp @@ -159,6 +159,9 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const { if (room->highlightCount() > 0) return QBrush(QColor("orange")); return QVariant(); } + if (role == UnreadCountRole) { + return room->unreadCount(); + } return QVariant(); } @@ -189,5 +192,6 @@ QHash RoomListModel::roleNames() const { roles[TopicRole] = "topic"; roles[CategoryRole] = "category"; roles[HighlightRole] = "highlight"; + roles[UnreadCountRole] = "unreadCount"; return roles; } diff --git a/src/roomlistmodel.h b/src/roomlistmodel.h index e5ee63b..5f619fa 100644 --- a/src/roomlistmodel.h +++ b/src/roomlistmodel.h @@ -18,6 +18,7 @@ class RoomListModel : public QAbstractListModel { TopicRole, CategoryRole, HighlightRole, + UnreadCountRole, }; RoomListModel(QObject* parent = 0);