2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Ubuntu.Components 0.1
19import Ubuntu.Gestures 0.1
20import LightDM 0.1 as LightDM
26 created: greeterContentLoader.status == Loader.Ready && greeterContentLoader.item.ready
28 property url defaultBackground
30 // 1 when fully shown and 0 when fully hidden
31 property real showProgress: MathUtils.clamp((width - Math.abs(x)) / width, 0, 1)
33 showAnimation: StandardAnimation { property: "x"; to: 0 }
34 hideAnimation: __leftHideAnimation
36 property alias dragHandleWidth: dragHandle.width
37 property alias model: greeterContentLoader.model
38 property bool locked: shown && !LightDM.Greeter.promptless
40 readonly property bool narrowMode: !multiUser && height > width
41 readonly property bool multiUser: LightDM.Users.count > 1
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 }
48 signal selected(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) && greeter.enabled
74 orientation: Qt.Horizontal
75 propagateComposedEvents: true
77 Component.onCompleted: {
78 // set evaluators to baseline of dragValue == 0
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
115 trackedPosition: dragHandle.dragValue + greeter.x
116 maxDragDistance: parent.width
117 direction: Direction.Leftwards
122 id: greeterContentLoader
123 objectName: "greeterContentLoader"
125 property var model: LightDM.Users
126 property int currentIndex: 0
127 property var infographicModel: LightDM.Infographic
128 readonly property int backgroundTopMargin: -greeter.y
130 source: required ? "GreeterContent.qml" : ""
133 selected(currentIndex);
137 target: greeterContentLoader.item
140 greeter.selected(uid);
141 greeterContentLoader.currentIndex = uid;
143 onUnlocked: greeter.unlocked(uid);
147 onTease: showLabelAnimation.start()
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
168 to: swipeHint.baseOpacity
169 duration: UbuntuAnimation.SleepyDuration
171 PauseAnimation { duration: UbuntuAnimation.BriskDuration }
173 from: swipeHint.baseOpacity
175 duration: UbuntuAnimation.SleepyDuration
182 anchors.left: parent.right
183 anchors.top: parent.top
184 anchors.bottom: parent.bottom
185 visible: parent.required
187 source: "../graphics/dropshadow_right.png"
192 anchors.right: parent.left
193 anchors.top: parent.top
194 anchors.bottom: parent.bottom
195 visible: parent.required
197 source: "../graphics/dropshadow_left.png"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list