2
* uNav http://launchpad.net/unav
3
* Copyright (C) 2015-2016 Marcos Alvarez Costales https://launchpad.net/~costales
4
* This code is based on Podbird app code
6
* uNav is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 3 of the License, or
9
* (at your option) any later version.
11
* uNav is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
18
import Ubuntu.Components 1.3
19
import Ubuntu.Components.ListItems 1.3 as ListItem
24
// Property to set the app name used in the walkthrough
25
property string appName
27
// Property to check if this is the first run or not
28
property bool isFirstRun: true
30
// Property to store the slides shown in the walkthrough (Each slide is a component defined in a separate file for simplicity)
31
property list<Component> model
33
// Property to set the color of bottom cirle to indicate the user's progress
34
property color completeColor: "lightblue"
36
// Property to set the color of the bottom circle to indicate the slide still left to cover
37
property color inCompleteColor: "lightgrey"
39
// Property to set the color of the skip welcome wizard text
40
property color skipTextColor: "grey"
42
// Property to signal walkthrough completion
45
// Disable automatic orientation during welcome wizard since it is not landscape friendly yet.
46
// Component.onCompleted: podbird.automaticOrientation = false
47
// Component.onDestruction: podbird.automaticOrientation = true
54
// ListView to show the slides
61
bottom: slideIndicator.top
64
model: walkthrough.model
65
snapMode: ListView.SnapOneItem
66
orientation: Qt.Horizontal
67
highlightMoveDuration: UbuntuAnimation.FastDuration
68
highlightRangeMode: ListView.StrictlyEnforceRange
69
highlightFollowsCurrentItem: true
73
height: listView.height
81
sourceComponent: modelData
86
// Label to skip the walkthrough. Only visible on the first slide
92
wrapMode: Text.WordWrap
94
horizontalAlignment: Text.AlignRight
105
onClicked: walkthrough.finished()
109
// Indicator element to represent the current slide of the walkthrough
115
bottom: parent.bottom
116
horizontalCenter: parent.horizontalCenter
120
model: walkthrough.model.length
121
delegate: Rectangle {
126
border.width: listView.currentIndex == index ? units.gu(0.2) : units.gu(0)
127
border.color: completeColor
128
anchors.verticalCenter: parent.verticalCenter
129
color: listView.currentIndex == index ? "White"
130
: listView.currentIndex >= index ? completeColor
134
duration: UbuntuAnimation.FastDuration
148
bottom: parent.bottom
154
enabled: listView.currentIndex !== listView.count-1
155
onClicked: listView.currentIndex++
165
bottom: parent.bottom
172
enabled: listView.currentIndex !== 0
173
onClicked: listView.currentIndex--