Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-uitk13-listitemlayout into lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-uitk13

Proposed by Stefano Verzegnassi
Status: Superseded
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-uitk13-listitemlayout
Merge into: lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-uitk13
Diff against target: 317 lines (+100/-100)
7 files modified
src/app/qml/common/SubtitledListItem.qml (+11/-18)
src/app/qml/documentPage/DocumentDelegateActions.qml (+0/-2)
src/app/qml/documentPage/DocumentListDelegate.qml (+48/-43)
src/app/qml/documentPage/SectionHeader.qml (+2/-2)
src/app/qml/loView/LOViewDefaultHeader.qml (+1/-0)
src/app/qml/loView/PartsView.qml (+20/-12)
src/app/qml/pdfView/PdfContentsPage.qml (+18/-23)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-uitk13-listitemlayout
Reviewer Review Type Date Requested Status
Roman Shchekin (community) Approve
Review via email: mp+275541@code.launchpad.net

This proposal has been superseded by a proposal from 2015-11-27.

Commit message

Use UITK 1.3 ListItemLayout

Description of the change

Use ListItemLayout to provide a proper layouting inside ListItem.

*** REFERENCES
ListItemLayout example:
http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/1665/examples/ubuntu-ui-toolkit-gallery/ListItemLayouts.qml

UI/UX ListItem slots specifications: (Ask James for the authorization to view the document)
https://docs.google.com/document/d/1rNxpbyA0rDd6fQ6cgNmonQXysCH002q9W9pUOP4ozj4/edit?usp=sharing_eid&ts=561fb6a2

To post a comment you must log in.
198. By Stefano Verzegnassi

Fixing ZoomSelector pt.1

199. By Stefano Verzegnassi

Fixed Autopilot 'test_toc' test

200. By Stefano Verzegnassi

Added a comment about PDFView's 'GoToPage' dialog test failing

201. By Stefano Verzegnassi

Reverted Autopilot tests fixes - they have been moved in another branch

202. By Stefano Verzegnassi

Merged prerequisite 'reboot-uitk13' branch

203. By Stefano Verzegnassi

Merged prerequisite branch

Revision history for this message
Roman Shchekin (mrqtros) wrote :

Looks ok for me!
(But "slots" API looks little bit weird)

review: Approve
Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

> (But "slots" API looks little bit weird)

Yep.

The 'SlotsLayout.position' attached property is not that bad though, since it's still intuitive enough.

What really scares me is:

    'y: listItemLayout.mainSlot.y + listItemLayout.title.y +
    listItemLayout.title.baselineOffset - baselineOffset'

Which is definitely a strange way to define a 'Column' layout inside a slot.

=========================
For reference, the code I studied comes from the UI Toolkit examples:

http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/examples/ubuntu-ui-toolkit-gallery/ListItemLayouts.qml

Unmerged revisions

203. By Stefano Verzegnassi

Merged prerequisite branch

202. By Stefano Verzegnassi

Merged prerequisite 'reboot-uitk13' branch

201. By Stefano Verzegnassi

Reverted Autopilot tests fixes - they have been moved in another branch

200. By Stefano Verzegnassi

Added a comment about PDFView's 'GoToPage' dialog test failing

199. By Stefano Verzegnassi

Fixed Autopilot 'test_toc' test

198. By Stefano Verzegnassi

Fixing ZoomSelector pt.1

197. By Stefano Verzegnassi

