Fix animations with animations disabled

This may sound a bit weird, but we can't just switch off everything, as
in some cases, the animation is not just eye-candy, but carries
important semantics of the UI -- examples are BusyIndicator and
ProgressBar. Behaviour for those is restored.
This commit is contained in:
Sebastian Kügler 2014-02-04 01:32:12 +01:00
parent 86e458cdd0
commit 1d0c41f936
8 changed files with 20 additions and 19 deletions

View File

@ -34,7 +34,7 @@ Units::Units (QObject *parent)
: QObject(parent),
m_gridUnit(-1),
m_devicePixelRatio(-1),
m_longDuration(250)
m_longDuration(0) // default base value for animations
{
m_iconSizes = new QQmlPropertyMap(this);
updateDevicePixelRatio();

View File

@ -55,10 +55,10 @@ PlasmaCore.FrameSvgItem {
onClicked: { textField.copy(); editBubble.state = "collapsed"; }
onPressed: PropertyAnimation { target: copyIcon; properties: "scale";
from: 1.0; to: 0.9;
duration: 175; easing.type: Easing.OutExpo; }
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
onReleased: PropertyAnimation { target: copyIcon; properties: "scale";
from: 0.9; to: 1.0;
duration: 175; easing.type: Easing.OutExpo; }
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
}
}
PlasmaCore.IconItem {
@ -74,10 +74,10 @@ PlasmaCore.FrameSvgItem {
onClicked: { textField.paste(); editBubble.state = "collapsed"; }
onPressed: PropertyAnimation { target: pasteIcon; properties: "scale";
from: 1.0; to: 0.9;
duration: 175; easing.type: Easing.OutExpo; }
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
onReleased: PropertyAnimation { target: pasteIcon; properties: "scale";
from: 0.9; to: 1.0;
duration: 175; easing.type: Easing.OutExpo; }
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
}
}
}
@ -98,15 +98,15 @@ PlasmaCore.FrameSvgItem {
Transition {
from: "collapsed"; to: "expanded"
ParallelAnimation {
PropertyAnimation { properties: "opacity"; duration: 175; easing.type: Easing.InExpo; }
PropertyAnimation { properties: "scale"; duration: 175; easing.type: Easing.InExpo; }
PropertyAnimation { properties: "opacity"; duration: units.shortDuration * 3; easing.type: Easing.InExpo; }
PropertyAnimation { properties: "scale"; duration: units.shortDuration * 3; easing.type: Easing.InExpo; }
}
},
Transition {
from: "expanded"; to: "collapsed"
ParallelAnimation {
PropertyAnimation { properties: "opacity"; duration: 175; easing.type: Easing.OutExpo; }
PropertyAnimation { properties: "scale"; duration: 100; easing.type: Easing.OutExpo; }
PropertyAnimation { properties: "opacity"; duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
PropertyAnimation { properties: "scale"; duration: units.shortDuration * 2; easing.type: Easing.OutExpo; }
}
}
]

View File

@ -50,7 +50,7 @@ Private.DualStateButton {
opacity: checked ? 1 : 0
Behavior on opacity {
PropertyAnimation { duration: 100 }
PropertyAnimation { duration: units.shortDuration * 2 }
}
}
@ -77,7 +77,7 @@ Private.DualStateButton {
width: height
x: checked ? width : 0
Behavior on x {
PropertyAnimation { duration: 100 }
PropertyAnimation { duration: units.shortDuration * 2 }
}
}
}

View File

@ -63,7 +63,7 @@ Item {
from: 0
to: 360
duration: units.longDuration * 6
duration: 1500
running: busy.running
loops: Animation.Infinite
}

View File

@ -29,7 +29,6 @@
* theme.
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "private" as Private
@ -215,8 +214,8 @@ Item {
to: "normal"
// Cross fade from pressed to normal
ParallelAnimation {
NumberAnimation { target: surfaceNormal; property: "opacity"; to: 1; duration: 100 }
NumberAnimation { target: surfacePressed; property: "opacity"; to: 0; duration: 100 }
NumberAnimation { target: surfaceNormal; property: "opacity"; to: 1; duration: units.shortDuration * 2 }
NumberAnimation { target: surfacePressed; property: "opacity"; to: 0; duration: units.shortDuration * 2 }
}
}
]

View File

@ -44,6 +44,8 @@
// navigation model. Pages can be defined as QML items or components.
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "." 2.0 as PlasmaComponents
import "private/PageStack.js" as Engine
@ -81,7 +83,7 @@ Item {
/**
* Should page transitions be animated? Default is true.
*/
property bool animate: true
property bool animate: units.longDuration > 0
/**
* The page to be automatically loaded when this PageStack component gets
@ -264,7 +266,7 @@ Item {
property int stackWidth: Math.max(root.width, root.height)
// Duration of transition animation (in ms)
property int transitionDuration: root.animate ? 150 : 0
property int transitionDuration: root.animate ? units.longAnimation / 2 : 0
// Flag that indicates the container should be cleaned up after the transition has ended.
property bool cleanupAfterTransition: false

View File

@ -157,7 +157,7 @@ Item {
id: contents
// Plasma API
property bool animated: true
property bool animated: units.longDuration > 0
property real handleWidth: contents.isVertical ? grooveSvg.elementSize("vertical-slider-handle").width : grooveSvg.elementSize("horizontal-slider-handle").width
property real handleHeight: contents.isVertical ? grooveSvg.elementSize("vertical-slider-handle").height : grooveSvg.elementSize("horizontal-slider-handle").height

View File

@ -365,7 +365,7 @@ Item {
height: parent.height
color: mouse.containsMouse ? theme.buttonTextColor : theme.textColor
Behavior on color { ColorAnimation { duration: 100 } }
Behavior on color { ColorAnimation { duration: units.shortDuration * 2 } }
elide: Text.ElideRight
horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter