2 * Copyright (C) 2013-2016 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)
39 function hideRight() {
40 d.forceRightOnNextHideAnimation = true;
46 property bool forceRightOnNextHideAnimation: false
49 prepareToHide: function () {
50 hideTranslation.from = root.x + translation.x
51 hideTranslation.to = root.x > 0 || d.forceRightOnNextHideAnimation ? root.width : -root.width;
52 d.forceRightOnNextHideAnimation = false;
55 // We don't directly bind "x" because that's owned by the DragHandle. So
56 // instead, we can get a little extra horizontal push by using transforms.
57 transform: Translate { id: translation; x: root.draggable ? launcherOffset : 0 }
59 // Eat events elsewhere on the coverpage, except mouse clicks which we pass
60 // up (they are used in the NarrowView to hide the cover page)
63 onClicked: root.clicked()
72 // In case background fails to load
80 objectName: "greeterBackground"
83 topMargin: root.backgroundTopMargin
85 fillMode: Image.PreserveAspectCrop
86 // Limit how much memory we'll reserve for this image
87 sourceSize.height: height
88 sourceSize.width: width
91 // Darkens wallpaper so that we can read text on it and see infographic
100 objectName: "infographics"
101 height: parent.height
102 model: root.infographicModel
103 clip: true // clip large data bubbles
106 verticalCenter: parent.verticalCenter
114 property real baseOpacity: 0.5
116 anchors.horizontalCenter: parent.horizontalCenter
117 anchors.bottom: parent.bottom
118 anchors.bottomMargin: units.gu(5)
119 text: "《 " + i18n.tr("Unlock") + " 》"
121 font.weight: Font.Light
123 SequentialAnimation on opacity {
124 id: showLabelAnimation
130 to: swipeHint.baseOpacity
131 duration: UbuntuAnimation.SleepyDuration
133 PauseAnimation { duration: UbuntuAnimation.BriskDuration }
135 from: swipeHint.baseOpacity
137 duration: UbuntuAnimation.SleepyDuration
144 objectName: "coverPageDragHandle"
146 anchors.leftMargin: root.dragHandleLeftMargin
147 enabled: root.draggable
148 direction: Direction.Horizontal
153 showLabelAnimation.start();
160 anchors.left: parent.right
161 anchors.top: parent.top
162 anchors.bottom: parent.bottom
164 source: "../graphics/dropshadow_right.png"
169 anchors.right: parent.left
170 anchors.top: parent.top
171 anchors.bottom: parent.bottom
173 source: "../graphics/dropshadow_left.png"
179 property bool enabled: false
181 if (enabled === __enabled) {
187 value = Qt.binding(function() { return root.width; })
189 value = Qt.binding(function() { return -root.width; })
196 property bool __enabled: false
203 hideAnimation: SequentialAnimation {
205 objectName: "hideAnimation"
206 property var target // unused, here to silence Showable warning
212 PropertyAction { target: root; property: "visible"; value: false }
213 PropertyAction { target: positionLock; property: "enabled"; value: true }
216 showAnimation: SequentialAnimation {
218 objectName: "showAnimation"
219 property var target // unused, here to silence Showable warning
220 PropertyAction { target: root; property: "visible"; value: true }
221 PropertyAction { target: positionLock; property: "enabled"; value: false }
226 duration: UbuntuAnimation.FastDuration