Merge lp:~stefan-schwarzburg/qreator/touch-reorganized into lp:qreator/touch

Proposed by Schwarzburg on 2013-06-10
Status: Merged
Merged at revision: 15
Proposed branch: lp:~stefan-schwarzburg/qreator/touch-reorganized
Merge into: lp:qreator/touch
Diff against target: 666 lines (+297/-299)
9 files modified
qrcodes/PageQrText.qml (+38/-0)
qrcodes/PageQrUrl.qml (+35/-0)
qrcodes/PageQrWifi.qml (+88/-0)
qreator-touch.qml (+30/-298)
qreator/CreatorPage.qml (+75/-0)
qreator/HistoryPage.qml (+9/-0)
qreator/QrCodeCanvas.qml (+2/-1)
qreator/QrCodeToolBar.qml (+6/-0)
qreator/ScannerPage.qml (+14/-0)
To merge this branch: bzr merge lp:~stefan-schwarzburg/qreator/touch-reorganized
Reviewer Review Type Date Requested Status
David Planella 2013-06-10 Approve on 2013-06-15
Review via email: mp+168470@code.launchpad.net

Description of the change

This branch mainly reorganizes the files we use:

- a folder "qreator" for all high level pages and items (the scanner page would go in here, as well as dialogs). One file per main component
- a folder "qrcodes" for all qrcode types we support when creating qr codes. Each data type has a separate file.

Certain components now have their own file: qrcanvas, qrtoolbar

This branch also introduces tabs as the main navigation structure. It still uses a pagestack within the "create" tab.

I have tried to change as few additional things as possible, the only exception is the location of the global property "pageSpacing". When using different files for the individual components, the only properties accessable seem to be properties of root.

To post a comment you must log in.
David Planella (dpm) wrote :

Looks good to me, thanks!

Before merging to trunk, I've gone ahead and did a few extra changes. Mostly they were to fix some indentations, but the main one is that I renamed file names such as CreatorPage to Creator, as I thought they should not be dependent on the base component, especially if we change the UI at some point and they're no longer pages. I left the *Canvas and *Toolbar ones unchanged, as I thought these are intrinsically associated with their component, and the name helps clarifying what they are.

Let me know if you're ok with this changes. If not, we can always discuss and revert.

You can see the actual changes doing:

    bzr qdiff -r 14.1.1..15

review: Approve
Schwarzburg (stefan-schwarzburg) wrote :

