@@ -28,10 +28,10 @@ Showable {
28 property url defaultBackground
28 property url defaultBackground
30 // 1 when fully shown and 0 when fully hidden
30 // 1 when fully shown and 0 when fully hidden
31− property real showProgress: MathUtils.clamp((width + x) / width, 0, 1)
31+ property real showProgress: MathUtils.clamp((width - Math.abs(x)) / width, 0, 1)
33 showAnimation: StandardAnimation { property: "x"; to: 0 }
33 showAnimation: StandardAnimation { property: "x"; to: 0 }
34− hideAnimation: StandardAnimation { property: "x"; to: -width }
34+ hideAnimation: __leftHideAnimation
36 property alias dragHandleWidth: dragHandle.width
36 property alias dragHandleWidth: dragHandle.width
37 property alias model: greeterContentLoader.model
37 property alias model: greeterContentLoader.model
@@ -40,19 +40,81 @@ Showable {
40 readonly property bool narrowMode: !multiUser && height > width
40 readonly property bool narrowMode: !multiUser && height > width
41 readonly property bool multiUser: LightDM.Users.count > 1
41 readonly property bool multiUser: LightDM.Users.count > 1
43− readonly property bool leftTeaserPressed: greeterContentLoader.status == Loader.Ready &&
44− greeterContentLoader.item.leftTeaserPressed
45− readonly property bool rightTeaserPressed: greeterContentLoader.status == Loader.Ready &&
46− greeterContentLoader.item.rightTeaserPressed
48 readonly property int currentIndex: greeterContentLoader.currentIndex
43 readonly property int currentIndex: greeterContentLoader.currentIndex
45+ property var __leftHideAnimation: StandardAnimation { property: "x"; to: -width }
46+ property var __rightHideAnimation: StandardAnimation { property: "x"; to: width }
50 signal selected(int uid)
48 signal selected(int uid)
51 signal unlocked(int uid)
49 signal unlocked(int uid)
52+ function hideRight() {
54+ hideAnimation = __rightHideAnimation
60+ // Reset hide animation to default once we're finished with it
62+ // Put back on left for reliable show direction and so that
63+ // if normal hide() is called, we don't animate from right.
65+ hideAnimation = __leftHideAnimation
69+ // Bi-directional revealer
73+ enabled: greeter.narrowMode || !greeter.locked
74+ orientation: Qt.Horizontal
75+ propagateComposedEvents: true
77+ Component.onCompleted: {
78+ // set evaluators to baseline of dragValue == 0
79+ leftEvaluator.reset()
80+ rightEvaluator.reset()
83+ function maybeTease() {
84+ if (!greeter.locked || greeter.narrowMode)
88+ onClicked: maybeTease()
89+ onDragStart: maybeTease()
90+ onPressAndHold: {} // eat event, but no need to tease, as drag will cover it
93+ if (rightEvaluator.shouldAutoComplete())
95+ else if (leftEvaluator.shouldAutoComplete())
98+ greeter.show(); // undo drag
101+ onDragValueChanged: {
102+ // dragValue is kept as a "step" value since we do this x adjusting on the fly
103+ greeter.x += dragValue
108+ trackedPosition: dragHandle.dragValue + greeter.x
109+ maxDragDistance: parent.width
110+ direction: Direction.Rightwards
53− onRightTeaserPressedChanged: {
113+ EdgeDragEvaluator {
54− if (rightTeaserPressed && (!locked || narrowMode) && x == 0) {
114+ id: leftEvaluator
55− teasingTimer.start();
115+ trackedPosition: dragHandle.dragValue + greeter.x
116+ maxDragDistance: parent.width
117+ direction: Direction.Leftwards
@@ -82,45 +144,56 @@ Showable {
85− Timer {
147+ onTease: showLabelAnimation.start()
90− states: [
149+ Label {
91− State {
150+ id: swipeHint
92− name: "teasing"
151+ visible: greeter.shown
152+ property real baseOpacity: 0.5
154+ anchors.horizontalCenter: parent.horizontalCenter
155+ anchors.bottom: parent.bottom
156+ anchors.bottomMargin: units.gu(5)
157+ text: i18n.tr("Swipe to unlock")
159+ font.weight: Font.Light
161+ SequentialAnimation on opacity {
162+ id: showLabelAnimation
93− when: teasingTimer.running
163+ running: false
94− PropertyChanges {
164+ loops: 2
96− x: -dragHandle.hintDisplacement
166+ StandardAnimation {
168+ to: swipeHint.baseOpacity
169+ duration: UbuntuAnimation.SleepyDuration
98− }
171+ PauseAnimation { duration: UbuntuAnimation.BriskDuration }
99− ]
172+ StandardAnimation {
100− transitions: [
173+ from: swipeHint.baseOpacity
104− NumberAnimation {
175+ duration: UbuntuAnimation.SleepyDuration
108− easing.type: Easing.OutCubic
180+ // right side shadow
182+ anchors.left: parent.right
116 anchors.top: parent.top
183 anchors.top: parent.top
117 anchors.bottom: parent.bottom
184 anchors.bottom: parent.bottom
118− anchors.right: parent.right
185+ visible: parent.required
119−
186+ fillMode: Image.Tile
120− hintDisplacement: units.gu(2)
187+ source: "../graphics/dropshadow_right.png"
122− enabled: greeter.narrowMode || !greeter.locked
124− direction: Direction.Leftwards
190+ // left side shadow
192+ anchors.right: parent.left
193+ anchors.top: parent.top
194+ anchors.bottom: parent.bottom
195+ visible: parent.required
196+ fillMode: Image.Tile
197+ source: "../graphics/dropshadow_left.png"