diff options
author | Loren Burkholder <computersemiexpert@outlook.com> | 2022-04-12 21:49:21 -0400 |
---|---|---|
committer | Loren Burkholder <computersemiexpert@outlook.com> | 2022-06-29 22:00:09 -0400 |
commit | 2df2046d1dc5d3e4133f89f634efa6a1726a2f30 (patch) | |
tree | e917593bd664b145a8d783f88e99476f693cfb17 /resources/qml | |
parent | Fix bad timestamps being stored for room infos (diff) | |
download | nheko-2df2046d1dc5d3e4133f89f634efa6a1726a2f30.tar.xz |
Display unread notifications for spaces
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/CommunitiesList.qml | 70 | ||||
-rw-r--r-- | resources/qml/RoomList.qml | 3 |
2 files changed, 70 insertions, 3 deletions
diff --git a/resources/qml/CommunitiesList.qml b/resources/qml/CommunitiesList.qml index 61287789..f5f20a91 100644 --- a/resources/qml/CommunitiesList.qml +++ b/resources/qml/CommunitiesList.qml @@ -153,6 +153,42 @@ Page { roomid: model.id displayName: model.displayName color: communityItem.backgroundColor + + Rectangle { + id: collapsedNotificationBubble + + visible: model.unreadMessages > 0 && communitySidebar.collapsed + anchors.right: avatar.right + anchors.bottom: avatar.bottom + anchors.margins: -Nheko.paddingSmall + height: collapsedNotificationBubbleText.height + Nheko.paddingMedium + width: Math.max(collapsedNotificationBubbleText.width, height) + radius: height / 2 + color: /*hasLoudNotification ? Nheko.theme.red :*/ communityItem.bubbleBackground + ToolTip.text: model.unreadMessages + ToolTip.delay: Nheko.tooltipDelay + ToolTip.visible: collapsedNotificationBubbleHover.hovered && (model.unreadMessages > 9999) + + Label { + id: collapsedNotificationBubbleText + + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + width: Math.max(implicitWidth + Nheko.paddingMedium, parent.height) + font.bold: true + font.pixelSize: fontMetrics.font.pixelSize * 0.6 + color: /*hasLoudNotification ? "white" :*/ communityItem.bubbleText + text: model.unreadMessages > 9999 ? "9999+" : model.unreadMessages + + HoverHandler { + id: collapsedNotificationBubbleHover + } + + } + + } + } ElidedLabel { @@ -169,6 +205,40 @@ Page { Layout.fillWidth: true } + Rectangle { + id: notificationBubble + + visible: model.unreadMessages > 0 && !communitySidebar.collapsed + Layout.alignment: Qt.AlignRight + Layout.leftMargin: Nheko.paddingSmall + height: notificationBubbleText.height + Nheko.paddingMedium + Layout.preferredWidth: Math.max(notificationBubbleText.width, height) + radius: height / 2 + color: /*hasLoudNotification ? Nheko.theme.red :*/ communityItem.bubbleBackground + ToolTip.text: model.unreadMessages + ToolTip.delay: Nheko.tooltipDelay + ToolTip.visible: notificationBubbleHover.hovered && (model.unreadMessages > 9999) + + Label { + id: notificationBubbleText + + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + width: Math.max(implicitWidth + Nheko.paddingMedium, parent.height) + font.bold: true + font.pixelSize: fontMetrics.font.pixelSize * 0.8 + color: /*hasLoudNotification ? "white" :*/ communityItem.bubbleText + text: model.unreadMessages > 9999 ? "9999+" : model.unreadMessages + + HoverHandler { + id: notificationBubbleHover + } + + } + + } + } background: Rectangle { diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index f3509f06..910fc252 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -294,9 +294,6 @@ Page { anchors.margins: Nheko.paddingMedium Avatar { - // In the future we could show an online indicator by setting the userid for the avatar - //userid: Nheko.currentUser.userid - id: avatar enabled: false |