Add space notifications to room list
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
}
-
}
}
|