Your changes are perfect! Thanks for merging...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'qrcodes'
=== added file 'qrcodes/PageQrText.qml'
--- qrcodes/PageQrText.qml 1970-01-01 00:00:00 +0000
+++ qrcodes/PageQrText.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,38 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import Ubuntu.Components.ListItems 0.1 as ListItem
4import Ubuntu.Components.Popups 0.1
5import QtQuick.LocalStorage 2.0
6
7import "../qreator"
8
9import "../js/qrcode.js" as Qreator
10
11Page {
12 id: pageQrText
13 title: i18n.tr("Text QR code")
14 visible: false
15
16 Column {
17 anchors.centerIn: parent
18 spacing: root.pageSpacing
19
20 TextArea {
21 id: textQrCodeText
22 placeholderText: i18n.tr("Type the text to encode")
23 autoSize: true
24 maximumLineCount: 5
25 width: units.gu(33)
26
27 onTextChanged: {qrcanvastext.requestQrCodePaint(text)}
28 }
29
30 QrCodeCanvas {
31 id: qrcanvastext
32 width: units.gu(33)
33 height: units.gu(33)
34 }
35 }
36 tools: QrCodeToolBar{}
37}
38
039
=== added file 'qrcodes/PageQrUrl.qml'
--- qrcodes/PageQrUrl.qml 1970-01-01 00:00:00 +0000
+++ qrcodes/PageQrUrl.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,35 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import Ubuntu.Components.ListItems 0.1 as ListItem
4import Ubuntu.Components.Popups 0.1
5import QtQuick.LocalStorage 2.0
6
7import "../qreator"
8
9
10Page {
11 id: pageQrUrl
12 title: i18n.tr("URL QR code")
13 visible: false
14
15 Column {
16 anchors.centerIn: parent
17 spacing: root.pageSpacing
18
19 TextField {
20 id: textQrCodeUrl
21 width: units.gu(33)
22 placeholderText: i18n.tr("Type the URL to encode")
23 hasClearButton: true
24
25 onTextChanged: {qrcanvasurl.requestQrCodePaint(text)}
26 }
27
28 QrCodeCanvas {
29 id: qrcanvasurl
30 width: units.gu(33)
31 height: units.gu(33)
32 }
33 }
34 tools: QrCodeToolBar{}
35}
036
=== added file 'qrcodes/PageQrWifi.qml'
--- qrcodes/PageQrWifi.qml 1970-01-01 00:00:00 +0000
+++ qrcodes/PageQrWifi.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,88 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import Ubuntu.Components.ListItems 0.1 as ListItem
4import Ubuntu.Components.Popups 0.1
5import QtQuick.LocalStorage 2.0
6
7import "../qreator"
8
9
10Page {
11 id: pageQrWifi
12 title: i18n.tr("Wireless access QR code")
13 visible: false
14
15 ListModel {
16 id: wifiSecurity
17 ListElement {
18 security: "WPA"
19 index: 0
20 }
21 ListElement {
22 security: "WEP"
23 index: 1
24 }
25 ListElement {
26 security: "No security"
27 index: 2
28 }
29 }
30
31 Column {
32 anchors.centerIn: parent
33 spacing: units.gu(4)
34
35 Column {
36 spacing: units.gu(2)
37
38 TextField {
39 id: textQrCodeSsid
40 placeholderText: i18n.tr("Type the wifi network's identifier")
41 hasClearButton: true
42 width: units.gu(33)
43
44 onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
45 }
46
47 Button {
48 id: selectorSecurity
49 //property int currencyIndex: 0
50 //property TextField input: inputFrom
51 //text: currencies.getCurrency(currencyIndex)
52 // open the popover
53 text: i18n.tr("Select security")
54 width: units.gu(33)
55 onClicked: PopupUtils.open(popoverWifiSecurity, selectorSecurity)
56 onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
57 }
58
59 Row {
60 spacing: units.gu(2)
61
62 TextField {
63 id: textQrCodePassword
64 placeholderText: i18n.tr("Type the wifi network's password")
65 hasClearButton: true
66 echoMode: switchPassword.checked ? TextInput.Normal : TextInput.Password
67 width: units.gu(33) - parent.spacing - switchPassword.width
68
69 onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
70 }
71
72 Switch {
73 id: switchPassword
74 checked: false
75
76 //onClicked:
77 }
78 }
79 }
80
81 QrCodeCanvas {
82 id: qrcanvaswifi
83 width: units.gu(33)
84 height: units.gu(33)
85 }
86 }
87 tools: QrCodeToolBar{}
88}
0\ No newline at end of file89\ No newline at end of file
190
=== added directory 'qreator'
=== modified file 'qreator-touch.qml'
--- qreator-touch.qml 2013-05-20 13:31:05 +0000
+++ qreator-touch.qml 2013-06-10 14:58:26 +0000
@@ -1,11 +1,14 @@
1import QtQuick 2.01import QtQuick 2.0
2import Ubuntu.Components 0.12import Ubuntu.Components 0.1
3
3import Ubuntu.Components.ListItems 0.1 as ListItem4import Ubuntu.Components.ListItems 0.1 as ListItem
4import Ubuntu.Components.Popups 0.15import Ubuntu.Components.Popups 0.1
5import QtGraphicalEffects 1.06import QtGraphicalEffects 1.0
67
8import "qreator"
9
7MainView {10MainView {
8 // We defint objectName for functional testing purposes11 // We define objectName for functional testing purposes
9 // (autopilot-qt5)12 // (autopilot-qt5)
10 objectName: "mainView"13 objectName: "mainView"
11 applicationName: "qreator-touch"14 applicationName: "qreator-touch"
@@ -14,302 +17,31 @@
14 width: units.gu(50)17 width: units.gu(50)
15 height: units.gu(75)18 height: units.gu(75)
1619
17 PageStack {20 property real pageSpacing: units.gu(6)
18 id: pageStack21
19 property real pageSpacing: units.gu(6)22 Tabs {
2023 id: tabs
21 anchors {24 Tab {
22 fill: parent25 objectName: "TabScanner"
23 }26 title: i18n.tr("Scan")
24 27 page: ScannerPage {
25 Component.onCompleted: push(pageRoot)28 id: scannerPage
2629 }
27 Page {30 }
28 id: pageRoot31 Tab {
29 title: i18n.tr("QR code type")32 objectName: "TabQreator"
30 visible: false33 title: i18n.tr("Create")
3134 page: CreatorPage {
32 Column {35 id: creatorPage
33 anchors.fill: parent36 }
34 ListItem.Standard {37 }
35 id: itemQrText38 Tab {
36 text: i18n.tr("Text")39 objectName: "TabHistory"
37 icon: Qt.resolvedUrl("img/text.png")40 title: i18n.tr("History")
38 onClicked: pageStack.push(pageQrText)41 page: HistoryPage {
39 progression: true42 id: historyPage
40 }43 }
41 ListItem.Standard {44 }
42 id: itemQrUrl45 }
43 text: i18n.tr("URL")
44 icon: Qt.resolvedUrl("img/url.png")
45 onClicked: pageStack.push(pageQrUrl)
46 progression: true
47 }
48 ListItem.Standard {
49 id: itemQrWifi
50 text: i18n.tr("Wifi")
51 icon: Qt.resolvedUrl("img/wifi.png")
52 onClicked: pageStack.push(pageQrWifi)
53 progression: true
54 }
55 }
56
57 tools: ToolbarActions {
58 Action {
59 text: i18n.tr("About")
60 iconSource: Qt.resolvedUrl("img/about.png")
61 onTriggered: pageStack.push(pageAbout)
62 }
63 Action {
64 text: i18n.tr("History")
65 iconSource: Qt.resolvedUrl("img/history.png")
66 onTriggered: pageStack.push(pageHistory)
67 }
68 Action {
69 text: i18n.tr("Settings")
70 iconSource: Qt.resolvedUrl("img/settings.png")
71 onTriggered: pageStack.push(pageSettings)
72 }
73 }
74 }
75
76 Page {
77 id: pageQrText
78 title: i18n.tr("Text QR code")
79 visible: false
80
81 Column {
82 anchors.centerIn: parent
83 spacing: pageStack.pageSpacing
84
85 TextArea {
86 id: textQrCodeText
87 placeholderText: i18n.tr("Type the text to encode")
88 autoSize: true
89 maximumLineCount: 5
90 width: units.gu(33)
91
92 onTextChanged: {qrcanvastext.requestQrCodePaint(text)}
93 }
94
95 QrCodeCanvas {
96 id: qrcanvastext
97 width: units.gu(33)
98 height: units.gu(33)
99 }
100 }
101
102 }
103
104 Page {
105 id: pageQrUrl
106 title: i18n.tr("URL QR code")
107 visible: false
108
109 Column {
110 anchors.centerIn: parent
111 spacing: pageStack.pageSpacing
112
113 TextField {
114 id: textQrCodeUrl
115 width: units.gu(33)
116 placeholderText: i18n.tr("Type the URL to encode")
117 hasClearButton: true
118
119 onTextChanged: {qrcanvasurl.requestQrCodePaint(text)}
120 }
121
122 QrCodeCanvas {
123 id: qrcanvasurl
124 width: units.gu(33)
125 height: units.gu(33)
126 }
127 }
128
129 //tools: Loader {sourceComponent: qrcodetoolbar}
130 //tools: qrcodetoolbar
131 }
132
133 Page {
134 id: pageQrWifi
135 title: i18n.tr("Wireless access QR code")
136 visible: false
137
138 ListModel {
139 id: wifiSecurity
140 ListElement {
141 security: "WPA"
142 index: 0
143 }
144 ListElement {
145 security: "WEP"
146 index: 1
147 }
148 ListElement {
149 security: "No security"
150 index: 2
151 }
152 }
153
154 Column {
155 anchors.centerIn: parent
156 spacing: units.gu(4)
157
158 Column {
159 spacing: units.gu(2)
160
161 TextField {
162 id: textQrCodeSsid
163 placeholderText: i18n.tr("Type the wifi network's identifier")
164 hasClearButton: true
165 width: units.gu(33)
166
167 onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
168 }
169
170 Button {
171 id: selectorSecurity
172 //property int currencyIndex: 0
173 //property TextField input: inputFrom
174 //text: currencies.getCurrency(currencyIndex)
175 // open the popover
176 text: i18n.tr("Select security")
177 width: units.gu(33)
178 onClicked: PopupUtils.open(popoverWifiSecurity, selectorSecurity)
179 onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
180 }
181
182 Row {
183 spacing: units.gu(2)
184
185 TextField {
186 id: textQrCodePassword
187 placeholderText: i18n.tr("Type the wifi network's password")
188 hasClearButton: true
189 echoMode: switchPassword.checked ? TextInput.Normal : TextInput.Password
190 width: units.gu(33) - parent.spacing - switchPassword.width
191
192 onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
193 }
194
195 Switch {
196 id: switchPassword
197 checked: false
198
199 //onClicked:
200 }
201 }
202 }
203
204 QrCodeCanvas {
205 id: qrcanvaswifi
206 width: units.gu(33)
207 height: units.gu(33)
208 }
209 }
210
211 }
212
213 Page {
214 id: pageSettings
215 title: i18n.tr("Settings")
216 visible: false
217
218 Column {
219
220 }
221 }
222
223 Page {
224 id: pageAbout
225 title: i18n.tr("About")
226 visible: false
227
228 Column {
229
230 }
231 }
232
233 Page {
234 id: pageHistory
235 title: i18n.tr("History")
236 visible: false
237
238 Column {
239
240 }
241 }
242
243 }
244
245 Component {
246 id: popoverWifiSecurity
247 Popover {
248 Column {
249 anchors {
250 top: parent.top
251 left: parent.left
252 right: parent.right
253 }
254 // Make sure the Popover doesn't flow off the screen
255 height: units.gu(33) //getHeight()
256
257 //units.gu(33) //wifiSecurity.count * wifiSecurity.get(0).height //units.gu(33)//root.height
258
259 function getHeight () {
260 var firstElement = wifiSecurity.get(0);
261 console.log(firstElement.security);
262 return wifiSecurity.count * firstElement.height;
263 }
264
265
266 // Header displaying title
267 ListItem.Header {
268 id: header
269 text: i18n.tr("Select security")
270 }
271 // List of security modes
272 ListView {
273 clip: true
274 width: parent.width
275 height: parent.height - header.height
276 model: wifiSecurity
277 delegate: ListItem.Standard {
278 text: security
279 onClicked: {
280 caller.text = security
281 //caller.input.update()
282 hide()
283 }
284 }
285 }
286 }
287 }
288 }
289
290
291 Component {
292 id: qrcodetoolbar
293 //Item {
294 ToolbarActions {
295 Action {
296 text: i18n.tr("Edit")
297 iconSource: Qt.resolvedUrl("img/about.png")
298 //onTriggered: pageStack.push(pageAbout)
299 }
300 Action {
301 text: i18n.tr("Save")
302 iconSource: Qt.resolvedUrl("img/history.png")
303 //onTriggered: pageStack.push(pageHistory)
304 }
305 Action {
306 text: i18n.tr("Share")
307 iconSource: Qt.resolvedUrl("img/settings.png")
308 //onTriggered: pageStack.push(pageSettings)
309 }
310 }
311 //}
312 }
313
314}46}
31547
31648
=== added file 'qreator/CreatorPage.qml'
--- qreator/CreatorPage.qml 1970-01-01 00:00:00 +0000
+++ qreator/CreatorPage.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,75 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import Ubuntu.Components.ListItems 0.1 as ListItem
4import Ubuntu.Components.Popups 0.1
5import QtGraphicalEffects 1.0
6
7import "../qrcodes/"
8
9PageStack {
10 id: pageStack
11
12 anchors {
13 fill: parent
14 }
15
16 Component.onCompleted: push(pageRoot)
17
18
19 // QR code datatypes
20 PageQrText {id: pageQrText}
21 PageQrUrl {id: pageQrUrl}
22 PageQrWifi {id: pageQrWifi}
23
24
25 // Overview of possible datatypes
26 Page {
27 id: pageRoot
28 title: i18n.tr("QR code type")
29 visible: false
30
31
32 Column {
33 anchors.fill: parent
34 ListItem.Standard {
35 id: itemQrText
36 text: i18n.tr("Text")
37 icon: Qt.resolvedUrl("../img/text.png")
38 onClicked: pageStack.push(pageQrText)
39 progression: true
40 }
41 ListItem.Standard {
42 id: itemQrUrl
43 text: i18n.tr("URL")
44 icon: Qt.resolvedUrl("../img/url.png")
45 onClicked: pageStack.push(pageQrUrl)
46 progression: true
47 }
48 ListItem.Standard {
49 id: itemQrWifi
50 text: i18n.tr("Wifi")
51 icon: Qt.resolvedUrl("../img/wifi.png")
52 onClicked: pageStack.push(pageQrWifi)
53 progression: true
54 }
55 }
56
57 tools: ToolbarActions {
58 Action {
59 text: i18n.tr("About")
60 iconSource: Qt.resolvedUrl("../img/about.png")
61 onTriggered: pageStack.push(pageAbout)
62 }
63 Action {
64 text: i18n.tr("History")
65 iconSource: Qt.resolvedUrl("../img/history.png")
66 onTriggered: pageStack.push(pageHistory)
67 }
68 Action {
69 text: i18n.tr("Settings")
70 iconSource: Qt.resolvedUrl("../img/settings.png")
71 onTriggered: pageStack.push(pageSettings)
72 }
73 }
74 }
75}
076
=== added file 'qreator/HistoryPage.qml'
--- qreator/HistoryPage.qml 1970-01-01 00:00:00 +0000
+++ qreator/HistoryPage.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,9 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3
4Page {
5 id: pageRoot
6 title: i18n.tr("Scan")
7 visible: false
8
9}
010
=== renamed file 'QrCodeCanvas.qml' => 'qreator/QrCodeCanvas.qml'
--- QrCodeCanvas.qml 2013-02-16 14:27:12 +0000
+++ qreator/QrCodeCanvas.qml 2013-06-10 14:58:26 +0000
@@ -1,7 +1,8 @@
1import QtQuick 2.01import QtQuick 2.0
2import QtGraphicalEffects 1.02import QtGraphicalEffects 1.0
3import Ubuntu.Components 0.13import Ubuntu.Components 0.1
4import "js/qrcode.js" as QrCode4
5import "../js/qrcode.js" as QrCode
56
6Item {7Item {
7 id: container8 id: container
89
=== added file 'qreator/QrCodeToolBar.qml'
--- qreator/QrCodeToolBar.qml 1970-01-01 00:00:00 +0000
+++ qreator/QrCodeToolBar.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,6 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import QtQuick.LocalStorage 2.0
4
5ToolbarActions {
6}
0\ No newline at end of file7\ No newline at end of file
18
=== added file 'qreator/ScannerPage.qml'
--- qreator/ScannerPage.qml 1970-01-01 00:00:00 +0000
+++ qreator/ScannerPage.qml 2013-06-10 14:58:26 +0000
@@ -0,0 +1,14 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3
4import Ubuntu.Components.ListItems 0.1 as ListItem
5import Ubuntu.Components.Popups 0.1
6import QtGraphicalEffects 1.0
7
8
9Page {
10 id: pageRoot
11 title: i18n.tr("Scan")
12 visible: false
13
14}

Subscribers

People subscribed via source and target branches

to all changes: