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
1=== added directory 'qrcodes'
2=== added file 'qrcodes/PageQrText.qml'
3--- qrcodes/PageQrText.qml 1970-01-01 00:00:00 +0000
4+++ qrcodes/PageQrText.qml 2013-06-10 14:58:26 +0000
5@@ -0,0 +1,38 @@
6+import QtQuick 2.0
7+import Ubuntu.Components 0.1
8+import Ubuntu.Components.ListItems 0.1 as ListItem
9+import Ubuntu.Components.Popups 0.1
10+import QtQuick.LocalStorage 2.0
11+
12+import "../qreator"
13+
14+import "../js/qrcode.js" as Qreator
15+
16+Page {
17+ id: pageQrText
18+ title: i18n.tr("Text QR code")
19+ visible: false
20+
21+ Column {
22+ anchors.centerIn: parent
23+ spacing: root.pageSpacing
24+
25+ TextArea {
26+ id: textQrCodeText
27+ placeholderText: i18n.tr("Type the text to encode")
28+ autoSize: true
29+ maximumLineCount: 5
30+ width: units.gu(33)
31+
32+ onTextChanged: {qrcanvastext.requestQrCodePaint(text)}
33+ }
34+
35+ QrCodeCanvas {
36+ id: qrcanvastext
37+ width: units.gu(33)
38+ height: units.gu(33)
39+ }
40+ }
41+ tools: QrCodeToolBar{}
42+}
43+
44
45=== added file 'qrcodes/PageQrUrl.qml'
46--- qrcodes/PageQrUrl.qml 1970-01-01 00:00:00 +0000
47+++ qrcodes/PageQrUrl.qml 2013-06-10 14:58:26 +0000
48@@ -0,0 +1,35 @@
49+import QtQuick 2.0
50+import Ubuntu.Components 0.1
51+import Ubuntu.Components.ListItems 0.1 as ListItem
52+import Ubuntu.Components.Popups 0.1
53+import QtQuick.LocalStorage 2.0
54+
55+import "../qreator"
56+
57+
58+Page {
59+ id: pageQrUrl
60+ title: i18n.tr("URL QR code")
61+ visible: false
62+
63+ Column {
64+ anchors.centerIn: parent
65+ spacing: root.pageSpacing
66+
67+ TextField {
68+ id: textQrCodeUrl
69+ width: units.gu(33)
70+ placeholderText: i18n.tr("Type the URL to encode")
71+ hasClearButton: true
72+
73+ onTextChanged: {qrcanvasurl.requestQrCodePaint(text)}
74+ }
75+
76+ QrCodeCanvas {
77+ id: qrcanvasurl
78+ width: units.gu(33)
79+ height: units.gu(33)
80+ }
81+ }
82+ tools: QrCodeToolBar{}
83+}
84
85=== added file 'qrcodes/PageQrWifi.qml'
86--- qrcodes/PageQrWifi.qml 1970-01-01 00:00:00 +0000
87+++ qrcodes/PageQrWifi.qml 2013-06-10 14:58:26 +0000
88@@ -0,0 +1,88 @@
89+import QtQuick 2.0
90+import Ubuntu.Components 0.1
91+import Ubuntu.Components.ListItems 0.1 as ListItem
92+import Ubuntu.Components.Popups 0.1
93+import QtQuick.LocalStorage 2.0
94+
95+import "../qreator"
96+
97+
98+Page {
99+ id: pageQrWifi
100+ title: i18n.tr("Wireless access QR code")
101+ visible: false
102+
103+ ListModel {
104+ id: wifiSecurity
105+ ListElement {
106+ security: "WPA"
107+ index: 0
108+ }
109+ ListElement {
110+ security: "WEP"
111+ index: 1
112+ }
113+ ListElement {
114+ security: "No security"
115+ index: 2
116+ }
117+ }
118+
119+ Column {
120+ anchors.centerIn: parent
121+ spacing: units.gu(4)
122+
123+ Column {
124+ spacing: units.gu(2)
125+
126+ TextField {
127+ id: textQrCodeSsid
128+ placeholderText: i18n.tr("Type the wifi network's identifier")
129+ hasClearButton: true
130+ width: units.gu(33)
131+
132+ onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
133+ }
134+
135+ Button {
136+ id: selectorSecurity
137+ //property int currencyIndex: 0
138+ //property TextField input: inputFrom
139+ //text: currencies.getCurrency(currencyIndex)
140+ // open the popover
141+ text: i18n.tr("Select security")
142+ width: units.gu(33)
143+ onClicked: PopupUtils.open(popoverWifiSecurity, selectorSecurity)
144+ onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
145+ }
146+
147+ Row {
148+ spacing: units.gu(2)
149+
150+ TextField {
151+ id: textQrCodePassword
152+ placeholderText: i18n.tr("Type the wifi network's password")
153+ hasClearButton: true
154+ echoMode: switchPassword.checked ? TextInput.Normal : TextInput.Password
155+ width: units.gu(33) - parent.spacing - switchPassword.width
156+
157+ onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
158+ }
159+
160+ Switch {
161+ id: switchPassword
162+ checked: false
163+
164+ //onClicked:
165+ }
166+ }
167+ }
168+
169+ QrCodeCanvas {
170+ id: qrcanvaswifi
171+ width: units.gu(33)
172+ height: units.gu(33)
173+ }
174+ }
175+ tools: QrCodeToolBar{}
176+}
177\ No newline at end of file
178
179=== added directory 'qreator'
180=== modified file 'qreator-touch.qml'
181--- qreator-touch.qml 2013-05-20 13:31:05 +0000
182+++ qreator-touch.qml 2013-06-10 14:58:26 +0000
183@@ -1,11 +1,14 @@
184 import QtQuick 2.0
185 import Ubuntu.Components 0.1
186+
187 import Ubuntu.Components.ListItems 0.1 as ListItem
188 import Ubuntu.Components.Popups 0.1
189 import QtGraphicalEffects 1.0
190
191+import "qreator"
192+
193 MainView {
194- // We defint objectName for functional testing purposes
195+ // We define objectName for functional testing purposes
196 // (autopilot-qt5)
197 objectName: "mainView"
198 applicationName: "qreator-touch"
199@@ -14,302 +17,31 @@
200 width: units.gu(50)
201 height: units.gu(75)
202
203- PageStack {
204- id: pageStack
205- property real pageSpacing: units.gu(6)
206-
207- anchors {
208- fill: parent
209- }
210-
211- Component.onCompleted: push(pageRoot)
212-
213- Page {
214- id: pageRoot
215- title: i18n.tr("QR code type")
216- visible: false
217-
218- Column {
219- anchors.fill: parent
220- ListItem.Standard {
221- id: itemQrText
222- text: i18n.tr("Text")
223- icon: Qt.resolvedUrl("img/text.png")
224- onClicked: pageStack.push(pageQrText)
225- progression: true
226- }
227- ListItem.Standard {
228- id: itemQrUrl
229- text: i18n.tr("URL")
230- icon: Qt.resolvedUrl("img/url.png")
231- onClicked: pageStack.push(pageQrUrl)
232- progression: true
233- }
234- ListItem.Standard {
235- id: itemQrWifi
236- text: i18n.tr("Wifi")
237- icon: Qt.resolvedUrl("img/wifi.png")
238- onClicked: pageStack.push(pageQrWifi)
239- progression: true
240- }
241- }
242-
243- tools: ToolbarActions {
244- Action {
245- text: i18n.tr("About")
246- iconSource: Qt.resolvedUrl("img/about.png")
247- onTriggered: pageStack.push(pageAbout)
248- }
249- Action {
250- text: i18n.tr("History")
251- iconSource: Qt.resolvedUrl("img/history.png")
252- onTriggered: pageStack.push(pageHistory)
253- }
254- Action {
255- text: i18n.tr("Settings")
256- iconSource: Qt.resolvedUrl("img/settings.png")
257- onTriggered: pageStack.push(pageSettings)
258- }
259- }
260- }
261-
262- Page {
263- id: pageQrText
264- title: i18n.tr("Text QR code")
265- visible: false
266-
267- Column {
268- anchors.centerIn: parent
269- spacing: pageStack.pageSpacing
270-
271- TextArea {
272- id: textQrCodeText
273- placeholderText: i18n.tr("Type the text to encode")
274- autoSize: true
275- maximumLineCount: 5
276- width: units.gu(33)
277-
278- onTextChanged: {qrcanvastext.requestQrCodePaint(text)}
279- }
280-
281- QrCodeCanvas {
282- id: qrcanvastext
283- width: units.gu(33)
284- height: units.gu(33)
285- }
286- }
287-
288- }
289-
290- Page {
291- id: pageQrUrl
292- title: i18n.tr("URL QR code")
293- visible: false
294-
295- Column {
296- anchors.centerIn: parent
297- spacing: pageStack.pageSpacing
298-
299- TextField {
300- id: textQrCodeUrl
301- width: units.gu(33)
302- placeholderText: i18n.tr("Type the URL to encode")
303- hasClearButton: true
304-
305- onTextChanged: {qrcanvasurl.requestQrCodePaint(text)}
306- }
307-
308- QrCodeCanvas {
309- id: qrcanvasurl
310- width: units.gu(33)
311- height: units.gu(33)
312- }
313- }
314-
315- //tools: Loader {sourceComponent: qrcodetoolbar}
316- //tools: qrcodetoolbar
317- }
318-
319- Page {
320- id: pageQrWifi
321- title: i18n.tr("Wireless access QR code")
322- visible: false
323-
324- ListModel {
325- id: wifiSecurity
326- ListElement {
327- security: "WPA"
328- index: 0
329- }
330- ListElement {
331- security: "WEP"
332- index: 1
333- }
334- ListElement {
335- security: "No security"
336- index: 2
337- }
338- }
339-
340- Column {
341- anchors.centerIn: parent
342- spacing: units.gu(4)
343-
344- Column {
345- spacing: units.gu(2)
346-
347- TextField {
348- id: textQrCodeSsid
349- placeholderText: i18n.tr("Type the wifi network's identifier")
350- hasClearButton: true
351- width: units.gu(33)
352-
353- onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
354- }
355-
356- Button {
357- id: selectorSecurity
358- //property int currencyIndex: 0
359- //property TextField input: inputFrom
360- //text: currencies.getCurrency(currencyIndex)
361- // open the popover
362- text: i18n.tr("Select security")
363- width: units.gu(33)
364- onClicked: PopupUtils.open(popoverWifiSecurity, selectorSecurity)
365- onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
366- }
367-
368- Row {
369- spacing: units.gu(2)
370-
371- TextField {
372- id: textQrCodePassword
373- placeholderText: i18n.tr("Type the wifi network's password")
374- hasClearButton: true
375- echoMode: switchPassword.checked ? TextInput.Normal : TextInput.Password
376- width: units.gu(33) - parent.spacing - switchPassword.width
377-
378- onTextChanged: {qrcanvaswifi.requestQrCodePaint(text)}
379- }
380-
381- Switch {
382- id: switchPassword
383- checked: false
384-
385- //onClicked:
386- }
387- }
388- }
389-
390- QrCodeCanvas {
391- id: qrcanvaswifi
392- width: units.gu(33)
393- height: units.gu(33)
394- }
395- }
396-
397- }
398-
399- Page {
400- id: pageSettings
401- title: i18n.tr("Settings")
402- visible: false
403-
404- Column {
405-
406- }
407- }
408-
409- Page {
410- id: pageAbout
411- title: i18n.tr("About")
412- visible: false
413-
414- Column {
415-
416- }
417- }
418-
419- Page {
420- id: pageHistory
421- title: i18n.tr("History")
422- visible: false
423-
424- Column {
425-
426- }
427- }
428-
429- }
430-
431- Component {
432- id: popoverWifiSecurity
433- Popover {
434- Column {
435- anchors {
436- top: parent.top
437- left: parent.left
438- right: parent.right
439- }
440- // Make sure the Popover doesn't flow off the screen
441- height: units.gu(33) //getHeight()
442-
443- //units.gu(33) //wifiSecurity.count * wifiSecurity.get(0).height //units.gu(33)//root.height
444-
445- function getHeight () {
446- var firstElement = wifiSecurity.get(0);
447- console.log(firstElement.security);
448- return wifiSecurity.count * firstElement.height;
449- }
450-
451-
452- // Header displaying title
453- ListItem.Header {
454- id: header
455- text: i18n.tr("Select security")
456- }
457- // List of security modes
458- ListView {
459- clip: true
460- width: parent.width
461- height: parent.height - header.height
462- model: wifiSecurity
463- delegate: ListItem.Standard {
464- text: security
465- onClicked: {
466- caller.text = security
467- //caller.input.update()
468- hide()
469- }
470- }
471- }
472- }
473- }
474- }
475-
476-
477- Component {
478- id: qrcodetoolbar
479- //Item {
480- ToolbarActions {
481- Action {
482- text: i18n.tr("Edit")
483- iconSource: Qt.resolvedUrl("img/about.png")
484- //onTriggered: pageStack.push(pageAbout)
485- }
486- Action {
487- text: i18n.tr("Save")
488- iconSource: Qt.resolvedUrl("img/history.png")
489- //onTriggered: pageStack.push(pageHistory)
490- }
491- Action {
492- text: i18n.tr("Share")
493- iconSource: Qt.resolvedUrl("img/settings.png")
494- //onTriggered: pageStack.push(pageSettings)
495- }
496- }
497- //}
498- }
499-
500+ property real pageSpacing: units.gu(6)
501+
502+ Tabs {
503+ id: tabs
504+ Tab {
505+ objectName: "TabScanner"
506+ title: i18n.tr("Scan")
507+ page: ScannerPage {
508+ id: scannerPage
509+ }
510+ }
511+ Tab {
512+ objectName: "TabQreator"
513+ title: i18n.tr("Create")
514+ page: CreatorPage {
515+ id: creatorPage
516+ }
517+ }
518+ Tab {
519+ objectName: "TabHistory"
520+ title: i18n.tr("History")
521+ page: HistoryPage {
522+ id: historyPage
523+ }
524+ }
525+ }
526 }
527
528
529=== added file 'qreator/CreatorPage.qml'
530--- qreator/CreatorPage.qml 1970-01-01 00:00:00 +0000
531+++ qreator/CreatorPage.qml 2013-06-10 14:58:26 +0000
532@@ -0,0 +1,75 @@
533+import QtQuick 2.0
534+import Ubuntu.Components 0.1
535+import Ubuntu.Components.ListItems 0.1 as ListItem
536+import Ubuntu.Components.Popups 0.1
537+import QtGraphicalEffects 1.0
538+
539+import "../qrcodes/"
540+
541+PageStack {
542+ id: pageStack
543+
544+ anchors {
545+ fill: parent
546+ }
547+
548+ Component.onCompleted: push(pageRoot)
549+
550+
551+ // QR code datatypes
552+ PageQrText {id: pageQrText}
553+ PageQrUrl {id: pageQrUrl}
554+ PageQrWifi {id: pageQrWifi}
555+
556+
557+ // Overview of possible datatypes
558+ Page {
559+ id: pageRoot
560+ title: i18n.tr("QR code type")
561+ visible: false
562+
563+
564+ Column {
565+ anchors.fill: parent
566+ ListItem.Standard {
567+ id: itemQrText
568+ text: i18n.tr("Text")
569+ icon: Qt.resolvedUrl("../img/text.png")
570+ onClicked: pageStack.push(pageQrText)
571+ progression: true
572+ }
573+ ListItem.Standard {
574+ id: itemQrUrl
575+ text: i18n.tr("URL")
576+ icon: Qt.resolvedUrl("../img/url.png")
577+ onClicked: pageStack.push(pageQrUrl)
578+ progression: true
579+ }
580+ ListItem.Standard {
581+ id: itemQrWifi
582+ text: i18n.tr("Wifi")
583+ icon: Qt.resolvedUrl("../img/wifi.png")
584+ onClicked: pageStack.push(pageQrWifi)
585+ progression: true
586+ }
587+ }
588+
589+ tools: ToolbarActions {
590+ Action {
591+ text: i18n.tr("About")
592+ iconSource: Qt.resolvedUrl("../img/about.png")
593+ onTriggered: pageStack.push(pageAbout)
594+ }
595+ Action {
596+ text: i18n.tr("History")
597+ iconSource: Qt.resolvedUrl("../img/history.png")
598+ onTriggered: pageStack.push(pageHistory)
599+ }
600+ Action {
601+ text: i18n.tr("Settings")
602+ iconSource: Qt.resolvedUrl("../img/settings.png")
603+ onTriggered: pageStack.push(pageSettings)
604+ }
605+ }
606+ }
607+}
608
609=== added file 'qreator/HistoryPage.qml'
610--- qreator/HistoryPage.qml 1970-01-01 00:00:00 +0000
611+++ qreator/HistoryPage.qml 2013-06-10 14:58:26 +0000
612@@ -0,0 +1,9 @@
613+import QtQuick 2.0
614+import Ubuntu.Components 0.1
615+
616+Page {
617+ id: pageRoot
618+ title: i18n.tr("Scan")
619+ visible: false
620+
621+}
622
623=== renamed file 'QrCodeCanvas.qml' => 'qreator/QrCodeCanvas.qml'
624--- QrCodeCanvas.qml 2013-02-16 14:27:12 +0000
625+++ qreator/QrCodeCanvas.qml 2013-06-10 14:58:26 +0000
626@@ -1,7 +1,8 @@
627 import QtQuick 2.0
628 import QtGraphicalEffects 1.0
629 import Ubuntu.Components 0.1
630-import "js/qrcode.js" as QrCode
631+
632+import "../js/qrcode.js" as QrCode
633
634 Item {
635 id: container
636
637=== added file 'qreator/QrCodeToolBar.qml'
638--- qreator/QrCodeToolBar.qml 1970-01-01 00:00:00 +0000
639+++ qreator/QrCodeToolBar.qml 2013-06-10 14:58:26 +0000
640@@ -0,0 +1,6 @@
641+import QtQuick 2.0
642+import Ubuntu.Components 0.1
643+import QtQuick.LocalStorage 2.0
644+
645+ToolbarActions {
646+}
647\ No newline at end of file
648
649=== added file 'qreator/ScannerPage.qml'
650--- qreator/ScannerPage.qml 1970-01-01 00:00:00 +0000
651+++ qreator/ScannerPage.qml 2013-06-10 14:58:26 +0000
652@@ -0,0 +1,14 @@
653+import QtQuick 2.0
654+import Ubuntu.Components 0.1
655+
656+import Ubuntu.Components.ListItems 0.1 as ListItem
657+import Ubuntu.Components.Popups 0.1
658+import QtGraphicalEffects 1.0
659+
660+
661+Page {
662+ id: pageRoot
663+ title: i18n.tr("Scan")
664+ visible: false
665+
666+}

Subscribers

People subscribed via source and target branches

to all changes: