qml format

This commit is contained in:
quadbyte 2025-08-10 17:04:51 -04:00
parent 9418d94f6d
commit eda4bc8a6a
4 changed files with 159 additions and 161 deletions

View file

@ -25,17 +25,17 @@ PanelWindow {
WlrLayershell.exclusionMode: ExclusionMode.Ignore
// Use the notification service
property var notificationService: NotificationService { }
property var notificationService: NotificationService {}
// Access the notification model from the service
property ListModel notificationModel: notificationService.notificationModel
// Track notifications being removed for animation
property var removingNotifications: ({})
// Connect to animation signal from service
Component.onCompleted: {
notificationService.animateAndRemove.connect(function(notification, index) {
notificationService.animateAndRemove.connect(function (notification, index) {
// Find the delegate and trigger its animation
if (notificationStack.children && notificationStack.children[index]) {
let delegate = notificationStack.children[index]
@ -46,8 +46,6 @@ PanelWindow {
})
}
// Main notification container
Column {
id: notificationStack
@ -57,8 +55,6 @@ PanelWindow {
width: 360 * scaling
visible: true
// Multiple notifications display
Repeater {
model: notificationModel
@ -70,29 +66,29 @@ PanelWindow {
radius: Style.radiusMedium * scaling
border.color: Colors.backgroundTertiary
border.width: Math.min(1, Style.borderThin * scaling)
// Animation properties
property real scaleValue: 0.8
property real opacityValue: 0.0
property bool isRemoving: false
// Scale and fade-in animation
scale: scaleValue
opacity: opacityValue
// Animate in when the item is created
Component.onCompleted: {
scaleValue = 1.0
opacityValue = 1.0
}
// Animate out when being removed
function animateOut() {
isRemoving = true
scaleValue = 0.8
opacityValue = 0.0
}
// Timer for delayed removal after animation
Timer {
id: removalTimer
@ -102,7 +98,7 @@ PanelWindow {
notificationService.forceRemoveNotification(model.rawNotification)
}
}
// Check if this notification is being removed
onIsRemovingChanged: {
if (isRemoving) {
@ -110,7 +106,7 @@ PanelWindow {
removalTimer.start()
}
}
// Animation behaviors
Behavior on scale {
NumberAnimation {
@ -118,22 +114,20 @@ PanelWindow {
easing.type: Easing.OutBack
}
}
Behavior on opacity {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.OutQuad
}
}
Column {
id: contentColumn
anchors.fill: parent
anchors.margins: Style.marginMedium * scaling
spacing: Style.marginSmall * scaling
RowLayout {
spacing: Style.marginSmall * scaling
NText {
@ -142,19 +136,22 @@ PanelWindow {
font.pointSize: Style.fontSizeSmall
}
Rectangle {
width: 6 * scaling; height: 6 * scaling; radius: 3 * scaling
color: (model.urgency === NotificationUrgency.Critical) ? Colors.error :
(model.urgency === NotificationUrgency.Low) ? Colors.textSecondary : Colors.accentPrimary
width: 6 * scaling
height: 6 * scaling
radius: 3 * scaling
color: (model.urgency === NotificationUrgency.Critical) ? Colors.error : (model.urgency === NotificationUrgency.Low) ? Colors.textSecondary : Colors.accentPrimary
Layout.alignment: Qt.AlignVCenter
}
Item { Layout.fillWidth: true }
Item {
Layout.fillWidth: true
}
NText {
text: notificationService.formatTimestamp(model.timestamp)
color: Colors.textSecondary
font.pointSize: Style.fontSizeSmall
}
}
NText {
text: model.summary || "No summary"
font.pointSize: Style.fontSizeLarge
@ -165,7 +162,7 @@ PanelWindow {
maximumLineCount: 3
elide: Text.ElideRight
}
NText {
text: model.body || ""
font.pointSize: Style.fontSizeSmall
@ -176,13 +173,13 @@ PanelWindow {
elide: Text.ElideRight
}
}
NIconButton {
anchors.top: parent.top
anchors.right: parent.right
anchors.margins: Style.marginSmall * scaling
icon: "close"
onClicked: function() {
onClicked: function () {
animateOut()
}
}