@@ -15,16 +15,22 @@
1515 */
1616
1717import QtQuick 2.4
18+import QtQuick.Layouts 1.1
1819import Ubuntu.Components 1.3
1920import UInput 0.1
2021
2122Item {
23+ id: root
2224 property var uinput: UInput {
2325 Component.onCompleted: createMouse();
2426 Component.onDestruction: removeMouse();
2527 }
2628
27− readonly property bool pressed: point1.pressed || point2.pressed
29+ function runTutorial() {
30+ tutorial.start()
31+ }
32+
33+ readonly property bool pressed: point1.pressed || point2.pressed || leftButton.pressed || rightButton.pressed
2834
2935 MultiPointTouchArea {
3036 objectName: "touchPadArea"
@@ -135,4 +141,149 @@ Item {
135141 }
136142 ]
137143 }
144+
145+ RowLayout {
146+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom; margins: -units.gu(1) }
147+ height: units.gu(10)
148+ spacing: units.gu(1)
149+
150+ MouseArea {
151+ id: leftButton
152+ Layout.fillWidth: true
153+ Layout.fillHeight: true
154+ onPressed: uinput.pressMouse(UInput.ButtonLeft);
155+ onReleased: uinput.releaseMouse(UInput.ButtonLeft);
156+ property bool highlight: false
157+ UbuntuShape {
158+ anchors.fill: parent
159+ backgroundColor: leftButton.highlight || leftButton.pressed ? UbuntuColors.ash : UbuntuColors.inkstone
160+ Behavior on backgroundColor { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
161+ }
162+ }
163+
164+ MouseArea {
165+ id: rightButton
166+ Layout.fillWidth: true
167+ Layout.fillHeight: true
168+ onPressed: uinput.pressMouse(UInput.ButtonRight);
169+ onReleased: uinput.releaseMouse(UInput.ButtonRight);
170+ property bool highlight: false
171+ UbuntuShape {
172+ anchors.fill: parent
173+ backgroundColor: rightButton.highlight || rightButton.pressed ? UbuntuColors.ash : UbuntuColors.inkstone
174+ Behavior on backgroundColor { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
175+ }
176+ }
177+ }
178+
179+ Label {
180+ id: tutorialLabel
181+ anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(4); topMargin: units.gu(10) }
182+ opacity: 0
183+ fontSize: "large"
184+ color: "white"
185+ wrapMode: Text.WordWrap
186+ }
187+
188+ Item {
189+ id: tutorialFinger1
190+ width: units.gu(5)
191+ height: width
192+ property real scale: 1
193+ opacity: 0
194+ Rectangle {
195+ width: parent.width * parent.scale
196+ height: width
197+ anchors.centerIn: parent
198+ radius: width / 2
199+ color: UbuntuColors.inkstone
200+ }
201+ }
202+
203+ Item {
204+ id: tutorialFinger2
205+ width: units.gu(5)
206+ height: width
207+ property real scale: 1
208+ opacity: 0
209+ Rectangle {
210+ width: parent.width * parent.scale
211+ height: width
212+ anchors.centerIn: parent
213+ radius: width / 2
214+ color: UbuntuColors.inkstone
215+ }
216+ }
217+
218+ SequentialAnimation {
219+ id: tutorial
220+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
221+ PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Tap left button to click") }
222+ UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
223+ SequentialAnimation {
224+ loops: 2
225+ PropertyAction { target: leftButton; property: "highlight"; value: true }
226+ PauseAnimation { duration: UbuntuAnimation.FastDuration }
227+ PropertyAction { target: leftButton; property: "highlight"; value: false }
228+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
229+ }
230+ UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
231+
232+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
233+ PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Tap right button to right click") }
234+ UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
235+ SequentialAnimation {
236+ loops: 2
237+ PropertyAction { target: rightButton; property: "highlight"; value: true }
238+ PauseAnimation { duration: UbuntuAnimation.FastDuration }
239+ PropertyAction { target: rightButton; property: "highlight"; value: false }
240+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
241+ }
242+ UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
243+
244+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
245+ PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Swipe with two fingers to scroll") }
246+ UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
247+ PropertyAction { target: tutorialFinger1; property: "x"; value: root.width / 2 - tutorialFinger1.width - units.gu(1) }
248+ PropertyAction { target: tutorialFinger2; property: "x"; value: root.width / 2 + tutorialFinger1.width + units.gu(1) - tutorialFinger2.width }
249+ PropertyAction { target: tutorialFinger1; property: "y"; value: root.height / 2 - units.gu(10) }
250+ PropertyAction { target: tutorialFinger2; property: "y"; value: root.height / 2 - units.gu(10) }
251+ SequentialAnimation {
252+ ParallelAnimation {
253+ UbuntuNumberAnimation { target: tutorialFinger1; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
254+ UbuntuNumberAnimation { target: tutorialFinger2; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
255+ UbuntuNumberAnimation { target: tutorialFinger1; property: "scale"; from: 0; to: 1; duration: UbuntuAnimation.FastDuration }
256+ UbuntuNumberAnimation { target: tutorialFinger2; property: "scale"; from: 0; to: 1; duration: UbuntuAnimation.FastDuration }
257+ }
258+ ParallelAnimation {
259+ UbuntuNumberAnimation { target: tutorialFinger1; property: "y"; to: root.height / 2 + units.gu(10); duration: UbuntuAnimation.SleepyDuration }
260+ UbuntuNumberAnimation { target: tutorialFinger2; property: "y"; to: root.height / 2 + units.gu(10); duration: UbuntuAnimation.SleepyDuration }
261+ }
262+ ParallelAnimation {
263+ UbuntuNumberAnimation { target: tutorialFinger1; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
264+ UbuntuNumberAnimation { target: tutorialFinger2; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
265+ UbuntuNumberAnimation { target: tutorialFinger1; property: "scale"; from: 1; to: 0; duration: UbuntuAnimation.FastDuration }
266+ UbuntuNumberAnimation { target: tutorialFinger2; property: "scale"; from: 1; to: 0; duration: UbuntuAnimation.FastDuration }
267+ }
268+ PauseAnimation { duration: UbuntuAnimation.SlowDuration }
269+ ParallelAnimation {
270+ UbuntuNumberAnimation { target: tutorialFinger1; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
271+ UbuntuNumberAnimation { target: tutorialFinger2; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
272+ UbuntuNumberAnimation { target: tutorialFinger1; property: "scale"; from: 0; to: 1; duration: UbuntuAnimation.FastDuration }
273+ UbuntuNumberAnimation { target: tutorialFinger2; property: "scale"; from: 0; to: 1; duration: UbuntuAnimation.FastDuration }
274+ }
275+ ParallelAnimation {
276+ UbuntuNumberAnimation { target: tutorialFinger1; property: "y"; to: root.height / 2 - units.gu(10); duration: UbuntuAnimation.SleepyDuration }
277+ UbuntuNumberAnimation { target: tutorialFinger2; property: "y"; to: root.height / 2 - units.gu(10); duration: UbuntuAnimation.SleepyDuration }
278+ }
279+ ParallelAnimation {
280+ UbuntuNumberAnimation { target: tutorialFinger1; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
281+ UbuntuNumberAnimation { target: tutorialFinger2; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
282+ UbuntuNumberAnimation { target: tutorialFinger1; property: "scale"; from: 1; to: 0; duration: UbuntuAnimation.FastDuration }
283+ UbuntuNumberAnimation { target: tutorialFinger2; property: "scale"; from: 1; to: 0; duration: UbuntuAnimation.FastDuration }
284+ }
285+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
286+ }
287+ UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
288+ }
138289}