@@ -31,7 +31,7 @@ Showable {
31 property real showProgress: MathUtils.clamp((width + x) / width, 0, 1)
31 property real showProgress: MathUtils.clamp((width + 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,75 @@ 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() {
53+ hideAnimation = __rightHideAnimation
58+ target: __rightHideAnimation
59+ // Reset hide animation to default once we're finished with it
60+ onRunningChanged: if (!__rightHideAnimation.running) greeter.hideAnimation = __leftHideAnimation
63+ // Bi-directional revealer
67+ enabled: greeter.narrowMode || !greeter.locked
68+ orientation: Qt.Horizontal
69+ propagateComposedEvents: true
71+ Component.onCompleted: {
72+ // set evaluators to baseline of dragValue == 0
73+ leftEvaluator.reset()
74+ rightEvaluator.reset()
77+ function maybeTease() {
78+ if (!greeter.locked || greeter.narrowMode)
82+ onClicked: maybeTease()
83+ onDragStart: maybeTease()
84+ onPressAndHold: {} // eat event, but no need to tease, as drag will cover it
87+ if (rightEvaluator.shouldAutoComplete())
89+ else if (leftEvaluator.shouldAutoComplete())
92+ greeter.show(); // undo drag
53− onRightTeaserPressedChanged: {
95+ onDragValueChanged: {
54− if (rightTeaserPressed && (!locked || narrowMode) && x == 0) {
96+ // dragValue is kept as a "step" value since we do this x adjusting on the fly
55− teasingTimer.start();
97+ greeter.x += dragValue
102+ trackedPosition: dragHandle.dragValue + greeter.x
103+ maxDragDistance: parent.width
104+ direction: Direction.Rightwards
109+ trackedPosition: dragHandle.dragValue + greeter.x
110+ maxDragDistance: parent.width
111+ direction: Direction.Leftwards
@@ -111,45 +167,54 @@ Showable {
114− Timer {
170+ onTease: showLabelAnimation.start()
119− states: [
172+ Label {
120− State {
173+ id: swipeHint
121− name: "teasing"
174+ visible: greeter.shown
175+ property real baseOpacity: 0.5
177+ anchors.horizontalCenter: parent.horizontalCenter
178+ anchors.bottom: parent.bottom
179+ anchors.bottomMargin: units.gu(5)
180+ text: i18n.tr("Swipe to unlock")
182+ font.weight: Font.Light
184+ SequentialAnimation on opacity {
185+ id: showLabelAnimation
122− when: teasingTimer.running
186+ running: false
123− PropertyChanges {
187+ loops: 2
125− x: -dragHandle.hintDisplacement
189+ StandardAnimation {
191+ to: swipeHint.baseOpacity
192+ duration: UbuntuAnimation.SleepyDuration
127− }
194+ PauseAnimation { duration: UbuntuAnimation.BriskDuration }
128− ]
195+ StandardAnimation {
129− transitions: [
196+ from: swipeHint.baseOpacity
133− NumberAnimation {
198+ duration: UbuntuAnimation.SleepyDuration
137− easing.type: Easing.OutCubic
203+ // right side shadow
205+ anchors.left: parent.right
145 anchors.top: parent.top
206 anchors.top: parent.top
146 anchors.bottom: parent.bottom
207 anchors.bottom: parent.bottom
147− anchors.right: parent.right
208+ fillMode: Image.Tile
148−
209+ source: "../graphics/dropshadow_right.png"
149− hintDisplacement: units.gu(2)
210+ }
151− enabled: greeter.narrowMode || !greeter.locked
153− direction: Direction.Leftwards
212+ // left side shadow
214+ anchors.right: parent.left
215+ anchors.top: parent.top
216+ anchors.bottom: parent.bottom
217+ fillMode: Image.Tile
218+ source: "../graphics/dropshadow_left.png"