2 * Copyright (C) 2013,2014,2015 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/>.
18 import Ubuntu.Components 1.3
19 import Ubuntu.Gestures 0.1
20 import "../Components"
25 property real dragHandleLeftMargin
26 property real launcherOffset
27 property alias background: greeterBackground.source
28 property real backgroundTopMargin
29 property var infographicModel
30 property bool draggable: true
32 property alias infographics: infographics
34 readonly property real showProgress: MathUtils.clamp((width - Math.abs(x)) / width, 0, 1)
38 function hideRight() {
39 d.forceRightOnNextHideAnimation = true;
45 property bool forceRightOnNextHideAnimation: false
48 prepareToHide: function () {
49 hideTranslation.from = root.x + translation.x
50 hideTranslation.to = root.x > 0 || d.forceRightOnNextHideAnimation ? root.width : -root.width;
51 d.forceRightOnNextHideAnimation = false;
54 // We don't directly bind "x" because that's owned by the DragHandle. So
55 // instead, we can get a little extra horizontal push by using transforms.
56 transform: Translate { id: translation; x: root.draggable ? launcherOffset : 0 }
58 MouseArea { anchors.fill: parent; }
61 // In case background fails to load
69 objectName: "greeterBackground"
72 topMargin: root.backgroundTopMargin
74 fillMode: Image.PreserveAspectCrop
75 // Limit how much memory we'll reserve for this image
76 sourceSize.height: height
77 sourceSize.width: width
88 objectName: "infographics"
90 model: root.infographicModel
91 clip: true // clip large data bubbles
94 verticalCenter: parent.verticalCenter
102 property real baseOpacity: 0.5
104 anchors.horizontalCenter: parent.horizontalCenter
105 anchors.bottom: parent.bottom
106 anchors.bottomMargin: units.gu(5)
107 text: "《 " + i18n.tr("Unlock") + " 》"
109 font.weight: Font.Light
111 SequentialAnimation on opacity {
112 id: showLabelAnimation
118 to: swipeHint.baseOpacity
119 duration: UbuntuAnimation.SleepyDuration
121 PauseAnimation { duration: UbuntuAnimation.BriskDuration }
123 from: swipeHint.baseOpacity
125 duration: UbuntuAnimation.SleepyDuration
132 objectName: "coverPageDragHandle"
134 anchors.leftMargin: root.dragHandleLeftMargin
135 enabled: root.draggable
136 direction: Direction.Horizontal
141 showLabelAnimation.start();
148 anchors.left: parent.right
149 anchors.top: parent.top
150 anchors.bottom: parent.bottom
152 source: "../graphics/dropshadow_right.png"
157 anchors.right: parent.left
158 anchors.top: parent.top
159 anchors.bottom: parent.bottom
161 source: "../graphics/dropshadow_left.png"
167 property bool enabled: false
169 if (enabled === __enabled) {
175 value = Qt.binding(function() { return root.width; })
177 value = Qt.binding(function() { return -root.width; })
184 property bool __enabled: false
191 hideAnimation: SequentialAnimation {
193 objectName: "hideAnimation"
194 property var target // unused, here to silence Showable warning
200 PropertyAction { target: root; property: "visible"; value: false }
201 PropertyAction { target: positionLock; property: "enabled"; value: true }
204 showAnimation: SequentialAnimation {
206 objectName: "showAnimation"
207 property var target // unused, here to silence Showable warning
208 PropertyAction { target: root; property: "visible"; value: true }
209 PropertyAction { target: positionLock; property: "enabled"; value: false }
214 duration: UbuntuAnimation.FastDuration