on daa5708 help sign in
unity8/qml/Tutorial/TutorialLeft.qml
91 lines 2.5 kB history raw
1/*
2 * Copyright (C) 2014 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.3
18import Ubuntu.Components 1.1
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 paused: running && root.paused
50 running: !slider.active && root.launcher.visibleWidth === 0 && root.shown
51 loops: Animation.Infinite
53 UbuntuNumberAnimation {
54 target: root.launcher
55 property: "x"
56 to: units.gu(2)
57 duration: UbuntuAnimation.SleepyDuration
58 }
59 UbuntuNumberAnimation {
60 target: root.launcher
61 property: "x"
62 to: 0
63 duration: UbuntuAnimation.SleepyDuration
64 }
65 }
67 Timer {
68 id: finishTimer
69 interval: 1
70 onTriggered: {
71 root.hide();
72 root.launcher.x = 0; // make sure to reset launcher before we go
73 }
74 }
76 foreground {
77 children: [
78 LocalComponents.Slider {
79 id: slider
80 anchors {
81 left: parent.left
82 top: parent.top
83 topMargin: root.textBottom + units.gu(3)
84 }
85 offset: root.launcher.x + root.launcher.visibleWidth + root.launcher.progress
86 active: root.launcher.dragging
87 shortSwipe: true
88 }
89 ]
90 }