Merge lp:~nik90/component-store/add-welcome-wizard into lp:component-store

Proposed by Nekhelesh Ramananthan
Status: Merged
Merged at revision: 43
Proposed branch: lp:~nik90/component-store/add-welcome-wizard
Merge into: lp:component-store
Diff against target: 545 lines (+484/-1)
9 files modified
ComponentStore/WelcomeWizard/Walkthrough.qml (+116/-0)
ComponentStore/WelcomeWizard/ubuntu_component_store.json (+6/-0)
GallerySRC/Slide1.qml (+54/-0)
GallerySRC/Slide2.qml (+42/-0)
GallerySRC/WelcomeWizardWidget.qml (+41/-0)
GallerySRC/WidgetsModel.qml (+5/-0)
docs/_components/listitemwithactions.rst (+1/-1)
docs/_components/welcomewizard.rst (+218/-0)
docs/index.rst (+1/-0)
To merge this branch: bzr merge lp:~nik90/component-store/add-welcome-wizard
Reviewer Review Type Date Requested Status
Ubuntu Touch Community Dev Pending
Review via email: mp+251599@code.launchpad.net

Commit message

Added welcome wizard component

Description of the change

Adds welcome wizard component

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'ComponentStore/WelcomeWizard'
=== added file 'ComponentStore/WelcomeWizard/Walkthrough.qml'
--- ComponentStore/WelcomeWizard/Walkthrough.qml 1970-01-01 00:00:00 +0000
+++ ComponentStore/WelcomeWizard/Walkthrough.qml 2015-03-03 14:08:25 +0000
@@ -0,0 +1,116 @@
1import QtQuick 2.3
2import Ubuntu.Components 1.1
3import Ubuntu.Components.ListItems 1.0 as ListItem
4
5Page {
6 id: walkthrough
7
8 // Property to set the app name used in the walkthrough
9 property string appName
10
11 // Property to check if this is the first run or not
12 property bool isFirstRun: true
13
14 // Property to store the slides shown in the walkthrough (Each slide is a component defined in a separate file for simplicity)
15 property list<Component> model
16
17 // Property to set the color of bottom cirle to indicate the user's progress
18 property color completeColor: "green"
19
20 // Property to set the color of the bottom circle to indicate the slide still left to cover
21 property color inCompleteColor: "grey"
22
23 // Property to set the color of the skip welcome wizard text
24 property color skipTextColor: "grey"
25
26 // Property to signal walkthrough completion
27 signal finished
28
29 // ListView to show the slides
30 ListView {
31 id: listView
32 anchors {
33 left: parent.left
34 right: parent.right
35 top: skipLabel.bottom
36 bottom: separator.top
37 }
38
39 model: walkthrough.model
40 snapMode: ListView.SnapOneItem
41 orientation: Qt.Horizontal
42 highlightMoveDuration: UbuntuAnimation.FastDuration
43 highlightRangeMode: ListView.StrictlyEnforceRange
44 highlightFollowsCurrentItem: true
45
46 delegate: Item {
47 width: listView.width
48 height: listView.height
49 clip: true
50
51 Loader {
52 anchors {
53 fill: parent
54 margins: units.gu(2)
55 }
56
57 sourceComponent: modelData
58 }
59 }
60 }
61
62 // Label to skip the walkthrough. Only visible on the first slide
63 Label {
64 id: skipLabel
65
66 color: skipTextColor
67 fontSize: "small"
68 width: contentWidth
69 text: listView.currentIndex === 0 ? i18n.tr("Already used %1? <b>Skip the tutorial</b>").arg(appName) : i18n.tr("Skip")
70
71 anchors {
72 top: parent.top
73 left: parent.left
74 margins: units.gu(2)
75 }
76
77 MouseArea {
78 anchors.fill: parent
79 onClicked: walkthrough.finished()
80 }
81 }
82
83 // Separator between walkthrough slides and slide indicator
84 ListItem.ThinDivider {
85 id: separator
86 anchors.bottom: slideIndicator.top
87 }
88
89 // Indicator element to represent the current slide of the walkthrough
90 Row {
91 id: slideIndicator
92 height: units.gu(6)
93 spacing: units.gu(2)
94 anchors {
95 bottom: parent.bottom
96 horizontalCenter: parent.horizontalCenter
97 }
98
99 Repeater {
100 model: walkthrough.model.length
101 delegate: Rectangle {
102 height: width
103 radius: width/2
104 width: units.gu(2)
105 antialiasing: true
106 anchors.verticalCenter: parent.verticalCenter
107 color: listView.currentIndex >= index ? completeColor : inCompleteColor
108 Behavior on color {
109 ColorAnimation {
110 duration: UbuntuAnimation.FastDuration
111 }
112 }
113 }
114 }
115 }
116}
0117
=== added file 'ComponentStore/WelcomeWizard/ubuntu_component_store.json'
--- ComponentStore/WelcomeWizard/ubuntu_component_store.json 1970-01-01 00:00:00 +0000
+++ ComponentStore/WelcomeWizard/ubuntu_component_store.json 2015-03-03 14:08:25 +0000
@@ -0,0 +1,6 @@
1{
2 "name": "WelcomeWizard",
3 "description": "This widget adds a welcome wizard to help introduce the app to users.",
4 "version": "1.0",
5 "documentation_url": "http://ubuntu-component-store.readthedocs.org/en/latest/_components/circleimage.html"
6}
07
=== added file 'GallerySRC/Slide1.qml'
--- GallerySRC/Slide1.qml 1970-01-01 00:00:00 +0000
+++ GallerySRC/Slide1.qml 2015-03-03 14:08:25 +0000
@@ -0,0 +1,54 @@
1import QtQuick 2.3
2import Ubuntu.Components 1.1
3
4// Slide 1
5Component {
6 id: slide1
7 Item {
8 id: slide1Container
9
10 UbuntuShape {
11 anchors {
12 bottom: textColumn.top
13 bottomMargin: units.gu(4)
14 horizontalCenter: parent.horizontalCenter
15 }
16
17 image: Image {
18 smooth: true
19 antialiasing: true
20 fillMode: Image.PreserveAspectFit
21 source: Qt.resolvedUrl("assets/flashback.png")
22 }
23 }
24
25 Column {
26 id: textColumn
27
28 anchors.centerIn: parent
29
30 Label {
31 text: "Welcome to"
32 fontSize: "x-large"
33 height: contentHeight
34 anchors.horizontalCenter: parent.horizontalCenter
35 }
36 Label {
37 text: "Component Store Gallery"
38 font.bold: true
39 height: contentHeight
40 font.pixelSize: units.dp(50)
41 anchors.horizontalCenter: parent.horizontalCenter
42 }
43 }
44
45 Label {
46 id: swipeText
47 text: "Swipe left to continue"
48 horizontalAlignment: Text.AlignHCenter
49 anchors.bottom: parent.bottom
50 anchors.bottomMargin: units.gu(2)
51 anchors.horizontalCenter: parent.horizontalCenter
52 }
53 }
54}
055
=== added file 'GallerySRC/Slide2.qml'
--- GallerySRC/Slide2.qml 1970-01-01 00:00:00 +0000
+++ GallerySRC/Slide2.qml 2015-03-03 14:08:25 +0000
@@ -0,0 +1,42 @@
1import QtQuick 2.3
2import Ubuntu.Components 1.1
3
4// Slide 2
5Component {
6 id: slide2
7 Item {
8 id: slide2Container
9
10 Column {
11 id: mainColumn
12 spacing: units.gu(4)
13 anchors.fill: parent
14
15 Label {
16 id: introductionText
17 text: "Component Store Gallery"
18 font.bold: true
19 fontSize: "x-large"
20 anchors.horizontalCenter: parent.horizontalCenter
21 }
22
23 Image {
24 id: centerImage
25 height: parent.height - bodyText.contentHeight - introductionText.height - 4*mainColumn.spacing
26 fillMode: Image.PreserveAspectFit
27 anchors.horizontalCenter: parent.horizontalCenter
28 source: Qt.resolvedUrl("assets/flashback.png")
29 }
30
31 Label {
32 id: bodyText
33 anchors.left: parent.left
34 anchors.right: parent.right
35 wrapMode: Text.WordWrap
36 font.pixelSize: units.dp(17)
37 horizontalAlignment: Text.AlignHCenter
38 text: "Component Store Gallery is a frontend app to the component store and provides a demo of all the components in the store. \n\nUbuntu Touch's first component store!"
39 }
40 }
41 }
42}
043
=== added file 'GallerySRC/WelcomeWizardWidget.qml'
--- GallerySRC/WelcomeWizardWidget.qml 1970-01-01 00:00:00 +0000
+++ GallerySRC/WelcomeWizardWidget.qml 2015-03-03 14:08:25 +0000
@@ -0,0 +1,41 @@
1import QtQuick 2.0
2import Ubuntu.Components 1.1
3import "../ComponentStore/WelcomeWizard"
4
5TemplateWidgetPage {
6 id: welcomeWizardWidget
7
8 title: "Welcome Wizard"
9 author: "Nekhelesh Ramananthan, Michael Spencer"
10 email: "nik90@ubuntu.com"
11 license: "GNU General Public License v3.0"
12 description: "This widget adds a welcome wizard which helps showcase the \
13app features to the user."
14
15 Component {
16 id: pageComponent
17 Walkthrough {
18 id: walkthrough
19
20 appName: "Component Store Gallery"
21
22 onFinished: {
23 console.log("Welcome Wizard Complete!")
24 stack.pop()
25 }
26
27 model: [
28 Slide1{},
29 Slide2{}
30 ]
31 }
32 }
33
34 content: Button {
35 text: "Preview Welcome Wizard Component"
36 color: "Green"
37 height: units.gu(6)
38 onClicked: stack.push(pageComponent)
39 anchors.centerIn: parent
40 }
41}
042
=== modified file 'GallerySRC/WidgetsModel.qml'
--- GallerySRC/WidgetsModel.qml 2014-11-15 13:52:44 +0000
+++ GallerySRC/WidgetsModel.qml 2015-03-03 14:08:25 +0000
@@ -32,4 +32,9 @@
32 label: "Radial Bottom Edge"32 label: "Radial Bottom Edge"
33 source: "GallerySRC/RadialBottomEdgeWidget.qml"33 source: "GallerySRC/RadialBottomEdgeWidget.qml"
34 }34 }
35
36 ListElement {
37 label: "Welcome Wizard"
38 source: "GallerySRC/WelcomeWizardWidget.qml"
39 }
35}40}
3641
=== modified file 'docs/_components/listitemwithactions.rst'
--- docs/_components/listitemwithactions.rst 2014-11-15 14:59:11 +0000
+++ docs/_components/listitemwithactions.rst 2015-03-03 14:08:25 +0000
@@ -116,7 +116,7 @@
116 116
117 Label {117 Label {
118 id: subTitle118 id: subTitle
119 text: "SubTitle119 text: "SubTitle"
120 }120 }
121 }121 }
122122
123123
=== added file 'docs/_components/welcomewizard.rst'
--- docs/_components/welcomewizard.rst 1970-01-01 00:00:00 +0000
+++ docs/_components/welcomewizard.rst 2015-03-03 14:08:25 +0000
@@ -0,0 +1,218 @@
1Welcome Wizard
2==============
3
4+----------+----------------------------------------+
5| Author | Nekhelesh Ramananthan, Michael Spencer |
6+----------+-------------+--------------------------+
7| License | BSD License |
8+----------+----------------------------------------+
9| Contact | nik90@ubuntu.com |
10+----------+----------------------------------------+
11| Framework| ubuntu-sdk-14.10 |
12+----------+----------------------------------------+
13
14This component shows users a welcome wizard which can be used to introduce
15and showcase the features of the app to guide the user. The API of this
16component is rather simple and provides a lot of freedom to the developer
17to present his content.
18
19It is recommended to put the Walkthrough{} component inside a qml Component{}
20since it is not run frequently. Walkthrough derives from a Page. So push it
21into a pagestack to show the welcome wizard as shown below in the example.
22
23Example:
24
25MainView.qml
26
27.. code-block:: qml
28
29 MainView
30 {
31 Component {
32 id: pageComponent
33 Walkthrough {
34 id: walkthrough
35
36 appName: "Component Store Gallery"
37
38 onFinished: {
39 console.log("Welcome Wizard Complete!")
40 // Here perhaps save isFirstRun variable to the disk
41 stack.pop()
42 }
43
44 model: [
45 Slide1{},
46 Slide2{}
47 ]
48 }
49 }
50
51 component.onCompleted: pagestack.push(pageComponent)
52 }
53
54Slide1.qml
55
56.. code-block:: qml
57
58 import QtQuick 2.3
59 import Ubuntu.Components 1.1
60
61 // Slide 1
62 Component {
63 id: slide1
64 Item {
65 id: slide1Container
66
67 UbuntuShape {
68 anchors {
69 bottom: textColumn.top
70 bottomMargin: units.gu(4)
71 horizontalCenter: parent.horizontalCenter
72 }
73
74 image: Image {
75 smooth: true
76 antialiasing: true
77 fillMode: Image.PreserveAspectFit
78 source: Qt.resolvedUrl("assets/flashback.png")
79 }
80 }
81
82 Column {
83 id: textColumn
84
85 anchors.centerIn: parent
86
87 Label {
88 text: "Welcome to"
89 fontSize: "x-large"
90 height: contentHeight
91 anchors.horizontalCenter: parent.horizontalCenter
92 }
93 Label {
94 text: "Component Store Gallery"
95 font.bold: true
96 height: contentHeight
97 font.pixelSize: units.dp(50)
98 anchors.horizontalCenter: parent.horizontalCenter
99 }
100 }
101
102 Label {
103 id: swipeText
104 text: "Swipe left to continue"
105 horizontalAlignment: Text.AlignHCenter
106 anchors.bottom: parent.bottom
107 anchors.bottomMargin: units.gu(2)
108 anchors.horizontalCenter: parent.horizontalCenter
109 }
110 }
111 }
112
113.. image:: ../_images/welcomewizard.png
114 :align: center
115
116Properties
117----------
118
119- :ref:`appName`: string
120- :ref:`isFirstRun`: boolean
121- :ref:`model`: Item<list>
122- :ref:`completeColor`: color
123- :ref:`inCompleteColor`: color
124- :ref:`skipTextColor`: color
125
126Signals
127-------
128
129- :ref:`finished()`
130
131Property Documentation
132----------------------
133
134.. _appName:
135
136appName
137^^^^^^^
138
139Name of the application that is shown in some parts of the welcome wizard.
140
141.. _isFirstRun:
142
143isFirstRun
144^^^^^^^^^^
145
146Boolean property to determine if the welcome wizard was run for the first time
147or not. It is recommended to store this variable to the disk using U1dB or Qt.labs.settings
148to remember the welcome wizard run state.
149
150.. _model:
151
152model
153^^^^^
154
155This property stores the welcome wizards slides that are shown to the user.
156Create your content and store them in separate files per slide. So if you
157have 3 slides in your welcome wizard, you could define them as Slide1.qml,
158Slide2.qml and Slide3.qml and then reference them as,
159
160.. code-block:: qml
161
162 model: [
163 Slide1{},
164 Slide2{},
165 Slide3{}
166 ]
167
168The slides should only contain the content you want to show. Everything else like the
169dots, divider, title etc are handled by the welcome wizard component itself. Think of these
170slides as delegates in a listview which only house the content itself.
171
172.. _completeColor:
173
174completeColor
175^^^^^^^^^^^^^
176
177This property sets the color of the bottom circle to indicate the progress of the user. By
178default it is green.
179
180.. _inCompleteColor:
181
182inCompleteColor
183^^^^^^^^^^^^^^^
184
185This property sets the color of the bottom circle to indicate the slides left in the wizard.
186By default it is grey.
187
188.. _skipTextColor:
189
190skipTextColor
191^^^^^^^^^^^^^
192
193This property sets the color of the skip text shown at the top of the welcome wizard.
194
195Signal Documentation
196--------------------
197
198.. _finished():
199
200finished()
201^^^^^^^^^^
202
203This signal is fired automatically when the user press the skip button. It can also be made
204to fire manually to exit the welcome wizard. You can perform exit tasks when this signal is fired
205like updating the :ref:`isFirstRun` variable and storing to disk etc.
206
207.. code-block:: qml
208
209 Button {
210 id: continueButton
211 color: "Green"
212 height: units.gu(5)
213 width: units.gu(25)
214 text: "Exit Welcome Wizard"
215 anchors.horizontalCenter: parent.horizontalCenter
216 onClicked: finished()
217 }
218
0219
=== added file 'docs/_images/welcomewizard.png'
1Binary files docs/_images/welcomewizard.png 1970-01-01 00:00:00 +0000 and docs/_images/welcomewizard.png 2015-03-03 14:08:25 +0000 differ220Binary files docs/_images/welcomewizard.png 1970-01-01 00:00:00 +0000 and docs/_images/welcomewizard.png 2015-03-03 14:08:25 +0000 differ
=== modified file 'docs/index.rst'
--- docs/index.rst 2014-11-15 14:50:47 +0000
+++ docs/index.rst 2015-03-03 14:08:25 +0000
@@ -54,3 +54,4 @@
54 _components/listitemwithactions54 _components/listitemwithactions
55 _components/pagewithbottomedge55 _components/pagewithbottomedge
56 _components/radialbottomedge56 _components/radialbottomedge
57 _components/welcomewizard

Subscribers

People subscribed via source and target branches