Merge lp:~nik90/checkbox/clean-qml-code into lp:~zyga/checkbox/touch-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Merge reported by: Zygmunt Krynicki
Merged at revision: not available
Proposed branch: lp:~nik90/checkbox/clean-qml-code
Merge into: lp:~zyga/checkbox/touch-app
Diff against target: 111 lines (+33/-32)
3 files modified
checkbox-touch/components/WelcomePage.qml (+28/-27)
checkbox-touch/main.qml (+4/-4)
checkbox-touch/manifest.json (+1/-1)
To merge this branch: bzr merge lp:~nik90/checkbox/clean-qml-code
Reviewer Review Type Date Requested Status
Zygmunt Krynicki Pending
Review via email: mp+230991@code.launchpad.net

Commit message

Made some small improvements to the QML Code.

Description of the change

Made some small improvements to the QML Code.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Hi

I've merged your changes in locally. Due to the way we work I cannot just bzr merge it directly as I want to preserve the logical flow of patches in the target branch.

Thank you for your time and for improving checkbox :-)

I have only one question:

92 - WelcomePage {
93 - id: welcomePage
94 - visible: false
95 + Component.onCompleted: {
96 + push(Qt.resolvedUrl("components/WelcomePage.qml"))
97 }
98 - Component.onCompleted: push(welcomePage)

Why is that better? I realize it's going to push a new component each time, right? (and only once we actually click on the start testing button)

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

I do that personally for several reasons,

1. It makes your main.qml file simple and precise.

2. Dynamic loading of components. Since welcomePage is in a separate file, it gets loaded only when you push it into the pagestack. Once you pop it (when moving to the next page), it gets unloaded from memory automatically.

This doesn't happen if you instantiate the welcomePage object in the main.qml file like it was done before.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Thanks.

I'll mark this merge request as merged now :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-touch/components/WelcomePage.qml'
2--- checkbox-touch/components/WelcomePage.qml 2014-08-15 14:30:38 +0000
3+++ checkbox-touch/components/WelcomePage.qml 2014-08-15 15:45:49 +0000
4@@ -23,42 +23,43 @@
5 import QtQuick 2.0
6 import Ubuntu.Components 1.1
7
8-
9 Page {
10+ id: welcomePage
11+
12 signal startTestingTriggered();
13
14 title: i18n.tr("System Testing")
15- anchors.bottomMargin: units.gu(1)
16- Column {
17- anchors.margins: units.gu(1)
18- spacing: units.gu(1)
19- id: column1
20+ visible: false
21+
22+ Label {
23+ id: welcomeText
24+
25 anchors {
26- fill: parent
27- }
28- Text {
29- id: welcomeText
30- text: i18n.tr("Welcome text")
31- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
32- width: parent.width
33- height: parent.height
34- verticalAlignment: Text.AlignVCenter
35- horizontalAlignment: Text.AlignHCenter
36- font.pixelSize: units.gu(4)
37- }
38+ top: parent.top
39+ left: parent.left
40+ right: parent.right
41+ bottom: startTestButton.top
42+ }
43+
44+ text: i18n.tr("Welcome text")
45+ font.pixelSize: units.gu(4)
46+ verticalAlignment: Text.AlignVCenter
47+ horizontalAlignment: Text.AlignHCenter
48+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
49 }
50+
51 Button {
52+ id: startTestButton
53+
54+ anchors {
55+ left: parent.left
56+ right: parent.right
57+ bottom: parent.bottom
58+ margins: units.gu(2)
59+ }
60+
61 color: UbuntuColors.green
62 text: i18n.tr("Start Testing")
63- /* This is just to add some spacing around the button. I'm not sure if
64- * that's *the* way to do it though */
65- anchors.right: parent.right
66- anchors.rightMargin: units.gu(2)
67- anchors.left: parent.left
68- anchors.leftMargin: units.gu(2)
69- anchors.bottom: parent.bottom
70- anchors.bottomMargin: units.gu(1)
71- transformOrigin: Item.Center
72 onClicked: startTestingTriggered();
73 }
74 }
75
76=== modified file 'checkbox-touch/main.qml'
77--- checkbox-touch/main.qml 2014-08-15 14:30:38 +0000
78+++ checkbox-touch/main.qml 2014-08-15 15:45:49 +0000
79@@ -44,6 +44,8 @@
80 width: units.gu(100)
81 height: units.gu(75)
82
83+ useDeprecatedToolbar: false
84+
85 // High-level object representing the full checkbox testing stack
86 CheckboxStack {
87 onStackReady: {
88@@ -55,10 +57,8 @@
89
90 PageStack {
91 id: pageStack
92- WelcomePage {
93- id: welcomePage
94- visible: false
95+ Component.onCompleted: {
96+ push(Qt.resolvedUrl("components/WelcomePage.qml"))
97 }
98- Component.onCompleted: push(welcomePage)
99 }
100 }
101
102=== modified file 'checkbox-touch/manifest.json'
103--- checkbox-touch/manifest.json 2014-08-12 19:01:04 +0000
104+++ checkbox-touch/manifest.json 2014-08-15 15:45:49 +0000
105@@ -12,4 +12,4 @@
106 "name": "com.canonical.certification.checkbox-touch",
107 "title": "Checkbox Touch",
108 "version": "0.2"
109-}
110+}
111\ No newline at end of file

Subscribers

People subscribed via source and target branches