@@ -0,0 +1,177 @@
1+/*
2+ * Copyright (C) 2013 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+ */
16+
17+import QtQuick 2.0
18+import QtGraphicalEffects 1.0
19+import GSettings 1.0
20+import Ubuntu.Application 0.1
21+import Ubuntu.Components 0.1
22+
23+Item {
24+ id: overlay
25+
26+ /*
27+ * Valid values are "left", "right", "top", or "bottom".
28+ */
29+ property string edge: "top"
30+
31+ /*
32+ * This is the header displayed, like "Right edge".
33+ */
34+ property string title
35+
36+ /*
37+ * This is the block of text displayed below the header.
38+ */
39+ property string text
40+
41+ property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
42+ property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
43+ property int __edge_margin: units.gu(4)
44+ property int __text_margin: units.gu(3)
45+
46+ function __isDemoSkipped() {
47+ // Check global spot, then check gsettings
48+ }
49+
50+ function __setDemoSkipped() {
51+ // We are running in one of two modes:
52+ // 1) As a greeter as the lightdm user
53+ // 2) As a shell as session user
54+ }
55+
56+ Rectangle {
57+ id: backgroundShade
58+ anchors.fill: parent
59+ color: "black"
60+ opacity: 0.8
61+ }
62+
63+ Item {
64+ id: hintGroup
65+ x: 0
66+ y: 0
67+ width: parent.width
68+ height: parent.height
69+
70+ Column {
71+ id: labelGroup
72+ layer.enabled: true // otherwise the underlining on "Skip intro" jumps
73+ spacing: overlay.__text_margin
74+
75+ anchors {
76+ margins: overlay.__edge_margin
77+ left: parent.left
78+ top: overlay.edge == "bottom" ? undefined : parent.top
79+ bottom: overlay.edge == "bottom" ? parent.bottom : undefined
80+ }
81+
82+ Label {
83+ id: titleLabel
84+ text: overlay.title
85+ color: "#B7B3AC"
86+ fontSize: "x-large"
87+ width: units.gu(25)
88+ wrapMode: Text.WordWrap
89+ }
90+
91+ Label {
92+ id: textLabel
93+ text: overlay.text
94+ color: "#B7B3AC"
95+ width: units.gu(25)
96+ wrapMode: Text.WordWrap
97+ }
98+
99+ Label {
100+ id: skipLabel
101+ text: i18n.tr("Skip intro")
102+ color: overlay.__orange
103+ fontSize: "small"
104+ font.underline: true
105+
106+ MouseArea {
107+ anchors.fill: parent
108+ onClicked: {
109+ console.log("Clicked!");
110+ __setDemoSkipped();
111+ overlay.visible = false;
112+ }
113+ }
114+ }
115+ }
116+
117+ LinearGradient {
118+ id: edgeHint
119+ property int size: 1
120+ cached: false
121+ gradient: Gradient {
122+ GradientStop {
123+ position: 0.0
124+ color: overlay.__orange_transparent
125+ }
126+ GradientStop {
127+ position: 1.0
128+ color: "#00000000"
129+ }
130+ }
131+ anchors.fill: parent
132+ start: {
133+ if (overlay.edge == "right") {
134+ return Qt.point(width, 0);
135+ } else if (overlay.edge == "left") {
136+ return Qt.point(0, 0);
137+ } else if (overlay.edge == "top") {
138+ return Qt.point(0, 0);
139+ } else {
140+ return Qt.point(0, height);
141+ }
142+ }
143+ end: {
144+ if (overlay.edge == "right") {
145+ return Qt.point(width - size, 0);
146+ } else if (overlay.edge == "left") {
147+ return Qt.point(size, 0);
148+ } else if (overlay.edge == "top") {
149+ return Qt.point(0, size);
150+ } else {
151+ return Qt.point(0, height - size);
152+ }
153+ }
154+ }
155+ }
156+
157+ SequentialAnimation {
158+ id: hintAnimation
159+ loops: Animation.Infinite
160+ running: true
161+ property string prop: (overlay.edge == "left" || overlay.edge == "right") ? "x" : "y"
162+ property double endVal: units.dp(5) * ((overlay.edge == "left" || overlay.edge == "top") ? 1 : -1)
163+ property double maxGlow: units.dp(20)
164+ property int duration: 1000
165+
166+ ParallelAnimation {
167+ StandardAnimation { target: hintGroup; property: hintAnimation.prop; from: 0; to: hintAnimation.endVal; duration: hintAnimation.duration }
168+ StandardAnimation { target: edgeHint; property: "size"; from: 1; to: hintAnimation.maxGlow; duration: hintAnimation.duration }
169+ }
170+
171+ // Undo the above
172+ ParallelAnimation {
173+ StandardAnimation { target: hintGroup; property: hintAnimation.prop; from: hintAnimation.endVal; to: 0; duration: hintAnimation.duration }
174+ StandardAnimation { target: edgeHint; property: "size"; from: hintAnimation.maxGlow; to: 1; duration: hintAnimation.duration }
175+ }
176+ }
177+}