2 * Copyright (C) 2013 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/>.
19import QtGraphicalEffects 1.0
20import Unity.Application 0.1
21import Ubuntu.Components 0.1
27 * Valid values are "left", "right", "top", "bottom", or "none".
29 property string edge: "top"
32 * This is the header displayed, like "Right edge".
34 property alias title: titleLabel.text
37 * This is the block of text displayed below the header.
39 property alias text: textLabel.text
42 * This is the text for the skip button.
44 property alias skipText: skipLabel.text
47 * This is the visible status of the skip button.
49 property alias showSkip: skipLabel.visible
52 * Whether this demo is running currently.
54 readonly property bool active: available && visible
57 * Whether animations are paused.
59 property alias paused: wholeAnimation.paused
62 * Whether animations are running.
64 readonly property alias running: wholeAnimation.running
74 overlay.visible = false;
75 overlay.available = false;
81 showAnimation: StandardAnimation {
84 onRunningChanged: if (running) overlay.visible = true
86 hideAnimation: StandardAnimation {
89 duration: UbuntuAnimation.BriskDuration
90 onRunningChanged: if (!running) overlay.hideNow()
95 property bool skipOnHide: false
96 property int edgeMargin: units.gu(4)
100 objectName: "backgroundShade"
105 visible: overlay.active
109 enabled: overlay.edge == "none" && overlay.opacity == 1.0
110 onClicked: overlay.doSkip()
119 height: parent.height
120 visible: overlay.active
127 margins: d.edgeMargin
129 top: overlay.edge == "bottom" ? undefined : parent.top
130 bottom: overlay.edge == "bottom" ? parent.bottom : undefined
137 wrapMode: Text.WordWrap
143 wrapMode: Text.WordWrap
148 objectName: "skipLabel"
149 text: i18n.tr("Skip intro")
150 color: UbuntuColors.orange
154 anchors.left: parent.right
155 anchors.verticalCenter: parent.verticalCenter
159 color: UbuntuColors.orange
163 // Make clickable area bigger than just the link because
164 // otherwise, the edge demo will feel hard to dismiss.
166 anchors.margins: -units.gu(5)
167 onClicked: overlay.doSkip()
176 visible: overlay.edge != "none"
180 color: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4) // UbuntuColors.orange, but transparent
189 if (overlay.edge == "right") {
190 return Qt.point(width, 0);
191 } else if (overlay.edge == "left") {
192 return Qt.point(0, 0);
193 } else if (overlay.edge == "top") {
194 return Qt.point(0, 0);
196 return Qt.point(0, height);
200 if (overlay.edge == "right") {
201 return Qt.point(width - size, 0);
202 } else if (overlay.edge == "left") {
203 return Qt.point(size, 0);
204 } else if (overlay.edge == "top") {
205 return Qt.point(0, size);
207 return Qt.point(0, height - size);
213 SequentialAnimation {
215 objectName: "wholeAnimation"
216 running: overlay.active
224 if (overlay.edge == "right" || overlay.edge == "left") {
225 return "anchors.leftMargin";
226 } else if (overlay.edge == "bottom") {
227 return "anchors.bottomMargin";
229 return "anchors.topMargin";
233 if (overlay.edge == "right") {
234 return d.edgeMargin + units.gu(3)
236 return d.edgeMargin - units.gu(3)
240 duration: overlay.edge == "none" ? 0 : UbuntuAnimation.SleepyDuration
247 duration: UbuntuAnimation.SleepyDuration
251 SequentialAnimation {
253 loops: Animation.Infinite
254 property string prop: (overlay.edge == "left" || overlay.edge == "right") ? "x" : "y"
255 property double endVal: units.dp(5) * ((overlay.edge == "left" || overlay.edge == "top") ? 1 : -1)
256 property double maxGlow: units.dp(20)
257 property int duration: overlay.edge == "none" ? 0 : UbuntuAnimation.SleepyDuration
260 StandardAnimation { target: hintGroup; property: hintAnimation.prop; from: 0; to: hintAnimation.endVal; duration: hintAnimation.duration }
261 StandardAnimation { target: edgeHint; property: "size"; from: 1; to: hintAnimation.maxGlow; duration: hintAnimation.duration }
266 StandardAnimation { target: hintGroup; property: hintAnimation.prop; from: hintAnimation.endVal; to: 0; duration: hintAnimation.duration }
267 StandardAnimation { target: edgeHint; property: "size"; from: hintAnimation.maxGlow; to: 1; duration: hintAnimation.duration }
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list