Add space notifs to room list
This commit is contained in:
parent
8ec0577807
commit
c2b6728955
@ -3,6 +3,7 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import "./components"
|
||||||
import "./dialogs"
|
import "./dialogs"
|
||||||
import "./ui"
|
import "./ui"
|
||||||
import Qt.labs.platform 1.1 as Platform
|
import Qt.labs.platform 1.1 as Platform
|
||||||
@ -305,33 +306,17 @@ Page {
|
|||||||
userid: isDirect ? directChatOtherUserId : ""
|
userid: isDirect ? directChatOtherUserId : ""
|
||||||
roomid: roomId
|
roomid: roomId
|
||||||
|
|
||||||
Rectangle {
|
NotificationBubble {
|
||||||
id: collapsedNotificationBubble
|
id: collapsedNotificationBubble
|
||||||
|
|
||||||
|
notificationCount: roomItem.notificationCount
|
||||||
|
hasLoudNotification: roomItem.hasLoudNotification
|
||||||
|
bubbleBackgroundColor: roomItem.bubbleBackground
|
||||||
|
bubbleTextColor: roomItem.bubbleText
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.margins: -Nheko.paddingSmall
|
anchors.margins: -Nheko.paddingSmall
|
||||||
visible: collapsed && notificationCount > 0
|
mayBeVisible: collapsed
|
||||||
enabled: false
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
height: fontMetrics.averageCharacterWidth * 3
|
|
||||||
width: Math.max(collapsedBubbleText.width, height)
|
|
||||||
radius: height / 2
|
|
||||||
color: hasLoudNotification ? Nheko.theme.red : roomItem.bubbleBackground
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: collapsedBubbleText
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -348,40 +333,19 @@ Page {
|
|||||||
height: avatar.height
|
height: avatar.height
|
||||||
spacing: Nheko.paddingSmall
|
spacing: Nheko.paddingSmall
|
||||||
|
|
||||||
Component {
|
NotificationBubble {
|
||||||
id: notificationBubble
|
id: notificationBubble
|
||||||
|
|
||||||
Rectangle {
|
parent: isSpace ? titleRow : subtextRow
|
||||||
visible: notificationCount > 0
|
notificationCount: roomItem.notificationCount
|
||||||
Layout.alignment: Qt.AlignRight
|
hasLoudNotification: roomItem.hasLoudNotification
|
||||||
Layout.leftMargin: Nheko.paddingSmall
|
bubbleBackgroundColor: roomItem.bubbleBackground
|
||||||
height: notificationBubbleText.height + Nheko.paddingMedium
|
bubbleTextColor: roomItem.bubbleText
|
||||||
width: Math.max(notificationBubbleText.width, height)
|
Layout.alignment: Qt.AlignRight
|
||||||
radius: height / 2
|
Layout.leftMargin: Nheko.paddingSmall
|
||||||
color: hasLoudNotification ? Nheko.theme.red : roomItem.bubbleBackground
|
Layout.preferredWidth: implicitWidth
|
||||||
ToolTip.text: notificationCount
|
Layout.preferredHeight: implicitHeight
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
mayBeVisible: !collapsed
|
||||||
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 {
|
RowLayout {
|
||||||
@ -412,11 +376,6 @@ Page {
|
|||||||
text: time
|
text: time
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
|
||||||
sourceComponent: notificationBubble
|
|
||||||
active: isSpace
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@ -437,11 +396,6 @@ Page {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
sourceComponent: notificationBubble
|
|
||||||
active: !isSpace
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user