on d28fa91 help sign in
unity8/qml/Tutorial/TutorialRight.qml
223 lines 7.2 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 Ubuntu.Gestures 0.1
20import Unity.Application 0.1
21import "../Components"
22import "../Stages"
23import "." as LocalComponents
25TutorialPage {
26 id: root
28 property var panel
29 property alias edgeSize: stage.dragAreaWidth
31 title: i18n.tr("To view open apps")
32 text: i18n.tr("Long swipe from the right edge.")
34 textOpacity: 1 - slider.percent
36 SequentialAnimation {
37 id: teaseAnimation
38 paused: running && root.paused
39 running: !stage.dragging && stage.dragProgress === 0
40 loops: Animation.Infinite
42 UbuntuNumberAnimation {
43 target: stage
44 property: "x"
45 to: -units.gu(2)
46 duration: UbuntuAnimation.SleepyDuration
47 }
48 UbuntuNumberAnimation {
49 target: stage
50 property: "x"
51 to: 0
52 duration: UbuntuAnimation.SleepyDuration
53 }
54 }
56 foreground {
57 children: [
58 LocalComponents.Slider {
59 id: slider
60 anchors {
61 right: parent.right
62 top: parent.top
63 topMargin: root.textBottom + units.gu(3)
64 }
65 rotation: 180
66 offset: stage.dragProgress - stage.x
67 active: stage.dragging
68 },
70 // Just assume PhoneStage for now. The tablet version of the right-edge
71 // tutorial is still being spec'd by the design team.
72 PhoneStage {
73 id: stage
74 objectName: "stage"
75 anchors.top: parent.top
76 width: parent.width
77 height: parent.height
78 applicationManager: fakeAppManager
79 color: "transparent"
80 interactive: false
81 altTabEnabled: false
82 focusFirstApp: false
83 startScale: 0.8
84 endScale: 0.6
85 dragAreaOverlap: -x
87 onOpened: {
88 overlay.show();
89 root.textOpacity = 0;
90 slider.visible = false;
91 }
93 onDraggingChanged: {
94 if (!dragging) {
95 if (!overlay.shown) {
96 root.showError();
97 }
98 teaseAnimation.complete();
99 }
100 }
101 },
103 Showable {
104 id: overlay
105 objectName: "overlay"
106 anchors.fill: parent
108 opacity: 0
109 shown: false
110 showAnimation: UbuntuNumberAnimation { property: "opacity"; to: 1 }
112 Label {
113 anchors.top: parent.top
114 anchors.topMargin: root.panel.panelHeight + units.gu(2)
115 anchors.left: parent.left
116 anchors.leftMargin: units.gu(2)
117 anchors.right: parent.right
118 anchors.rightMargin: units.gu(2)
119 wrapMode: Text.Wrap
120 horizontalAlignment: Text.AlignHCenter
121 fontSize: "large"
122 text: i18n.tr("View all your running tasks.")
123 }
125 LocalComponents.Tick {
126 objectName: "tick"
127 anchors.bottom: bottomOverlayText.top
128 anchors.bottomMargin: units.gu(1)
129 anchors.horizontalCenter: bottomOverlayText.horizontalCenter
130 onClicked: root.hide()
131 }
133 Label {
134 id: bottomOverlayText
135 anchors.bottom: parent.bottom
136 anchors.bottomMargin: units.gu(2)
137 anchors.left: parent.left
138 anchors.leftMargin: units.gu(2)
139 anchors.right: parent.right
140 anchors.rightMargin: units.gu(2)
141 wrapMode: Text.Wrap
142 horizontalAlignment: Text.AlignHCenter
143 fontSize: "small"
144 text: i18n.tr("Tap here to continue.")
145 }
146 }
147 ]
148 }
150 ListModel {
151 id: fakeAppManager
153 readonly property string focusedApplicationId: "facebook"
155 function focusApplication(appId) {}
156 function requestFocusApplication(appId) {}
157 function findApplication(appId) {return null;}
159 signal applicationAdded(string appId)
160 signal applicationRemoved(string appId)
161 signal focusRequested(string appId)
163 ListElement {
164 appId: "facebook"
165 fullscreen: false
166 name: ""
167 icon: ""
168 state: ApplicationInfoInterface.Stopped
169 splashTitle: ""
170 splashImage: ""
171 splashShowHeader: false
172 splashColor: "transparent"
173 splashColorHeader: "transparent"
174 splashColorFooter: "transparent"
175 defaultScreenshot: "../Tutorial/graphics/facebook.png"
176 }
178 ListElement {
179 appId: "camera"
180 fullscreen: false
181 name: ""
182 icon: ""
183 state: ApplicationInfoInterface.Stopped
184 splashTitle: ""
185 splashImage: ""
186 splashShowHeader: false
187 splashColor: "transparent"
188 splashColorHeader: "transparent"
189 splashColorFooter: "transparent"
190 defaultScreenshot: "../Tutorial/graphics/camera.png"
191 }
193 ListElement {
194 appId: "gallery"
195 fullscreen: false
196 name: ""
197 icon: ""
198 state: ApplicationInfoInterface.Stopped
199 splashTitle: ""
200 splashImage: ""
201 splashShowHeader: false
202 splashColor: "transparent"
203 splashColorHeader: "transparent"
204 splashColorFooter: "transparent"
205 defaultScreenshot: "../Tutorial/graphics/gallery.png"
206 }
208 ListElement {
209 appId: "dialer"
210 fullscreen: false
211 name: ""
212 icon: ""
213 state: ApplicationInfoInterface.Stopped
214 splashTitle: ""
215 splashImage: ""
216 splashShowHeader: false
217 splashColor: "transparent"
218 splashColorHeader: "transparent"
219 splashColorFooter: "transparent"
220 defaultScreenshot: "../Tutorial/graphics/dialer.png"
221 }
222 }