Merge lp:~tpeeters/ubuntu-ui-toolkit/20-sm into lp:ubuntu-ui-toolkit/staging
- 20-sm
- Merge into staging
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Tim Peeters | ||||
Approved revision: | 1286 | ||||
Merged at revision: | 1277 | ||||
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/20-sm | ||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||
Diff against target: |
322 lines (+263/-1) 6 files modified
components.api (+1/-0) modules/Ubuntu/Components/PageHeadConfiguration.qml (+81/-0) modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml (+20/-0) modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+3/-1) tests/resources/header/select.qml (+86/-0) tests/unit_x11/tst_components/tst_header_presets.qml (+72/-0) |
||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/20-sm | ||||
Related bugs: |
|
||||
Related blueprints: |
Additional new header features
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Zsombor Egri | Approve | ||
Review via email: mp+236788@code.launchpad.net |
Commit message
Add selection mode as a preset to the header configuration.
Description of the change
Add selection mode as a preset to the header configuration.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1285
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1286
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Tim Peeters (tpeeters) wrote : | # |
I'm happroving again after autolanding failed with yet another unrelated issue.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'components.api' |
2 | --- components.api 2014-09-20 06:05:59 +0000 |
3 | +++ components.api 2014-10-02 11:07:59 +0000 |
4 | @@ -246,6 +246,7 @@ |
5 | property list<Action> actions |
6 | property Action backAction |
7 | property Item contents |
8 | + property string preset |
9 | readonly property PageHeadSections sections |
10 | property color foregroundColor |
11 | PageHeadSections 1.1 |
12 | |
13 | === modified file 'modules/Ubuntu/Components/PageHeadConfiguration.qml' |
14 | --- modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-08-31 19:24:19 +0000 |
15 | +++ modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-10-02 11:07:59 +0000 |
16 | @@ -96,6 +96,87 @@ |
17 | */ |
18 | property Item contents: null |
19 | |
20 | + // FIXME: The example below can be much simplified using PageHeadState |
21 | + // when bug #1345775 has been fixed. |
22 | + /*! |
23 | + Choose a preset for the header visuals and behavior. |
24 | + The default is an empty string "". |
25 | + By setting this to "selection", title will be hidden and |
26 | + actions will be represented by icons with a label. |
27 | + |
28 | + Example: |
29 | + \qml |
30 | + import QtQuick 2.2 |
31 | + import Ubuntu.Components 1.1 |
32 | + |
33 | + MainView { |
34 | + id: mainView |
35 | + width: units.gu(40) |
36 | + height: units.gu(50) |
37 | + useDeprecatedToolbar: false |
38 | + |
39 | + Page { |
40 | + id: page |
41 | + title: "Demo" |
42 | + |
43 | + state: "default" |
44 | + states: [ |
45 | + PageHeadState { |
46 | + name: "default" |
47 | + head: page.head |
48 | + actions: [ |
49 | + Action { |
50 | + iconName: "contact" |
51 | + text: "Contact" |
52 | + } |
53 | + ] |
54 | + }, |
55 | + State { |
56 | + id: selectState |
57 | + name: "select" |
58 | + |
59 | + property Action leaveSelect: Action { |
60 | + iconName: "back" |
61 | + text: "Back" |
62 | + onTriggered: page.state = "default" |
63 | + } |
64 | + property list<Action> actions: [ |
65 | + Action { |
66 | + iconName: "select" |
67 | + text: "Select All" |
68 | + }, |
69 | + Action { |
70 | + iconName: "delete" |
71 | + text: "Delete" |
72 | + } |
73 | + ] |
74 | + PropertyChanges { |
75 | + target: page.head |
76 | + backAction: selectState.leaveSelect |
77 | + actions: selectState.actions |
78 | + preset: "select" |
79 | + } |
80 | + } |
81 | + ] |
82 | + |
83 | + Label { |
84 | + anchors.centerIn: parent |
85 | + text: "Use back button to leave selection mode." |
86 | + visible: page.state == "select" |
87 | + } |
88 | + |
89 | + Button { |
90 | + anchors.centerIn: parent |
91 | + onClicked: page.state = "select" |
92 | + visible: page.state != "select" |
93 | + text: "selection mode" |
94 | + } |
95 | + } |
96 | + } |
97 | + \endqml |
98 | + */ |
99 | + property string preset: "" |
100 | + |
101 | /*! |
102 | \qmlproperty PageHeadSections sections |
103 | Defines the sections in the page header divider. |
104 | |
105 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml' |
106 | --- modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-09-02 17:12:47 +0000 |
107 | +++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-10-02 11:07:59 +0000 |
108 | @@ -47,4 +47,24 @@ |
109 | color: Qt.rgba(0, 0, 0, 0) |
110 | opacity: button.enabled ? 1.0 : 0.3 |
111 | } |
112 | + |
113 | + Component { |
114 | + id: labelComponent |
115 | + Label { |
116 | + id: label |
117 | + objectName: button.objectName + "_label" |
118 | + color: button.color |
119 | + opacity: button.enabled ? 1.0 : 0.3 |
120 | + text: button.text |
121 | + fontSize: "xx-small" |
122 | + } |
123 | + } |
124 | + Loader { |
125 | + anchors { |
126 | + top: icon.bottom |
127 | + topMargin: units.gu(0.5) |
128 | + horizontalCenter: parent.horizontalCenter |
129 | + } |
130 | + sourceComponent: button.state === "IconAndLabel" ? labelComponent : null |
131 | + } |
132 | } |
133 | |
134 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml' |
135 | --- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-09-25 14:07:07 +0000 |
136 | +++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-10-02 11:07:59 +0000 |
137 | @@ -368,7 +368,7 @@ |
138 | Label { |
139 | objectName: "header_title_label" |
140 | LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft |
141 | - visible: !contentsContainer.visible |
142 | + visible: !contentsContainer.visible && styledItem.config.preset === "" |
143 | anchors { |
144 | left: parent.left |
145 | right: parent.right |
146 | @@ -450,6 +450,8 @@ |
147 | objectName: action.objectName + "_header_button" |
148 | action: actionsContainer.visibleActions[index] |
149 | color: styledItem.config.foregroundColor |
150 | + state: styledItem.config.preset === "select" ? |
151 | + "IconAndLabel" : "" |
152 | } |
153 | } |
154 | |
155 | |
156 | === added file 'tests/resources/header/select.qml' |
157 | --- tests/resources/header/select.qml 1970-01-01 00:00:00 +0000 |
158 | +++ tests/resources/header/select.qml 2014-10-02 11:07:59 +0000 |
159 | @@ -0,0 +1,86 @@ |
160 | +/* |
161 | + * Copyright (C) 2014 Canonical Ltd. |
162 | + * |
163 | + * This program is free software; you can redistribute it and/or modify |
164 | + * it under the terms of the GNU Lesser General Public License as published by |
165 | + * the Free Software Foundation; version 3. |
166 | + * |
167 | + * This program is distributed in the hope that it will be useful, |
168 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
169 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
170 | + * GNU Lesser General Public License for more details. |
171 | + * |
172 | + * You should have received a copy of the GNU Lesser General Public License |
173 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
174 | + */ |
175 | + |
176 | +import QtQuick 2.2 |
177 | +import Ubuntu.Components 1.1 |
178 | + |
179 | +// FIXME: This example can be much simplified using PageHeadState |
180 | +// when bug #1345775 has been fixed. |
181 | + |
182 | +MainView { |
183 | + id: mainView |
184 | + width: units.gu(40) |
185 | + height: units.gu(50) |
186 | + useDeprecatedToolbar: false |
187 | + |
188 | + Page { |
189 | + id: page |
190 | + title: "Demo" |
191 | + |
192 | + state: "default" |
193 | + states: [ |
194 | + PageHeadState { |
195 | + name: "default" |
196 | + head: page.head |
197 | + actions: [ |
198 | + Action { |
199 | + iconName: "contact" |
200 | + text: "Contact" |
201 | + } |
202 | + ] |
203 | + }, |
204 | + State { |
205 | + id: selectState |
206 | + name: "select" |
207 | + |
208 | + property Action leaveSelect: Action { |
209 | + iconName: "back" |
210 | + text: "Back" |
211 | + onTriggered: page.state = "default" |
212 | + } |
213 | + property list<Action> actions: [ |
214 | + Action { |
215 | + iconName: "select" |
216 | + text: "Select All" |
217 | + }, |
218 | + Action { |
219 | + iconName: "delete" |
220 | + text: "Delete" |
221 | + } |
222 | + ] |
223 | + PropertyChanges { |
224 | + target: page.head |
225 | + backAction: selectState.leaveSelect |
226 | + actions: selectState.actions |
227 | + preset: "select" |
228 | + } |
229 | + } |
230 | + ] |
231 | + |
232 | + Label { |
233 | + anchors.centerIn: parent |
234 | + text: "Use back button to leave selection mode." |
235 | + visible: page.state == "select" |
236 | + } |
237 | + |
238 | + Button { |
239 | + anchors.centerIn: parent |
240 | + onClicked: page.state = "select" |
241 | + visible: page.state != "select" |
242 | + text: "selection mode" |
243 | + } |
244 | + } |
245 | +} |
246 | |
247 | === added file 'tests/unit_x11/tst_components/tst_header_presets.qml' |
248 | --- tests/unit_x11/tst_components/tst_header_presets.qml 1970-01-01 00:00:00 +0000 |
249 | +++ tests/unit_x11/tst_components/tst_header_presets.qml 2014-10-02 11:07:59 +0000 |
250 | @@ -0,0 +1,72 @@ |
251 | +/* |
252 | + * Copyright 2014 Canonical Ltd. |
253 | + * |
254 | + * This program is free software; you can redistribute it and/or modify |
255 | + * it under the terms of the GNU Lesser General Public License as published by |
256 | + * the Free Software Foundation; version 3. |
257 | + * |
258 | + * This program is distributed in the hope that it will be useful, |
259 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
260 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
261 | + * GNU Lesser General Public License for more details. |
262 | + * |
263 | + * You should have received a copy of the GNU Lesser General Public License |
264 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
265 | + */ |
266 | + |
267 | +import QtQuick 2.2 |
268 | +import Ubuntu.Test 1.0 |
269 | +import Ubuntu.Components 1.1 |
270 | + |
271 | +Item { |
272 | + width: units.gu(50) |
273 | + height: units.gu(80) |
274 | + |
275 | + MainView { |
276 | + id: mainView |
277 | + anchors.fill: parent |
278 | + useDeprecatedToolbar: false |
279 | + |
280 | + Page { |
281 | + id: page |
282 | + title: "Page title" |
283 | + head.actions: [ |
284 | + Action { |
285 | + objectName: "selectAction" |
286 | + text: "Select all" |
287 | + iconName: "select" |
288 | + } |
289 | + ] |
290 | + } |
291 | + } |
292 | + |
293 | + UbuntuTestCase { |
294 | + name: "HeaderSelectionPreset" |
295 | + when: windowShown |
296 | + id: testCase |
297 | + |
298 | + property var action_button |
299 | + |
300 | + function initTestCase() { |
301 | + testCase.action_button = findChild(mainView, "selectAction_header_button"); |
302 | + compare(action_button.visible, true, "Header action button is not visible."); |
303 | + compare(page.head.preset, "", "Default header preset is not empty string."); |
304 | + } |
305 | + |
306 | + function test_default_preset() { |
307 | + var label = findChild(action_button, "selectAction_header_button_label"); |
308 | + compare(label, null, "Header button label defined in default header."); |
309 | + var title = findChild(mainView, "header_title_label"); |
310 | + compare(title.visible, true, "No title visible with default preset."); |
311 | + } |
312 | + |
313 | + function test_select_preset() { |
314 | + page.head.preset = "select"; |
315 | + var label = findChild(action_button, "selectAction_header_button_label"); |
316 | + compare(label.visible, true, "Header button has no visible label in selection mode."); |
317 | + var title = findChild(mainView, "header_title_label"); |
318 | + compare(title.visible, false, "Title visible in select preset."); |
319 | + page.head.preset = ""; |
320 | + } |
321 | + } |
322 | +} |
FAILED: Continuous integration, rev:1284 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/1087/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/5400 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- utopic- amd64-ci/ 919 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- utopic- armhf-ci/ 919 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- utopic- armhf-ci/ 919/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- utopic- i386-ci/ 919 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/5107 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/6652 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/6652/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 14029
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/1087/ rebuild
http://