on eed5bda help sign in
unity8/qml/Tutorial/TutorialLeft.qml
101 lines 2.9 kB history raw
1/*
2 * Copyright (C) 2014,2015 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19import "." as LocalComponents
21TutorialPage {
22 id: root
24 property var launcher
26 title: i18n.tr("Open the launcher")
27 text: i18n.tr("Short swipe from the left edge.")
29 textXOffset: root.launcher.x + root.launcher.visibleWidth
31 Connections {
32 target: root.launcher
34 onStateChanged: {
35 if (root.launcher.state === "visible") {
36 finishTimer.start();
37 }
38 }
40 onDash: {
41 finishTimer.stop();
42 root.showError();
43 root.launcher.hide();
44 }
45 }
47 SequentialAnimation {
48 id: teaseAnimation
49 objectName: "teaseAnimation"
50 paused: running && root.paused
51 running: !slider.active && root.launcher.visibleWidth === 0 && root.shown
52 loops: Animation.Infinite
53 property real bounce: 0
54 readonly property real maxBounce: units.gu(2)
56 UbuntuNumberAnimation {
57 target: teaseAnimation
58 property: "bounce"
59 to: teaseAnimation.maxBounce
60 duration: UbuntuAnimation.SleepyDuration
61 }
62 UbuntuNumberAnimation {
63 target: teaseAnimation
64 property: "bounce"
65 to: 0
66 duration: UbuntuAnimation.SleepyDuration
67 }
68 }
70 Binding {
71 target: root.launcher
72 when: root.shown
73 property: "x"
74 value: Math.min(root.launcher.panelWidth - root.launcher.visibleWidth, teaseAnimation.bounce)
75 }
77 Timer {
78 id: finishTimer
79 interval: 1
80 onTriggered: {
81 root.hide();
82 root.launcher.x = 0; // make sure to reset launcher before we go
83 }
84 }
86 foreground {
87 children: [
88 LocalComponents.Slider {
89 id: slider
90 anchors {
91 left: parent.left
92 top: parent.top
93 topMargin: root.textBottom + units.gu(3)
94 }
95 offset: root.launcher.x + root.launcher.visibleWidth + root.launcher.progress
96 active: root.launcher.dragging
97 shortSwipe: true
98 }
99 ]
100 }