Merge lp:~tpeeters/ubuntu-ui-toolkit/toolbarScroll into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Zsombor Egri
Approved revision: 2056
Merged at revision: 2161
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/toolbarScroll
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 481 lines (+347/-18)
8 files modified
components.api (+2/-0)
examples/ubuntu-ui-toolkit-gallery/Toolbars.qml (+253/-0)
examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml (+6/-0)
src/imports/Components/1.3/Toolbar.qml (+27/-6)
src/imports/Components/1.3/UbuntuListView.qml (+3/-3)
src/imports/Components/Styles/1.3/ToolbarStyle.qml (+11/-1)
src/imports/Components/Themes/Ambiance/1.3/ScrollingActionBarStyle.qml (+5/-1)
src/imports/Components/Themes/Ambiance/1.3/ToolbarStyle.qml (+40/-7)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/toolbarScroll
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zsombor Egri Approve
Tim Peeters Abstain
Review via email: mp+307847@code.launchpad.net

Commit message

Toolbar visual refresh to scroll the icons instead of using an overflow panel.

Description of the change

Toolbar visual refresh to scroll the icons instead of using an overflow panel.

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

You have two new properties, forgot to update components.api?

Quite straight forward otherwise, no complains for the visuals :) But the red background on the gallery page is crap, the focus ring is not visible on it. I'd choose a different color for it, so when focused I won't look on where the hell the focus ring disappeared.

review: Needs Fixing
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

Comments from design (Femma and Jamie)

- The blue background indicates a selection (for "normal" list items). For the toolbar, we are not selecting an option, so it should not have the blue background.
- The disabled icon should also show the orange outline.

review: Needs Fixing
Revision history for this message
Tim Peeters (tpeeters) wrote :

Made the updates requested by design.

