on 5578813 help sign in
unity8/qml/Tutorial/TutorialPage.qml
112 lines 2.8 kB history raw
1/*
2 * Copyright (C) 2013,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.4
18import Ubuntu.Components 1.3
19import "../Components"
21Showable {
22 id: root
24 property alias arrow: arrow
25 property alias label: label
26 property alias background: background
27 property alias mouseArea: mouseArea
28 property real opacityOverride: 1
29 property bool paused
30 property bool isReady
32 signal finished()
34 ////
36 QtObject {
37 id: d
38 property bool showOnUnpause
39 }
41 visible: false
42 shown: false
44 opacity: Math.max(Math.min(_showOpacity, opacityOverride), 0)
45 onOpacityOverrideChanged: if (opacityOverride <= 0) hide()
46 property real _showOpacity: 0
48 onPausedChanged: {
49 if (paused && shown) {
50 hide();
51 } else if (!paused && d.showOnUnpause) {
52 d.showOnUnpause = false;
53 if (isReady) {
54 show();
55 }
56 }
57 }
59 showAnimation: StandardAnimation {
60 property: "_showOpacity"
61 from: 0
62 to: 1
63 duration: UbuntuAnimation.SleepyDuration
64 onStarted: root.visible = true
65 }
67 hideAnimation: StandardAnimation {
68 property: "_showOpacity"
69 to: 0
70 duration: UbuntuAnimation.BriskDuration
71 onStopped: {
72 root.visible = false;
73 if (root.paused) {
74 d.showOnUnpause = true;
75 } else {
76 root.finished();
77 }
78 }
79 }
81 MouseArea { // eat any errant presses
82 id: mouseArea
83 anchors.fill: parent
84 }
86 Image {
87 id: background
88 // Use x/y/height/width instead of anchors so that we don't adjust
89 // the image if the OSK appears.
90 x: 0
91 y: 0
92 height: root.height
93 width: root.width
94 fillMode: Image.PreserveAspectCrop
95 }
97 Image {
98 id: arrow
99 width: units.gu(1.5)
100 source: Qt.resolvedUrl("graphics/arrow.svg")
101 fillMode: Image.PreserveAspectFit
102 mipmap: true
103 }
105 Label {
106 id: label
107 fontSize: "large"
108 font.weight: Font.Light
109 color: "#333333"
110 wrapMode: Text.Wrap
111 }