Merge lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint into lp:ubuntu-ui-toolkit/staging
- bottomedgehint
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Tim Peeters |
Approved revision: | 1709 |
Merged at revision: | 1702 |
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
478 lines (+240/-100) 8 files modified
components.api (+2/-1) examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml (+1/-1) examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml (+2/-2) src/Ubuntu/Components/1.3/BottomEdgeHint.qml (+35/-80) src/Ubuntu/Components/Styles/Styles.pro (+0/-4) src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml (+184/-0) src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro (+3/-0) tests/unit_x11/tst_components/tst_bottomedgehint.qml (+13/-12) |
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Peeters | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+275490@code.launchpad.net |
Commit message
Follow the new design in BottomEdgeHint.
Description of the change
Zsombor Egri (zsombi) wrote : | # |
- 1704. By Zsombor Egri
-
do not react on mouse hover while faded
- 1705. By Zsombor Egri
-
rogue print removed
- 1706. By Zsombor Egri
-
reset idle timer when entered back within the timeout period
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1703
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1706
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
- 1707. By Zsombor Egri
-
adding Locked state and adjust tests
- 1708. By Zsombor Egri
-
doc fix
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1707
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1708
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : | # |
Mostly fine, but I don't like the names of the states. See inline comments below.
Zsombor Egri (zsombi) wrote : | # |
Replied.
Tim Peeters (tpeeters) wrote : | # |
Ok let's go for {Idle, Hidden, Active, Locked} for the states.
- 1709. By Zsombor Egri
-
states renamed
Tim Peeters (tpeeters) wrote : | # |
Good stuff, thanks. Happroving!
Preview Diff
1 | === modified file 'components.api' |
2 | --- components.api 2015-10-22 13:25:33 +0000 |
3 | +++ components.api 2015-10-23 16:37:58 +0000 |
4 | @@ -175,7 +175,8 @@ |
5 | property var icon |
6 | property bool iconFrame |
7 | property bool progression |
8 | -Ubuntu.Components.BottomEdgeHint 1.3: Item |
9 | +Ubuntu.Components.BottomEdgeHint 1.3: StyledItem |
10 | + property Flickable flickable |
11 | property string iconName |
12 | property url iconSource |
13 | signal clicked() |
14 | |
15 | === renamed file 'examples/ubuntu-ui-toolkit-gallery/BottomEdgeHint.qml' => 'examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml' |
16 | --- examples/ubuntu-ui-toolkit-gallery/BottomEdgeHint.qml 2015-08-11 14:14:50 +0000 |
17 | +++ examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml 2015-10-23 16:37:58 +0000 |
18 | @@ -33,6 +33,6 @@ |
19 | BottomEdgeHint { |
20 | iconName: "stock_message" |
21 | text: "Compose a new message" |
22 | - onClicked: state = "Hidden" |
23 | + onClicked: state = "Idle" |
24 | } |
25 | } |
26 | |
27 | === modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml' |
28 | --- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2015-09-25 17:05:53 +0000 |
29 | +++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2015-10-23 16:37:58 +0000 |
30 | @@ -103,8 +103,8 @@ |
31 | } |
32 | ListElement { |
33 | objectName: "bottomEdgeHintElement" |
34 | - label: "Bottom Edge Hint" |
35 | - source: "BottomEdgeHint.qml" |
36 | + label: "Bottom Edge" |
37 | + source: "BottomEdgePage.qml" |
38 | } |
39 | |
40 | ListElement { |
41 | |
42 | === modified file 'src/Ubuntu/Components/1.3/BottomEdgeHint.qml' |
43 | --- src/Ubuntu/Components/1.3/BottomEdgeHint.qml 2015-09-21 14:44:13 +0000 |
44 | +++ src/Ubuntu/Components/1.3/BottomEdgeHint.qml 2015-10-23 16:37:58 +0000 |
45 | @@ -18,20 +18,22 @@ |
46 | import Ubuntu.Components 1.3 |
47 | |
48 | /*! |
49 | - \qmlabstract BottomEdgeHint |
50 | + \qmltype BottomEdgeHint |
51 | \inqmlmodule Ubuntu.Components 1.3 |
52 | \ingroup ubuntu |
53 | + \inherits StyledItem |
54 | \brief The BottomEdgeHint shows the availability of extra features |
55 | available from the bottom edge of the application. |
56 | |
57 | It displays either a label or an icon at the bottom of the application. |
58 | |
59 | - It has 2 states: hidden or visible. When hidden, part of it is still visible |
60 | - to hint at the existence of the bottom edge. |
61 | + It has 4 states: Hidden, Idle, Active and Locked. When Idle, part of it is |
62 | + still visible hinting the existence of the bottom edge. |
63 | |
64 | When used with a mouse it acts like a button. The typical action associated |
65 | with clicking on it should be revealing the extra features provided by the |
66 | - bottom edge. |
67 | + bottom edge. However, the click can only happen if the hint is in \e Locked |
68 | + state. |
69 | |
70 | Example: |
71 | \qml |
72 | @@ -42,19 +44,12 @@ |
73 | } |
74 | \endqml |
75 | |
76 | + The component is styled through \b BottomEdgeHintStyle. |
77 | */ |
78 | -Item { |
79 | +StyledItem { |
80 | id: bottomEdgeHint |
81 | |
82 | - anchors { |
83 | - bottom: parent.bottom |
84 | - bottomMargin: bottomEdgeHint.state == "Hidden" ? -bottomEdgeHint.height + units.gu(1.5) : 0 |
85 | - horizontalCenter: parent.horizontalCenter |
86 | - Behavior on bottomMargin { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } } |
87 | - } |
88 | - |
89 | - width: label.paintedWidth + units.gu(7) |
90 | - height: units.gu(4) |
91 | + anchors.bottom: parent.bottom |
92 | |
93 | /*! |
94 | This handler is called when there is a mouse click on the BottomEdgeHint |
95 | @@ -66,19 +61,22 @@ |
96 | Keys.onReturnPressed: clicked() |
97 | |
98 | /*! |
99 | + \qmlproperty string text |
100 | The label displayed by the BottomEdgeHint. |
101 | */ |
102 | property string text |
103 | |
104 | /*! |
105 | + \qmlproperty url iconSource |
106 | The icon displayed by the BottomEdgeHint. |
107 | |
108 | This is the URL of any image file. |
109 | If both iconSource and iconName are defined, iconName will be ignored. |
110 | */ |
111 | - property url iconSource: iconName ? "image://theme/" + iconName : "" |
112 | + property url iconSource |
113 | |
114 | /*! |
115 | + \qmlproperty string iconName |
116 | The icon associated with the BottomEdgeHint in the icon theme. |
117 | |
118 | If both iconSource and iconName are defined, iconName will be ignored. |
119 | @@ -86,70 +84,27 @@ |
120 | property string iconName |
121 | |
122 | /*! |
123 | - BottomEdgeHint can take 2 states of visibility: "Hidden" and "Visible". |
124 | - |
125 | - When "Visible", the full hint with its content is shown. |
126 | - |
127 | - When "Hidden", only part of the hint is visible leaving more space for application content. |
128 | + The property holds the flickable, which when flicked hides the hint. |
129 | + \e Hidden state is reached when this property is set to a Flickable |
130 | + which is flicking or moving. It is recommended to set the property |
131 | + when the hint is placed above a flickable content. Defaults to null. |
132 | + */ |
133 | + property Flickable flickable: null |
134 | + |
135 | + /*! |
136 | + \qmlproperty string state |
137 | + BottomEdgeHint can take 4 states of visibility: "Hidden", "Idle", "Active" |
138 | + and "Locked". |
139 | + |
140 | + When \e Hidden, the hint is not shown at all. When \e Active, the full hint |
141 | + with its content is shown. When \e Idle, only part of the hint is visible |
142 | + leaving more space for application content. \e Idle extends the empty state. |
143 | + \e Locked is similar to Active, except that it is a final state, meaning the |
144 | + hint will be shown no matter of the flickable's status. |
145 | + |
146 | + Defaults to \e Idle. |
147 | */ |
148 | - property string state: "Visible" |
149 | - |
150 | - MouseArea { |
151 | - id: mouseArea |
152 | - anchors.fill: parent |
153 | - hoverEnabled: true |
154 | - onEntered: bottomEdgeHint.state = "Visible" |
155 | - onClicked: { |
156 | - Haptics.play(); |
157 | - bottomEdgeHint.clicked(); |
158 | - mouse.accepted = false; |
159 | - } |
160 | - } |
161 | - |
162 | - clip: true |
163 | - |
164 | - UbuntuShape { |
165 | - id: background |
166 | - |
167 | - anchors { |
168 | - bottom: parent.bottom |
169 | - horizontalCenter: bottomEdgeHint.horizontalCenter |
170 | - bottomMargin: -units.gu(1) |
171 | - } |
172 | - |
173 | - width: bottomEdgeHint.width - 2 * hoverExpansion |
174 | - height: bottomEdgeHint.height + units.gu(1) - hoverExpansion |
175 | - |
176 | - property real hoverExpansion: mouseArea.containsMouse ? 0 : units.gu(0.5) |
177 | - Behavior on hoverExpansion { UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } } |
178 | - |
179 | - backgroundColor: theme.palette.normal.overlay |
180 | - } |
181 | - |
182 | - Label { |
183 | - id: label |
184 | - |
185 | - anchors { |
186 | - top: parent.top |
187 | - horizontalCenter: parent.horizontalCenter |
188 | - } |
189 | - text: icon.name ? "" : bottomEdgeHint.text |
190 | - textSize: Label.Medium |
191 | - height: bottomEdgeHint.height |
192 | - verticalAlignment: Text.AlignVCenter |
193 | - horizontalAlignment: Text.AlignHCenter |
194 | - } |
195 | - |
196 | - Icon { |
197 | - id: icon |
198 | - |
199 | - name: bottomEdgeHint.iconName |
200 | - anchors { |
201 | - bottom: parent.bottom |
202 | - bottomMargin: units.gu(0.5) |
203 | - horizontalCenter: parent.horizontalCenter |
204 | - } |
205 | - width: height |
206 | - height: units.gu(2) |
207 | - } |
208 | + state: "Idle" |
209 | + |
210 | + styleName: "BottomEdgeHintStyle" |
211 | } |
212 | |
213 | === modified file 'src/Ubuntu/Components/Styles/Styles.pro' |
214 | --- src/Ubuntu/Components/Styles/Styles.pro 2015-10-08 21:19:56 +0000 |
215 | +++ src/Ubuntu/Components/Styles/Styles.pro 2015-10-23 16:37:58 +0000 |
216 | @@ -13,7 +13,3 @@ |
217 | load(ubuntu_qml_module) |
218 | |
219 | OTHER_FILES+=qmldir |
220 | - |
221 | - |
222 | - |
223 | - |
224 | |
225 | === added file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml' |
226 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 1970-01-01 00:00:00 +0000 |
227 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2015-10-23 16:37:58 +0000 |
228 | @@ -0,0 +1,184 @@ |
229 | +/* |
230 | + * Copyright 2015 Canonical Ltd. |
231 | + * |
232 | + * This program is free software; you can redistribute it and/or modify |
233 | + * it under the terms of the GNU Lesser General Public License as published by |
234 | + * the Free Software Foundation; version 3. |
235 | + * |
236 | + * This program is distributed in the hope that it will be useful, |
237 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
238 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
239 | + * GNU Lesser General Public License for more details. |
240 | + * |
241 | + * You should have received a copy of the GNU Lesser General Public License |
242 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
243 | + */ |
244 | + |
245 | +import QtQuick 2.4 |
246 | +import Ubuntu.Components 1.3 |
247 | +import Ubuntu.Components.ListItems 1.3 |
248 | + |
249 | +Item { |
250 | + id: bottomEdgeHintStyle |
251 | + implicitWidth: styledItem.parent.width |
252 | + implicitHeight: units.gu(4) |
253 | + |
254 | + state: styledItem.state |
255 | + |
256 | + states: [ |
257 | + State { |
258 | + name: "Idle" |
259 | + extend: "" |
260 | + StateChangeScript { |
261 | + script: turnToIdleTimer.stop() |
262 | + } |
263 | + }, |
264 | + State { |
265 | + name: "Active" |
266 | + PropertyChanges { |
267 | + target: h1 |
268 | + anchors.verticalCenterOffset: styledItem.height / 2 |
269 | + } |
270 | + PropertyChanges { |
271 | + target: h2 |
272 | + anchors.topMargin: 0 |
273 | + } |
274 | + }, |
275 | + State { |
276 | + name: "Hidden" |
277 | + when: styledItem.flickable && (styledItem.flickable.flicking || styledItem.flickable.moving) |
278 | + PropertyChanges { |
279 | + target: styledItem |
280 | + opacity: 0.0 |
281 | + } |
282 | + PropertyChanges { |
283 | + target: mouseHover |
284 | + enabled: false |
285 | + } |
286 | + }, |
287 | + // FIXME: locked should be set and be final if mouse is attached |
288 | + // requires QSystemInfo support, which is ongoing work upstream |
289 | + State { |
290 | + name: "Locked" |
291 | + PropertyChanges { |
292 | + target: h1 |
293 | + anchors.verticalCenterOffset: styledItem.height / 2 |
294 | + } |
295 | + PropertyChanges { |
296 | + target: h2 |
297 | + anchors.topMargin: 0 |
298 | + } |
299 | + PropertyChanges { |
300 | + target: turnToIdleTimer |
301 | + running: false |
302 | + |
303 | + } |
304 | + } |
305 | + ] |
306 | + transitions: [ |
307 | + Transition { |
308 | + from: "*" |
309 | + to: "Active" |
310 | + reversible: true |
311 | + UbuntuNumberAnimation { |
312 | + targets: [h1, h2] |
313 | + properties: "anchors.verticalCenterOffset, anchors.topMargin" |
314 | + } |
315 | + }, |
316 | + Transition { |
317 | + from: "*" |
318 | + to: "Hidden" |
319 | + reversible: true |
320 | + UbuntuNumberAnimation { |
321 | + target: styledItem |
322 | + property: "opacity" |
323 | + duration: UbuntuAnimation.SlowDuration |
324 | + } |
325 | + } |
326 | + ] |
327 | + |
328 | + // FIXME ZSOMBI: temporary functionality till SwipeGesture integration |
329 | + MouseArea { |
330 | + id: mouseHover |
331 | + anchors.fill: parent |
332 | + hoverEnabled: true |
333 | + acceptedButtons: Qt.NoButton |
334 | + enabled: styledItem.state != "Locked" |
335 | + onEntered: { |
336 | + styledItem.state = "Active"; |
337 | + turnToIdleTimer.stop(); |
338 | + } |
339 | + onExited: if (styledItem.state == "Active") turnToIdleTimer.restart() |
340 | + } |
341 | + |
342 | + Timer { |
343 | + id: turnToIdleTimer |
344 | + interval: 800 |
345 | + repeat: false |
346 | + onTriggered: styledItem.state = "Idle" |
347 | + } |
348 | + |
349 | + clip: true |
350 | + |
351 | + Icon { |
352 | + id: h1 |
353 | + width: units.gu(2) |
354 | + height: width |
355 | + anchors { |
356 | + centerIn: parent |
357 | + topMargin: styledItem.height |
358 | + } |
359 | + name: "up" |
360 | + } |
361 | + |
362 | + Rectangle { |
363 | + id: h2 |
364 | + anchors { |
365 | + top: parent.top |
366 | + left: parent.left |
367 | + right: parent.right |
368 | + topMargin: styledItem.height |
369 | + } |
370 | + height: styledItem.height |
371 | + color: theme.palette.normal.overlay |
372 | + ThinDivider { |
373 | + anchors.top: parent.top |
374 | + } |
375 | + |
376 | + MouseArea { |
377 | + anchors.fill: parent |
378 | + onClicked: { |
379 | + Haptics.play(); |
380 | + styledItem.clicked(); |
381 | + mouse.accepted = false; |
382 | + } |
383 | + } |
384 | + |
385 | + Row { |
386 | + anchors { |
387 | + top: parent.top |
388 | + bottom: parent.bottom |
389 | + horizontalCenter: parent.horizontalCenter |
390 | + } |
391 | + spacing: units.gu(1) |
392 | + Icon { |
393 | + id: icon |
394 | + name: styledItem.iconName |
395 | + source: styledItem.iconSource |
396 | + width: height |
397 | + height: units.gu(2) |
398 | + anchors.verticalCenter: parent.verticalCenter |
399 | + color: theme.palette.normal.overlayText |
400 | + } |
401 | + Label { |
402 | + id: label |
403 | + text: styledItem.text |
404 | + textSize: Label.Medium |
405 | + color: theme.palette.normal.overlayText |
406 | + height: styledItem.height |
407 | + anchors.verticalCenter: parent.verticalCenter |
408 | + verticalAlignment: Text.AlignVCenter |
409 | + } |
410 | + } |
411 | + } |
412 | +} |
413 | |
414 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro' |
415 | --- src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2015-10-02 22:48:13 +0000 |
416 | +++ src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2015-10-23 16:37:58 +0000 |
417 | @@ -113,6 +113,9 @@ |
418 | 1.3/ToolbarStyle.qml \ |
419 | 1.3/IconButtonStyle.qml \ |
420 | 1.3/PageHeaderStyle.qml \ |
421 | + 1.3/BottomEdgeHintStyle.qml \ |
422 | $$ARTWORK_FILES |
423 | |
424 | load(ubuntu_qml_module) |
425 | + |
426 | +OTHER_FILES+=qmldir |
427 | |
428 | === modified file 'tests/unit_x11/tst_components/tst_bottomedgehint.qml' |
429 | --- tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-07-24 13:29:34 +0000 |
430 | +++ tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-10-23 16:37:58 +0000 |
431 | @@ -40,34 +40,35 @@ |
432 | |
433 | function cleanup() { |
434 | bottomEdgeHint.iconName = ""; |
435 | - bottomEdgeHint.state = "Visible"; |
436 | + bottomEdgeHint.state = "Idle"; |
437 | clickSpy.clear(); |
438 | } |
439 | |
440 | function test_0_default_state() { |
441 | compare(bottomEdgeHint.iconName, ""); |
442 | compare(bottomEdgeHint.text, ""); |
443 | - compare(bottomEdgeHint.state, "Visible"); |
444 | - compare(bottomEdgeHint.width, units.gu(7)); |
445 | + compare(bottomEdgeHint.state, "Idle"); |
446 | + compare(bottomEdgeHint.width, mainView.width); |
447 | compare(bottomEdgeHint.height, units.gu(4)); |
448 | compare(bottomEdgeHint.y, mainView.height - bottomEdgeHint.height); |
449 | compare(clickSpy.count, 0, "The BottomEdgeHint should not have received a click."); |
450 | } |
451 | |
452 | - function test_with_text() { |
453 | - bottomEdgeHint.text = "A Label"; |
454 | - compare(bottomEdgeHint.text, "A Label"); |
455 | - verify(bottomEdgeHint.width > units.gu(7)); |
456 | - } |
457 | - |
458 | function test_hiding() { |
459 | bottomEdgeHint.state = "Hidden"; |
460 | - tryCompare(bottomEdgeHint, "y", mainView.height - bottomEdgeHint.height + units.gu(2.5)); |
461 | + tryCompare(bottomEdgeHint, "opacity", 0.0); |
462 | } |
463 | |
464 | function test_clicking() { |
465 | - mouseClick(bottomEdgeHint, 0, 0); |
466 | - compare(clickSpy.count, 1, "The BottomEdgeHint should have received a click."); |
467 | + bottomEdgeHint.state = "Locked"; |
468 | + mouseClick(bottomEdgeHint, centerOf(bottomEdgeHint).x, centerOf(bottomEdgeHint).y); |
469 | + clickSpy.wait(); |
470 | + } |
471 | + |
472 | + function test_no_clicking_while_unlocked() { |
473 | + mouseClick(bottomEdgeHint, centerOf(bottomEdgeHint).x, centerOf(bottomEdgeHint).y); |
474 | + expectFail("", "No click if not Locked"); |
475 | + clickSpy.wait(200); |
476 | } |
477 | } |
478 | } |
This is a prerequisite work for the BottomEdge component.