waffles: notif center: calendar header and focus

This commit is contained in:
end-4
2025-11-24 10:18:05 +01:00
parent 449d6fc285
commit e6f36114bd
29 changed files with 420 additions and 59 deletions
@@ -1,3 +1,4 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
@@ -10,11 +11,13 @@ import qs.modules.waffle.looks
Item {
id: root
signal closed()
signal closed
required property Item contentItem
property real visualMargin: 12
property int closeAnimDuration: 150
property bool revealFromSides: false
property bool revealFromLeft: true
function close() {
closeAnim.start();
@@ -25,16 +28,25 @@ Item {
implicitHeight: contentItem.implicitHeight + visualMargin * 2
implicitWidth: contentItem.implicitWidth + visualMargin * 2
focus: true
Keys.onPressed: event => { // Esc to close
if (event.key === Qt.Key_Escape) {
content.close();
}
}
Item {
id: panelContent
anchors {
left: parent.left
right: parent.right
top: root.barAtBottom ? undefined : parent.top
bottom: root.barAtBottom ? parent.bottom : undefined
left: (root.revealFromSides && !root.revealFromLeft) ? undefined : parent.left
right: (root.revealFromSides && root.revealFromLeft) ? undefined : parent.right
top: (!root.revealFromSides && root.barAtBottom) ? undefined : parent.top
bottom: (!root.revealFromSides && !root.barAtBottom) ? undefined : parent.bottom
// Opening anim
bottomMargin: root.barAtBottom ? sourceEdgeMargin : root.visualMargin
topMargin: root.barAtBottom ? root.visualMargin : sourceEdgeMargin
bottomMargin: (!root.revealFromSides && root.barAtBottom) ? sourceEdgeMargin : root.visualMargin
topMargin: (!root.revealFromSides && !root.barAtBottom) ? sourceEdgeMargin : root.visualMargin
leftMargin: (root.revealFromSides && root.revealFromLeft) ? sideEdgeMargin : root.visualMargin
rightMargin: (root.revealFromSides && !root.revealFromLeft) ? sideEdgeMargin : root.visualMargin
}
Component.onCompleted: {
@@ -42,24 +54,22 @@ Item {
}
property real sourceEdgeMargin: -(implicitHeight + root.visualMargin)
PropertyAnimation {
property real sideEdgeMargin: -(implicitWidth + root.visualMargin)
OpenAnim {
id: openAnim
target: panelContent
property: "sourceEdgeMargin"
to: root.visualMargin
duration: 200
easing.type: Easing.BezierSpline
easing.bezierCurve: Looks.transition.easing.bezierCurve.easeIn
properties: "sourceEdgeMargin, sideEdgeMargin"
}
SequentialAnimation {
id: closeAnim
PropertyAnimation {
target: panelContent
property: "sourceEdgeMargin"
to: -(implicitHeight + root.visualMargin)
duration: root.closeAnimDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Looks.transition.easing.bezierCurve.easeOut
ParallelAnimation {
CloseAnim {
property: "sourceEdgeMargin"
to: -(implicitHeight + root.visualMargin)
}
CloseAnim {
property: "sideEdgeMargin"
to: -(implicitWidth + root.visualMargin)
}
}
ScriptAction {
script: {
@@ -70,5 +80,19 @@ Item {
implicitWidth: root.contentItem.implicitWidth
implicitHeight: root.contentItem.implicitHeight
children: [root.contentItem]
}
}
component OpenAnim: PropertyAnimation {
target: panelContent
to: root.visualMargin
duration: 200
easing.type: Easing.BezierSpline
easing.bezierCurve: Looks.transition.easing.bezierCurve.easeIn
}
component CloseAnim: PropertyAnimation {
target: panelContent
duration: root.closeAnimDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Looks.transition.easing.bezierCurve.easeOut
}
}