diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-02-06 13:56:23 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-02-06 13:56:23 +0100 |
commit | ad4ea02547df07538946c9e8ad01a5d8a3106c32 (patch) | |
tree | 5066cebe15b1f7996522c8be1ce328f3962eef79 /resources/qml/Root.qml | |
parent | lint and avoid copy (diff) | |
download | nheko-ad4ea02547df07538946c9e8ad01a5d8a3106c32.tar.xz |
Add a reduced motion option
fixes #1350
Diffstat (limited to 'resources/qml/Root.qml')
-rw-r--r-- | resources/qml/Root.qml | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml index f60ebac1..49e07d38 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml @@ -345,6 +345,63 @@ Pane { anchors.fill: parent initialItem: welcomePage + + Transition { + id: reducedMotionTransitionExit + PropertyAnimation { + property: "opacity" + from: 1 + to:0 + duration: 200 + } + } + Transition { + id: reducedMotionTransitionEnter + SequentialAnimation { + PropertyAction { property: "opacity"; value: 0 } + PauseAnimation { duration: 200 } + PropertyAnimation { + property: "opacity" + from: 0 + to:1 + duration: 200 + } + } + } + + // for some reason direct bindings to a hidden StackView don't work, so manually store and restore here. + property Transition pushEnterOrg + property Transition pushExitOrg + property Transition popEnterOrg + property Transition popExitOrg + property Transition replaceEnterOrg + property Transition replaceExitOrg + Component.onCompleted: { + pushEnterOrg = pushEnter; + popEnterOrg = popEnter; + replaceEnterOrg = replaceEnter; + pushExitOrg = pushExit; + popExitOrg = popExit; + replaceExitOrg = replaceExit; + + updateTrans() + } + + function updateTrans() { + pushEnter = Settings.reducedMotion ? reducedMotionTransitionEnter : pushEnterOrg; + pushExit = Settings.reducedMotion ? reducedMotionTransitionExit : pushExitOrg; + popEnter = Settings.reducedMotion ? reducedMotionTransitionEnter : popEnterOrg; + popExit = Settings.reducedMotion ? reducedMotionTransitionExit : popExitOrg; + replaceEnter = Settings.reducedMotion ? reducedMotionTransitionEnter : replaceEnterOrg; + replaceExit = Settings.reducedMotion ? reducedMotionTransitionExit : replaceExitOrg; + } + + Connections { + target: Settings + function onReducedMotionChanged() { + mainWindow.updateTrans(); + } + } } Component { |