Updated to ListItemLayout. Still some TODO/FIXME task.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/common/SubtitledListItem.qml'
2--- src/app/qml/common/SubtitledListItem.qml 2015-10-23 11:23:43 +0000
3+++ src/app/qml/common/SubtitledListItem.qml 2015-11-13 21:35:42 +0000
4@@ -19,23 +19,16 @@
5
6 ListItem {
7 id: listItemSubtitled
8- property alias text: mainLabel.text
9- property alias subText: subLabel.text
10-
11- Column {
12- anchors {
13- left: parent.left; right: parent.right
14- margins: units.gu(2)
15- verticalCenter: parent.verticalCenter
16- }
17-
18- Label {
19- id: mainLabel
20- color: UbuntuColors.midAubergine
21- }
22- Label {
23- id: subLabel
24- textSize: Label.Small
25- }
26+ property string text
27+ property string subText
28+
29+ height: listItemLayout.height
30+
31+ ListItemLayout {
32+ id: listItemLayout
33+
34+ title.text: listItemSubtitled.text
35+ title.color: UbuntuColors.midAubergine
36+ subtitle.text: listItemSubtitled.subText
37 }
38 }
39
40=== modified file 'src/app/qml/documentPage/DocumentDelegateActions.qml'
41--- src/app/qml/documentPage/DocumentDelegateActions.qml 2015-10-23 11:19:19 +0000
42+++ src/app/qml/documentPage/DocumentDelegateActions.qml 2015-11-13 21:35:42 +0000
43@@ -18,8 +18,6 @@
44 import Ubuntu.Components 1.3
45 import Ubuntu.Components.Popups 1.3
46
47-// TODO: Probably requires some change in order to work with latest ListItem 1.2
48-
49 QtObject {
50 property list<Action> leadingActions: [
51 Action {
52
53=== modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
54--- src/app/qml/documentPage/DocumentListDelegate.qml 2015-10-23 11:23:43 +0000
55+++ src/app/qml/documentPage/DocumentListDelegate.qml 2015-11-13 21:35:42 +0000
56@@ -21,59 +21,64 @@
57
58 import "../common/utils.js" as Utils
59
60-// TODO: Ask for a review of this component to the design team
61-
62 ListItem {
63 id: listDelegate
64 height: units.gu(9)
65 leadingActions: ListItemActions { actions: documentDelegateActions.leadingActions }
66 trailingActions: ListItemActions { actions: documentDelegateActions.trailingActions }
67
68- RowLayout {
69- spacing: units.gu(2)
70- anchors {
71- fill: parent; margins: units.gu(1)
72- leftMargin: units.gu(2)
73- rightMargin: units.gu(2)
74- }
75-
76+ /*** UITK 1.3 spec: Three slot layout (B-A-C)
77+ ________________________________________
78+ | | | |
79+ | B | A | C |
80+ |___|________________________________|___|
81+
82+ *********************************************/
83+
84+ ListItemLayout {
85+ id: listItemLayout
86+ anchors.fill: parent
87+
88+ /* UITK 1.3 specs: Slot B */
89 Icon {
90+ SlotsLayout.position: SlotsLayout.Leading
91 name: Utils.getIconNameFromMimetype(model.mimetype)
92- Layout.preferredWidth: height
93- Layout.preferredHeight: units.gu(5)
94- }
95-
96- Column {
97- Layout.fillWidth: true
98-
99- RowLayout {
100- width: parent.width
101- Label {
102- text: model.name
103- //wrapMode: Text.Wrap
104- elide: Text.ElideRight
105- color: UbuntuColors.midAubergine
106- Layout.fillWidth: true
107- }
108- Label {
109- text: Utils.printSize(i18n, model.size)
110- textSize: Label.Small
111- }
112+ width: units.gu(5); height: width
113+ }
114+
115+ /* UITK 1.3 specs: Slot A */
116+ title {
117+ text: model.name
118+ elide: Text.ElideRight
119+ color: UbuntuColors.midAubergine
120+ }
121+
122+ subtitle.text: internal.formattedDateTime()
123+
124+ /* UITK 1.3 specs: Slot C */
125+ Item {
126+ SlotsLayout.position: SlotsLayout.Trailing
127+ SlotsLayout.overrideVerticalPositioning: true
128+ width: Math.max(sizeLabel.width, externalStorageLabel.width)
129+ height: parent.height
130+
131+ Label {
132+ id: sizeLabel
133+ anchors.right: parent.right
134+ text: Utils.printSize(i18n, model.size)
135+ textSize: Label.Small
136+ y: listItemLayout.mainSlot.y + listItemLayout.title.y
137+ + listItemLayout.title.baselineOffset - baselineOffset
138 }
139
140- RowLayout {
141- width: parent.width
142- Label {
143- text: internal.formattedDateTime()
144- textSize: Label.Small
145-
146- Layout.fillWidth: true
147- }
148- Icon {
149- width: units.gu(2); height: width
150- name: "sdcard-symbolic"
151- visible: model.isFromExternalStorage
152- }
153+ Icon {
154+ id: externalStorageLabel
155+ anchors.right: parent.right
156+ width: units.gu(2); height: width
157+ name: "sdcard-symbolic"
158+ visible: model.isFromExternalStorage
159+ y: listItemLayout.mainSlot.y + listItemLayout.subtitle.y
160+ + listItemLayout.subtitle.baselineOffset - baselineOffset
161 }
162 }
163 }
164
165=== modified file 'src/app/qml/documentPage/SectionHeader.qml'
166--- src/app/qml/documentPage/SectionHeader.qml 2015-10-23 11:19:19 +0000
167+++ src/app/qml/documentPage/SectionHeader.qml 2015-11-13 21:35:42 +0000
168@@ -1,9 +1,9 @@
169 import QtQuick 2.4
170 import Ubuntu.Components 1.3
171-import Ubuntu.Components.ListItems 1.3 as ListItem
172+import Ubuntu.Components.ListItems 1.3 as ListItems
173 import DocumentViewer 1.0
174
175-ListItem.Header {
176+ListItems.Header {
177 text: {
178 if (sortSettings.sortMode === 1) // sort by name
179 return section.toUpperCase()
180
181=== modified file 'src/app/qml/loView/LOViewDefaultHeader.qml'
182--- src/app/qml/loView/LOViewDefaultHeader.qml 2015-11-13 21:19:46 +0000
183+++ src/app/qml/loView/LOViewDefaultHeader.qml 2015-11-13 21:35:42 +0000
184@@ -89,6 +89,7 @@
185 },*/
186
187 Action {
188+ // FIXME: Autopilot test broken... seems not to detect we're now using an ActionBar since the switch to UITK 1.3
189 objectName: "gotopage"
190 iconName: "browser-tabs"
191 text: i18n.tr("Go to position...")
192
193=== modified file 'src/app/qml/loView/PartsView.qml'
194--- src/app/qml/loView/PartsView.qml 2015-11-02 01:06:31 +0000
195+++ src/app/qml/loView/PartsView.qml 2015-11-13 21:35:42 +0000
196@@ -49,17 +49,22 @@
197
198 onClicked: internal.delegate_onClicked(model.index)
199
200- RowLayout {
201- anchors {
202- fill: parent
203- leftMargin: units.gu(1)
204- rightMargin: units.gu(1)
205- }
206- spacing: units.gu(1)
207-
208+ /*** UITK 1.3 specs: Three slot layout (B-A-C)
209+ ________________________________________
210+ | | | |
211+ | B | A | C |
212+ |___|________________________________|___|
213+
214+ *********************************************/
215+
216+ ListItemLayout {
217+ id: listItemLayout
218+ anchors.fill: parent
219+
220+ /* UITK 1.3 specs: Slot B */
221 Image {
222- Layout.fillHeight: true
223- Layout.preferredWidth: height
224+ SlotsLayout.position: SlotsLayout.Leading
225+ height: parent.height; width: height
226 fillMode: Image.PreserveAspectFit
227 // Do not store a cache of the thumbnail, so that we don't show
228 // thumbnails of a previously loaded document.
229@@ -67,8 +72,8 @@
230 source: model.thumbnail
231 }
232
233- Label {
234- Layout.fillWidth: true
235+ /* UITK 1.3 specs: Slot A */
236+ title {
237 wrapMode: Text.WordWrap
238 text: model.name
239 visible: view.isWide
240@@ -76,7 +81,10 @@
241 : theme.palette.selected.backgroundText
242 }
243
244+ /* UITK 1.3 specs: Slot C */
245 Label {
246+ SlotsLayout.position: SlotsLayout.Trailing
247+
248 text: model.index + 1
249 color: (loView.document.currentPart === model.index) ? UbuntuColors.orange
250 : theme.palette.selected.backgroundText
251
252=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
253--- src/app/qml/pdfView/PdfContentsPage.qml 2015-11-01 19:56:27 +0000
254+++ src/app/qml/pdfView/PdfContentsPage.qml 2015-11-13 21:35:42 +0000
255@@ -88,44 +88,39 @@
256 visible: view.currentIndex == model.index
257 }
258
259- RowLayout {
260- anchors {
261- fill: parent
262- leftMargin: units.gu(1)
263- rightMargin: units.gu(1)
264- }
265-
266- spacing: units.gu(1)
267-
268- Label {
269- objectName: "content"
270- Layout.fillWidth: true
271-
272+ /* UITK 1.3 spec: Three slot layout (A-B-C) */
273+ // ________________________________________
274+ // | | | |
275+ // | A | B | C |
276+ // |______________________________|__ __|___|
277+ //
278+ ListItemLayout {
279+ id: listItemLayout
280+ objectName: "listItemLayout" + index
281+ anchors.fill: parent
282+
283+ /* UITK 1.3 specs: Slot A */
284+ title {
285 text: model.title
286 elide: Text.ElideRight
287-
288 font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
289 color: (model.level == 0) ? UbuntuColors.midAubergine
290 : theme.palette.selected.backgroundText
291 }
292
293- /*
294- TODO: Needs UX team's review.
295- UX specifications for ListItem suggest to use a "tick" icon
296- as indicator for a selected state.
297- This currently looks a bit redundant, since we already
298- use a grey overlay (see above).
299- */
300+ /* UITK 1.3 specs: Slot B */
301 Icon {
302- Layout.preferredHeight: units.gu(2)
303- Layout.preferredWidth: units.gu(2)
304+ SlotsLayout.position: SlotsLayout.Trailing
305+ width: units.gu(2); height: width
306 name: "tick"
307 color: UbuntuColors.green
308 visible: view.currentIndex == model.index
309 }
310
311+ /* UITK 1.3 specs: Slot C */
312 Label {
313 objectName: "pageindex"
314+ SlotsLayout.position: SlotsLayout.Last
315 text: model.pageIndex + 1
316 font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
317 color: (model.level == 0) ? UbuntuColors.midAubergine

Subscribers

People subscribed via source and target branches

to all changes: