show a close anim

This commit is contained in:
Marco Martin 2020-08-20 15:53:02 +02:00
parent 96420f5080
commit aabcc0949f

View file

@ -56,8 +56,7 @@ PlasmaCore.ColorScope {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.cancelRequested);
root.cancelRequested();
} }
} }
@ -87,13 +86,20 @@ PlasmaCore.ColorScope {
OpacityAnimator { OpacityAnimator {
target: background target: background
from: 0 from: 0
to: 0.5 to: 0.6
duration: units.longDuration duration: units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
ParallelAnimation {
SequentialAnimation {
id: closeAnim id: closeAnim
property var callback
function execute(call) {
callback = call;
closeAnim.restart();
}
ParallelAnimation {
ScaleAnimator { ScaleAnimator {
target: lay target: lay
from: 1 from: 1
@ -110,12 +116,23 @@ PlasmaCore.ColorScope {
} }
OpacityAnimator { OpacityAnimator {
target: background target: background
from: 0.5 from: 0.6
to: 0 to: 0
duration: units.longDuration duration: units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
ScriptAction {
script: {
if (closeAnim.callback) {
closeAnim.callback();
}
lay.opacity = 1;
lay.scale = 1;
background.opacity = 0.6;
}
}
}
GridLayout { GridLayout {
id: lay id: lay
anchors.centerIn: parent anchors.centerIn: parent
@ -128,8 +145,7 @@ PlasmaCore.ColorScope {
iconSource: "system-reboot" iconSource: "system-reboot"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart") text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart")
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.rebootRequested);
root.rebootRequested();
} }
} }
@ -137,8 +153,7 @@ PlasmaCore.ColorScope {
iconSource: "system-shutdown" iconSource: "system-shutdown"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down") text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.haltRequested);
root.haltRequested();
} }
} }
@ -149,8 +164,7 @@ PlasmaCore.ColorScope {
iconSource: "dialog-cancel" iconSource: "dialog-cancel"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel") text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel")
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.cancelRequested);
root.cancelRequested();
} }
} }
} }