Merge lp:~fboucault/ubuntu-ui-toolkit/gallery_cleaner_responsiveness into lp:ubuntu-ui-toolkit

Proposed by Florian Boucault
Status: Merged
Approved by: Cris Dywan
Approved revision: 903
Merged at revision: 905
Proposed branch: lp:~fboucault/ubuntu-ui-toolkit/gallery_cleaner_responsiveness
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 198 lines (+102/-65)
1 file modified
examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml (+102/-65)
To merge this branch: bzr merge lp:~fboucault/ubuntu-ui-toolkit/gallery_cleaner_responsiveness
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Francis Ginther (community) Approve
Zsombor Egri Approve
Tim Peeters Pending
Review via email: mp+200727@code.launchpad.net

Commit message

Ubuntu UI Toolkit Gallery: reimplemented in a cleaner way the responsiveness of the UI. That will allow for working right-to-left support.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Resize the window to activate narrow state. Then resize it back to re-activate wide state. Click on the last visible item in the ListView -> Toolbar appears.

This hasn't been there till now.

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

> Resize the window to activate narrow state. Then resize it back to re-activate
> wide state. Click on the last visible item in the ListView -> Toolbar appears.
>
> This hasn't been there till now.

So it ended up not to be caused by this MR, so I'll approve it. Nice work!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

This can be re-approved, the autolanding failed due to a CI issue.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml'
2--- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2013-11-11 15:05:49 +0000
3+++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2014-01-07 19:52:24 +0000
4@@ -30,92 +30,129 @@
5 width: units.gu(120)
6 height: units.gu(75)
7
8- property bool wideAspect: width >= units.gu(80)
9 /*
10 This property enables the application to change orientation
11 when the device is rotated. The default is false.
12 */
13 automaticOrientation: true
14
15- state: wideAspect ? "wide" : ""
16+ state: width >= units.gu(80) ? "wide" : "narrow"
17 states: [
18 State {
19+ name: "narrow"
20+ StateChangeScript {
21+ script: {
22+ pageStack.push(mainPage);
23+ if (selectedWidget) {
24+ pageStack.push(contentPage);
25+ }
26+ }
27+ }
28+ PropertyChanges {
29+ target: mainPage
30+ flickable: widgetList
31+ }
32+ PropertyChanges {
33+ target: contentPage
34+ flickable: contentLoader.item ? contentLoader.item.flickable : null
35+ }
36+ },
37+ State {
38 name: "wide"
39+ StateChangeScript {
40+ script: {
41+ pageStack.clear();
42+
43+ /* When pushing Pages into a PageStack they are reparented
44+ to internally created PageWrappers. This undoes it as to
45+ allow us to anchor the Pages freely again.
46+ */
47+ mainPage.parent = gallery;
48+ contentPage.parent = gallery;
49+ }
50+ }
51 PropertyChanges {
52- target: pageStack
53+ target: mainPage
54 width: units.gu(40)
55- anchors {
56- fill: null
57- top: parent.top
58- bottom: parent.bottom
59- }
60+ clip: true
61+ }
62+ AnchorChanges {
63+ target: mainPage
64+ anchors.right: undefined
65 }
66 PropertyChanges {
67 target: contentPage
68- x: pageStack.width
69- width: pageStack.parent.width - x
70- anchors {
71- left: undefined
72- right: undefined
73- bottom: undefined
74- }
75 clip: true
76- visible: true
77+ }
78+ AnchorChanges {
79+ target: contentPage
80+ anchors.left: mainPage.right
81 }
82 }
83 ]
84
85+
86+ property var selectedWidget
87+
88+ Page {
89+ id: mainPage
90+
91+ title: "Ubuntu UI Toolkit"
92+ /* Page internally sets the topMargin of its flickable to account for
93+ the height of the header. Undo it when unsetting the flickable.
94+ */
95+ onFlickableChanged: if (!flickable) widgetList.topMargin = 0;
96+
97+ Rectangle {
98+ color: Qt.rgba(0.0, 0.0, 0.0, 0.01)
99+ anchors.fill: parent
100+
101+ ListView {
102+ id: widgetList
103+ objectName: "widgetList"
104+ anchors.fill: parent
105+ model: widgetsModel
106+ delegate: ListItem.Standard {
107+ text: model.label
108+ enabled: model.source != ""
109+ progression: true
110+ selected: enabled && selectedWidget == model
111+ onClicked: {
112+ selectedWidget = model;
113+ if (gallery.state == "narrow") {
114+ pageStack.push(contentPage);
115+ }
116+ }
117+ }
118+ }
119+ }
120+ }
121+
122+ Page {
123+ id: contentPage
124+
125+ title: selectedWidget ? selectedWidget.label : ""
126+ /* Page internally sets the topMargin of its flickable to account for
127+ the height of the header. Undo it when unsetting the flickable.
128+ */
129+ onFlickableChanged: if (!flickable && contentLoader.item) contentLoader.item.flickable.topMargin = 0;
130+ onActiveChanged: if (gallery.state == "narrow" && !active) {
131+ selectedWidget = null;
132+ }
133+
134+ ToolbarItems{ id: defTools}
135+ tools: contentLoader.item && contentLoader.item.tools ? contentLoader.item.tools : defTools
136+
137+ Loader {
138+ id: contentLoader
139+ objectName: "contentLoader"
140+ anchors.fill: parent
141+ source: selectedWidget ? selectedWidget.source : ""
142+ }
143+ }
144+
145 PageStack {
146 id: pageStack
147- Component.onCompleted: push(mainPage)
148-
149- Page {
150- id: mainPage
151- title: "Ubuntu UI Toolkit"
152- visible: false
153- flickable: widgetList
154-
155- Rectangle {
156- color: Qt.rgba(0.0, 0.0, 0.0, 0.01)
157- anchors.fill: parent
158-
159- ListView {
160- id: widgetList
161- objectName: "widgetList"
162- anchors.fill: parent
163- model: widgetsModel
164- delegate: ListItem.Standard {
165- text: model.label
166- enabled: model.source != ""
167- progression: true
168- selected: enabled && contentPage.source == Qt.resolvedUrl(model.source)
169- onClicked: {
170- contentPage.title = model.label;
171- contentPage.source = model.source;
172- if (!wideAspect) {
173- pageStack.push(contentPage);
174- }
175- }
176- }
177- }
178- }
179- }
180-
181- Page {
182- id: contentPage
183- visible: false
184- property alias source: contentLoader.source
185- onActiveChanged: if (!active) source = ""
186- ToolbarItems{ id: defTools}
187- tools: contentLoader.item && contentLoader.item.tools ? contentLoader.item.tools : defTools
188- flickable: contentLoader.item && !wideAspect ? contentLoader.item.flickable : null
189-
190- Loader {
191- id: contentLoader
192- objectName: "contentLoader"
193- anchors.fill: parent
194- }
195- }
196 }
197
198 WidgetsModel {

Subscribers

People subscribed via source and target branches

to status/vote changes: