mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-05-25 15:42:02 +00:00
NotificationService: respect 0s timeout (never disappear, fixes #419)
Autoformat
This commit is contained in:
@@ -12,7 +12,6 @@ Item {
|
||||
property string section: widgetProps && widgetProps.section || ""
|
||||
property int sectionIndex: widgetProps && widgetProps.sectionWidgetIndex || 0
|
||||
|
||||
|
||||
// Don't reserve space unless the loaded widget is really visible
|
||||
implicitWidth: getImplicitSize(loader.item, "implicitWidth")
|
||||
implicitHeight: getImplicitSize(loader.item, "implicitHeight")
|
||||
@@ -28,7 +27,7 @@ Item {
|
||||
}
|
||||
|
||||
function getImplicitSize(item, prop) {
|
||||
return (item && item.visible) ? item[prop] : 0
|
||||
return (item && item.visible) ? item[prop] : 0
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
||||
@@ -353,4 +353,4 @@ NBox {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,10 +83,22 @@ Loader {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, 0.6) }
|
||||
GradientStop { position: 0.3; color: Qt.rgba(0, 0, 0, 0.3) }
|
||||
GradientStop { position: 0.7; color: Qt.rgba(0, 0, 0, 0.4) }
|
||||
GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.7) }
|
||||
GradientStop {
|
||||
position: 0.0
|
||||
color: Qt.rgba(0, 0, 0, 0.6)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.3
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.7
|
||||
color: Qt.rgba(0, 0, 0, 0.4)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1.0
|
||||
color: Qt.rgba(0, 0, 0, 0.7)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +124,16 @@ Loader {
|
||||
|
||||
SequentialAnimation on opacity {
|
||||
loops: Animation.Infinite
|
||||
NumberAnimation { to: 0.7; duration: 3000; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation { to: 0.95; duration: 3000; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation {
|
||||
to: 0.7
|
||||
duration: 3000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
NumberAnimation {
|
||||
to: 0.95
|
||||
duration: 3000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,18 +161,26 @@ Loader {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
radius: width * 0.5
|
||||
color: Color.transparent
|
||||
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: parent.radius
|
||||
color: Color.transparent
|
||||
border.color: Qt.alpha(Color.mPrimary, 0.8)
|
||||
border.width: 3
|
||||
|
||||
|
||||
SequentialAnimation on border.color {
|
||||
loops: Animation.Infinite
|
||||
ColorAnimation { to: Qt.alpha(Color.mPrimary, 1.0); duration: 2000; easing.type: Easing.InOutQuad }
|
||||
ColorAnimation { to: Qt.alpha(Color.mPrimary, 0.8); duration: 2000; easing.type: Easing.InOutQuad }
|
||||
ColorAnimation {
|
||||
to: Qt.alpha(Color.mPrimary, 1.0)
|
||||
duration: 2000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
ColorAnimation {
|
||||
to: Qt.alpha(Color.mPrimary, 0.8)
|
||||
duration: 2000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,11 +190,19 @@ Loader {
|
||||
height: 120 * scaling
|
||||
imagePath: Settings.data.general.avatarImage
|
||||
fallbackIcon: "person"
|
||||
|
||||
|
||||
SequentialAnimation on scale {
|
||||
loops: Animation.Infinite
|
||||
NumberAnimation { to: 1.02; duration: 4000; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation { to: 1.0; duration: 4000; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation {
|
||||
to: 1.02
|
||||
duration: 4000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
NumberAnimation {
|
||||
to: 1.0
|
||||
duration: 4000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -469,7 +505,9 @@ Loader {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
|
||||
Item { Layout.preferredWidth: Style.marginM * scaling }
|
||||
Item {
|
||||
Layout.preferredWidth: Style.marginM * scaling
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
@@ -553,11 +591,16 @@ Loader {
|
||||
}
|
||||
|
||||
Behavior on border.color {
|
||||
ColorAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item { Layout.preferredWidth: Style.marginM * scaling }
|
||||
Item {
|
||||
Layout.preferredWidth: Style.marginM * scaling
|
||||
}
|
||||
}
|
||||
|
||||
// System control buttons
|
||||
@@ -602,7 +645,10 @@ Loader {
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,7 +684,10 @@ Loader {
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,11 +725,17 @@ Loader {
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on border.color {
|
||||
ColorAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,12 +768,23 @@ Loader {
|
||||
SequentialAnimation on opacity {
|
||||
running: lockContext.unlockInProgress
|
||||
loops: Animation.Infinite
|
||||
NumberAnimation { to: 0.6; duration: 1000; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation { to: 1.0; duration: 1000; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation {
|
||||
to: 0.6
|
||||
duration: 1000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
NumberAnimation {
|
||||
to: 1.0
|
||||
duration: 1000
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 300; easing.type: Easing.OutCubic }
|
||||
NumberAnimation {
|
||||
duration: 300
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -726,4 +792,4 @@ Loader {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,18 +189,29 @@ Singleton {
|
||||
const elapsed = now - notif.timestamp.getTime()
|
||||
var expire = 0
|
||||
|
||||
if (Settings.data.notifications?.respectExpireTimeout)
|
||||
expire = notif.expireTimeout > 0 ? notif.expireTimeout : durations[notif.urgency]
|
||||
else
|
||||
expire = durations[notif.urgency]
|
||||
if (Settings.data.notifications?.respectExpireTimeout) {
|
||||
if (notif.expireTimeout === 0) {
|
||||
// Timeout of 0 means never expire (infinite)
|
||||
continue
|
||||
} else if (notif.expireTimeout > 0) {
|
||||
expire = notif.expireTimeout
|
||||
} else {
|
||||
expire = durations[notif.urgency]
|
||||
}
|
||||
} else {
|
||||
expire = durations[notif.urgency]
|
||||
}
|
||||
|
||||
const progress = Math.max(1.0 - (elapsed / expire), 0.0)
|
||||
updateModel(activeList, notif.id, "progress", progress)
|
||||
// Only update progress and check expiration for notifications with finite timeout
|
||||
if (expire > 0) {
|
||||
const progress = Math.max(1.0 - (elapsed / expire), 0.0)
|
||||
updateModel(activeList, notif.id, "progress", progress)
|
||||
|
||||
if (elapsed >= expire) {
|
||||
animateAndRemove(notif.id)
|
||||
delete progressTimers[notif.id]
|
||||
break
|
||||
if (elapsed >= expire) {
|
||||
animateAndRemove(notif.id)
|
||||
delete progressTimers[notif.id]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user