review: Abstain
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Ok, I'm fine with it.

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2016-09-17 05:48:25 +0000
3+++ components.api 2017-01-20 11:43:20 +0000
4@@ -1619,6 +1619,8 @@
5 property bool opened
6 property Item pageStack
7 Ubuntu.Components.Styles.ToolbarStyle 1.3: Item
8+ property color backgroundColor
9+ readonly property ActionItemProperties buttons
10 property Component defaultDelegate
11 Ubuntu.Components.Type: Enum
12 Bool
13
14=== added file 'examples/ubuntu-ui-toolkit-gallery/Toolbars.qml'
15--- examples/ubuntu-ui-toolkit-gallery/Toolbars.qml 1970-01-01 00:00:00 +0000
16+++ examples/ubuntu-ui-toolkit-gallery/Toolbars.qml 2017-01-20 11:43:20 +0000
17@@ -0,0 +1,253 @@
18+/*
19+ * Copyright 2016 Canonical Ltd.
20+ *
21+ * This program is free software; you can redistribute it and/or modify
22+ * it under the terms of the GNU Lesser General Public License as published by
23+ * the Free Software Foundation; version 3.
24+ *
25+ * This program is distributed in the hope that it will be useful,
26+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+ * GNU Lesser General Public License for more details.
29+ *
30+ * You should have received a copy of the GNU Lesser General Public License
31+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
32+ */
33+
34+import QtQuick 2.4
35+import Ubuntu.Components 1.3
36+
37+Template {
38+ objectName: "toolbarTemplate"
39+ id: toolbarTemplate
40+
41+ property list<Action> actionList: [
42+ Action {
43+ iconName: "alarm-clock"
44+ text: "Tick tock"
45+ },
46+ Action {
47+ iconName: "appointment"
48+ text: "Date"
49+ },
50+ Action {
51+ iconName: "attachment"
52+ text: "Attach"
53+ },
54+ Action {
55+ iconName: "contact"
56+ text: "Contact"
57+ },
58+ Action {
59+ iconName: "like"
60+ text: "Like"
61+ },
62+ Action {
63+ iconName: "lock"
64+ text: "Lock"
65+ }
66+ ]
67+
68+ property list<Action> longActionList: [
69+ Action {
70+ iconName: "alarm-clock"
71+ text: "Tick tock"
72+ onTriggered: print("tock")
73+ },
74+ Action {
75+ iconName: "appointment"
76+ text: "Date"
77+ onTriggered: print("date")
78+ },
79+ Action {
80+ iconName: "attachment"
81+ text: "Attach"
82+ onTriggered: print("attach")
83+ },
84+ Action {
85+ iconName: "contact"
86+ text: "Contact"
87+ onTriggered: print("contact")
88+ },
89+ Action {
90+ iconName: "like"
91+ text: "Like"
92+ onTriggered: print("+1")
93+ },
94+ Action {
95+ iconName: "lock"
96+ text: "Lock"
97+ onTriggered: print("lock")
98+ },
99+ Action {
100+ iconName: "camcorder"
101+ text: "Camera"
102+ onTriggered: print("cam")
103+ },
104+ Action {
105+ iconName: "location"
106+ text: "Location"
107+ onTriggered: print("loc")
108+ enabled: false
109+ },
110+ Action {
111+ iconName: "message"
112+ text: "Message"
113+ onTriggered: print("msg")
114+ },
115+ Action {
116+ iconName: "livetv"
117+ text: "Television"
118+ onTriggered: print("tv")
119+ },
120+ Action {
121+ iconName: "lock-broken"
122+ text: "Unlock"
123+ onTriggered: print("unlock")
124+ },
125+ Action {
126+ iconName: "compose"
127+ text: "Edit"
128+ onTriggered: print("edit")
129+ },
130+ Action {
131+ iconName: "contact-new"
132+ text: "Add user"
133+ onTriggered: print("useradd")
134+ },
135+ Action {
136+ iconName: "crop"
137+ text: "Crop"
138+ onTriggered: print("crop")
139+ },
140+ Action {
141+ iconName: "edit-cut"
142+ text: "Cut"
143+ onTriggered: print("cut")
144+ },
145+ Action {
146+ iconName: "image-quality"
147+ text: "Image quality"
148+ onTriggered: print("image quality")
149+ },
150+ Action {
151+ iconName: "import"
152+ text: "Import"
153+ onTriggered: print("import")
154+ },
155+ Action {
156+ iconName: "history"
157+ text: "History"
158+ onTriggered: print("history")
159+ },
160+ Action {
161+ iconName: "media-eject"
162+ text: "Eject"
163+ onTriggered: print("eject")
164+ }
165+ ]
166+
167+ property list<Action> deleteActionList: [
168+ Action {
169+ iconName: "delete"
170+ text: "Delete"
171+ onTriggered: print("delete")
172+ }
173+ ]
174+
175+ header: PageHeader {
176+ id: h
177+ title: toolbarTemplate.title
178+ property bool longList: false
179+ extension: Toolbar {
180+ id: headerToolbar
181+ anchors {
182+ left: parent.left
183+ right: parent.right
184+ bottom: parent.bottom
185+ }
186+ leadingActionBar.actions: deleteActionList
187+ trailingActionBar.actions: h.longList ? longActionList : actionList
188+ }
189+ trailingActionBar.actions: [
190+ Action {
191+ iconName: h.longList ? "remove" : "add"
192+ text: h.longList ? "less" : "more"
193+ onTriggered: {
194+ h.longList = !h.longList;
195+ }
196+ }
197+ ]
198+ }
199+
200+ TemplateSection {
201+ title: "Toolbar"
202+ className: "Toolbar"
203+
204+ TemplateRow {
205+ width: parent.width
206+ title: i18n.tr("Enabled")
207+ Toolbar {
208+ width: parent.width
209+ trailingActionBar.actions: actionList
210+ leadingActionBar.actions: deleteActionList
211+ }
212+ }
213+ TemplateRow {
214+ title: i18n.tr("Disabled")
215+ Toolbar {
216+ width: parent.width
217+ trailingActionBar.actions: actionList
218+ leadingActionBar.actions: deleteActionList
219+ enabled: false
220+ }
221+ }
222+ }
223+
224+ TemplateSection {
225+ title: "Scrollable toolbar"
226+ className: "Toolbar"
227+
228+ TemplateRow {
229+ title: i18n.tr("Enabled")
230+ Toolbar {
231+ width: parent.width
232+ trailingActionBar.actions: longActionList
233+ leadingActionBar.actions: deleteActionList
234+ }
235+ }
236+ TemplateRow {
237+ title: i18n.tr("Disabled")
238+ Toolbar {
239+ width: parent.width
240+ trailingActionBar.actions: longActionList
241+ leadingActionBar.actions: deleteActionList
242+ enabled: false
243+ }
244+ }
245+ }
246+
247+ TemplateSection {
248+ title: "Colored"
249+ className: "ActionBarStyle"
250+
251+ TemplateRow {
252+ title: "Green"
253+ Toolbar {
254+ width: parent.width
255+ trailingActionBar.actions: longActionList
256+ leadingActionBar.actions: deleteActionList
257+ StyleHints {
258+ ignoreUnknownProperties: false
259+ backgroundColor: UbuntuColors.green
260+ buttons {
261+ foregroundColor: "white"
262+ disabledForegroundColor: UbuntuColors.silk
263+ pressedBackgroundColor: UbuntuColors.ash
264+ disabledBackgroundColor: UbuntuColors.slate
265+ }
266+ }
267+ }
268+ }
269+ }
270+}
271
272=== modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml'
273--- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2016-01-20 20:15:42 +0000
274+++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2017-01-20 11:43:20 +0000
275@@ -143,6 +143,12 @@
276 source: "Toggles.qml"
277 }
278 ListElement {
279+ objectName: "toolbarsElement"
280+ label: "Toolbar"
281+ source: "Toolbars.qml"
282+ }
283+
284+ ListElement {
285 objectName: "ubuntuListViewElement"
286 label: "Ubuntu ListView"
287 source: "UbuntuListViews.qml"
288
289=== modified file 'src/imports/Components/1.3/Toolbar.qml'
290--- src/imports/Components/1.3/Toolbar.qml 2016-05-25 12:48:10 +0000
291+++ src/imports/Components/1.3/Toolbar.qml 2017-01-20 11:43:20 +0000
292@@ -1,5 +1,5 @@
293 /*
294- * Copyright 2015 Canonical Ltd.
295+ * Copyright 2016 Canonical Ltd.
296 *
297 * This program is free software; you can redistribute it and/or modify
298 * it under the terms of the GNU Lesser General Public License as published by
299@@ -127,6 +127,17 @@
300 print("WARNING: Toolbar with more than one leading actions is not supported.");
301 }
302 }
303+ StyleHints {
304+ backgroundColor: "transparent" // background is drawn by the toolbarStyle
305+ buttons {
306+ foregroundColor: toolbar.__styleInstance.buttons.foregroundColor
307+ pressedForegroundColor: toolbar.__styleInstance.buttons.pressedForegroundColor
308+ disabledForegroundColor: toolbar.__styleInstance.buttons.disabledForegroundColor
309+ backgroundColor: toolbar.__styleInstance.buttons.backgroundColor
310+ pressedBackgroundColor: toolbar.__styleInstance.buttons.pressedBackgroundColor
311+ disabledBackgroundColor: toolbar.__styleInstance.buttons.disabledBackgroundColor
312+ }
313+ }
314 }
315
316 /*!
317@@ -150,19 +161,29 @@
318 readonly property alias trailingActionBar: trailing
319 ActionBar {
320 id: trailing
321+ styleName: "ScrollingActionBarStyle"
322 anchors {
323+ left: leading.right
324 right: parent.right
325 top: parent.top
326 bottom: parent.bottom
327+ leftMargin: units.gu(1)
328 rightMargin: units.gu(1)
329 }
330- numberOfSlots: 8
331 delegate: toolbar.__styleInstance.defaultDelegate
332- Component.onCompleted: {
333- if (actions && actions.length > 8) {
334- print("WARNING: Toolbar with more than one leading actions is not supported.");
335+ StyleHints {
336+ backgroundColor: "transparent" // background is drawn by the toolbarStyle
337+ buttons {
338+ foregroundColor: toolbar.__styleInstance.buttons.foregroundColor
339+ pressedForegroundColor: toolbar.__styleInstance.buttons.pressedForegroundColor
340+ disabledForegroundColor: toolbar.__styleInstance.buttons.disabledForegroundColor
341+ backgroundColor: toolbar.__styleInstance.buttons.backgroundColor
342+ pressedBackgroundColor: toolbar.__styleInstance.buttons.pressedBackgroundColor
343+ disabledBackgroundColor: toolbar.__styleInstance.buttons.disabledBackgroundColor
344+ }
345+ scrollButtons {
346+ backgroundColor: toolbar.__styleInstance.backgroundColor // must be opaque to hide the icon buttons
347 }
348 }
349-
350 }
351 }
352
353=== modified file 'src/imports/Components/1.3/UbuntuListView.qml'
354--- src/imports/Components/1.3/UbuntuListView.qml 2016-09-22 17:39:59 +0000
355+++ src/imports/Components/1.3/UbuntuListView.qml 2017-01-20 11:43:20 +0000
356@@ -199,10 +199,10 @@
357 color: root.activeFocus
358 ? theme.palette.focused.background
359 : theme.palette.selected.background
360- width: root.currentItem.width
361- height: root.currentItem.height
362+ width: root.currentItem ? root.currentItem.width : 0
363+ height: root.currentItem ? root.currentItem.height : 0
364 // FIXME: use opacity yet, until we fix the palette's disabled.background color
365- opacity: root.currentItem.enabled ? 1.0 : 0.5
366+ opacity: root.currentItem && root.currentItem.enabled ? 1.0 : 0.5
367 }
368 highlightMoveDuration: 50
369 }
370
371=== modified file 'src/imports/Components/Styles/1.3/ToolbarStyle.qml'
372--- src/imports/Components/Styles/1.3/ToolbarStyle.qml 2015-12-02 13:02:44 +0000
373+++ src/imports/Components/Styles/1.3/ToolbarStyle.qml 2017-01-20 11:43:20 +0000
374@@ -1,5 +1,5 @@
375 /*
376- * Copyright 2015 Canonical Ltd.
377+ * Copyright 2016 Canonical Ltd.
378 *
379 * This program is free software; you can redistribute it and/or modify
380 * it under the terms of the GNU Lesser General Public License as published by
381@@ -25,6 +25,16 @@
382 */
383 Item {
384 /*!
385+ The color of the background of the action bar.
386+ */
387+ property color backgroundColor
388+
389+ /*!
390+ Configuration of the colors of the action buttons in the action bar.
391+ */
392+ readonly property ActionItemProperties buttons: ActionItemProperties { }
393+
394+ /*!
395 The default action delegate if the styled item does
396 not provide a different delegate.
397 */
398
399=== modified file 'src/imports/Components/Themes/Ambiance/1.3/ScrollingActionBarStyle.qml'
400--- src/imports/Components/Themes/Ambiance/1.3/ScrollingActionBarStyle.qml 2016-10-03 14:07:38 +0000
401+++ src/imports/Components/Themes/Ambiance/1.3/ScrollingActionBarStyle.qml 2017-01-20 11:43:20 +0000
402@@ -113,7 +113,11 @@
403 model: listViewContainer.visibleActions
404
405 highlight: Rectangle {
406- color: theme.palette.focused.background
407+ color: "transparent"
408+ border {
409+ color: theme.palette.selected.focus
410+ width: 2
411+ }
412 visible: actionsListView.activeFocus
413 width: actionsListView.currentItem.width
414 height: actionsListView.currentItem.height
415
416=== modified file 'src/imports/Components/Themes/Ambiance/1.3/ToolbarStyle.qml'
417--- src/imports/Components/Themes/Ambiance/1.3/ToolbarStyle.qml 2016-09-19 07:24:45 +0000
418+++ src/imports/Components/Themes/Ambiance/1.3/ToolbarStyle.qml 2017-01-20 11:43:20 +0000
419@@ -1,5 +1,5 @@
420 /*
421- * Copyright 2015 Canonical Ltd.
422+ * Copyright 2016 Canonical Ltd.
423 *
424 * This program is free software; you can redistribute it and/or modify
425 * it under the terms of the GNU Lesser General Public License as published by
426@@ -24,16 +24,49 @@
427 // reduce toolbar height on phone in landscape orientation:
428 implicitHeight: Screen.height > units.gu(50) ? units.gu(4) : units.gu(3)
429
430+ backgroundColor: theme.palette.normal.background
431+ buttons {
432+ foregroundColor: theme.palette.normal.backgroundText
433+ pressedForegroundColor: buttons.foregroundColor
434+ disabledForegroundColor: theme.palette.disabled.backgroundText
435+ backgroundColor: "transparent" // background is already colored
436+ pressedBackgroundColor: theme.palette.highlighted.background
437+ disabledBackgroundColor: buttons.backgroundColor
438+ }
439+
440 /*!
441 The default action delegate if the styled item does
442 not provide a delegate.
443 */
444- defaultDelegate: AbstractButton {
445- style: IconButtonStyle { }
446- objectName: action.objectName + "_button"
447- height: parent ? parent.height : undefined
448+ defaultDelegate: ListItem {
449 width: units.gu(4)
450- action: modelData
451- activeFocusOnTab: true
452+ height: toolbarStyle.height
453+ enabled: modelData.enabled
454+ objectName: modelData.objectName + "_button"
455+ onClicked: button.trigger()
456+ AbstractButton {
457+ id: button
458+ anchors.fill: parent
459+ style: IconButtonStyle {
460+ foregroundColor: button.pressed ?
461+ toolbarStyle.buttons.pressedForegroundColor :
462+ button.enabled ?
463+ toolbarStyle.buttons.foregroundColor :
464+ toolbarStyle.buttons.disabledForegroundColor
465+ backgroundColor: button.pressed ?
466+ toolbarStyle.buttons.pressedBackgroundColor :
467+ button.enabled ?
468+ toolbarStyle.buttons.backgroundColor :
469+ toolbarStyle.buttons.disabledBackgroundColor
470+ }
471+ action: modelData
472+ activeFocusOnTab: false
473+ }
474+ divider.visible: false
475+ }
476+
477+ Rectangle {
478+ anchors.fill: parent
479+ color: toolbarStyle.backgroundColor
480 }
481 }

Subscribers

People subscribed via source and target branches