diff options
author | Loren Burkholder <computersemiexpert@outlook.com> | 2022-04-19 23:18:11 -0400 |
---|---|---|
committer | Loren Burkholder <computersemiexpert@outlook.com> | 2022-06-29 22:02:20 -0400 |
commit | 169384f0fa41cc8a52428f27bc3042dc849dd8c9 (patch) | |
tree | 048b76aaeec2760c8edd403821a8cf61f542a729 /resources/qml | |
parent | Fix typoed variable name (diff) | |
download | nheko-169384f0fa41cc8a52428f27bc3042dc849dd8c9.tar.xz |
Add space notifications to room list
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/RoomList.qml | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index 910fc252..126d82be 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -348,7 +348,45 @@ Page { height: avatar.height spacing: Nheko.paddingSmall + Component { + id: notificationBubble + + Rectangle { + visible: notificationCount > 0 + Layout.alignment: Qt.AlignRight + Layout.leftMargin: Nheko.paddingSmall + height: notificationBubbleText.height + Nheko.paddingMedium + width: Math.max(notificationBubbleText.width, height) + radius: height / 2 + color: hasLoudNotification ? Nheko.theme.red : roomItem.bubbleBackground + ToolTip.text: notificationCount + ToolTip.delay: Nheko.tooltipDelay + ToolTip.visible: notificationBubbleHover.hovered && (notificationCount > 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" : roomItem.bubbleText + text: notificationCount > 9999 ? "9999+" : notificationCount + + HoverHandler { + id: notificationBubbleHover + } + + } + + } + } + RowLayout { + id: titleRow + Layout.alignment: Qt.AlignTop Layout.fillWidth: true spacing: Nheko.paddingSmall @@ -374,9 +412,16 @@ Page { text: time } + Loader { + sourceComponent: notificationBubble + active: isSpace + } + } RowLayout { + id: subtextRow + Layout.fillWidth: true spacing: 0 visible: !isSpace @@ -392,40 +437,11 @@ Page { Layout.fillWidth: true } - Rectangle { - id: notificationBubble - - visible: notificationCount > 0 - 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 : roomItem.bubbleBackground - ToolTip.text: notificationCount - ToolTip.delay: Nheko.tooltipDelay - ToolTip.visible: notificationBubbleHover.hovered && (notificationCount > 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" : roomItem.bubbleText - text: notificationCount > 9999 ? "9999+" : notificationCount - - HoverHandler { - id: notificationBubbleHover - } - - } + Loader { + sourceComponent: notificationBubble + active: !isSpace } - } } |