mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +00:00
look-and-feel/logout: Cleanup and fixup animations
This commit is contained in:
parent
146bccc57f
commit
5be3445187
2 changed files with 56 additions and 37 deletions
|
|
@ -19,7 +19,6 @@ Item {
|
||||||
property alias labelRendering: label.renderType
|
property alias labelRendering: label.renderType
|
||||||
property alias circleOpacity: buttonRect.opacity
|
property alias circleOpacity: buttonRect.opacity
|
||||||
property alias circleVisiblity: buttonRect.visible
|
property alias circleVisiblity: buttonRect.visible
|
||||||
property int fontSize: config.fontSize
|
|
||||||
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
|
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
|
||||||
|
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
@ -59,7 +58,7 @@ Item {
|
||||||
|
|
||||||
PlasmaComponents3.Label {
|
PlasmaComponents3.Label {
|
||||||
id: label
|
id: label
|
||||||
font.pointSize: Math.max(fontSize + 1,PlasmaCore.Theme.defaultFont.pointSize + 1)
|
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
|
||||||
anchors {
|
anchors {
|
||||||
centerIn: buttonRect
|
centerIn: buttonRect
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,14 @@ PlasmaCore.ColorScope {
|
||||||
shortcut: "Escape"
|
shortcut: "Escape"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: blackOverlay
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "black"
|
||||||
|
opacity: 0
|
||||||
|
z: opacity > 0 ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: background
|
id: background
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -58,7 +66,7 @@ PlasmaCore.ColorScope {
|
||||||
id: openAnim
|
id: openAnim
|
||||||
running: true
|
running: true
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
target: lay
|
target: buttons
|
||||||
from: 0
|
from: 0
|
||||||
to: 1
|
to: 1
|
||||||
duration: PlasmaCore.Units.longDuration
|
duration: PlasmaCore.Units.longDuration
|
||||||
|
|
@ -77,6 +85,7 @@ PlasmaCore.ColorScope {
|
||||||
id: closeAnim
|
id: closeAnim
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
|
property bool closeToBlack: false
|
||||||
property var callback
|
property var callback
|
||||||
function execute(call) {
|
function execute(call) {
|
||||||
callback = call;
|
callback = call;
|
||||||
|
|
@ -84,7 +93,7 @@ PlasmaCore.ColorScope {
|
||||||
}
|
}
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
target: lay
|
target: buttons
|
||||||
from: 1
|
from: 1
|
||||||
to: 0
|
to: 0
|
||||||
duration: PlasmaCore.Units.longDuration
|
duration: PlasmaCore.Units.longDuration
|
||||||
|
|
@ -97,32 +106,39 @@ PlasmaCore.ColorScope {
|
||||||
duration: PlasmaCore.Units.longDuration
|
duration: PlasmaCore.Units.longDuration
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
}
|
}
|
||||||
|
OpacityAnimator {
|
||||||
|
target: blackOverlay
|
||||||
|
from: 0
|
||||||
|
to: closeAnim.closeToBlack ? 1 : 0
|
||||||
|
duration: PlasmaCore.Units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ScriptAction {
|
ScriptAction {
|
||||||
script: {
|
script: {
|
||||||
if (closeAnim.callback) {
|
if (closeAnim.callback) {
|
||||||
closeAnim.callback();
|
closeAnim.callback();
|
||||||
}
|
}
|
||||||
lay.opacity = 1;
|
buttons.opacity = 1;
|
||||||
lay.scale = 1;
|
|
||||||
background.opacity = 0.6;
|
background.opacity = 0.6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
|
||||||
id: lay
|
|
||||||
anchors {
|
|
||||||
//top: root.top
|
|
||||||
//horizontalCenter: root.horizontalCenter
|
|
||||||
centerIn: root
|
|
||||||
}
|
|
||||||
|
|
||||||
spacing: PlasmaCore.Units.gridUnit
|
Item {
|
||||||
|
id: buttons
|
||||||
|
anchors.fill: parent
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: PlasmaCore.Units.gridUnit
|
||||||
|
|
||||||
ActionButton {
|
ActionButton {
|
||||||
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.closeToBlack = true;
|
||||||
closeAnim.execute(root.rebootRequested);
|
closeAnim.execute(root.rebootRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -131,6 +147,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.closeToBlack = true;
|
||||||
closeAnim.execute(root.haltRequested);
|
closeAnim.execute(root.haltRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -139,21 +156,24 @@ PlasmaCore.ColorScope {
|
||||||
iconSource: "system-log-out"
|
iconSource: "system-log-out"
|
||||||
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log Out")
|
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log Out")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
closeAnim.closeToBlack = true;
|
||||||
closeAnim.execute(root.logoutRequested);
|
closeAnim.execute(root.logoutRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionButton {
|
ActionButton {
|
||||||
anchors {
|
anchors {
|
||||||
bottom: root.bottom
|
bottom: parent.bottom
|
||||||
bottomMargin: PlasmaCore.Units.largeSpacing
|
bottomMargin: PlasmaCore.Units.largeSpacing
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
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.closeToBlack = false;
|
||||||
closeAnim.execute(root.cancelRequested);
|
closeAnim.execute(root.cancelRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue