Merge lp:~azzar1/unity8/launcher-tooltips into lp:unity8
- launcher-tooltips
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~azzar1/unity8/launcher-tooltips |
Merge into: | lp:unity8 |
Prerequisite: | lp:~azzar1/unity8/remove-UbuntuShapeForItem |
Diff against target: |
333 lines (+242/-3) 5 files modified
debian/control (+1/-0) qml/Launcher/LauncherDelegate.qml (+1/-0) qml/Launcher/LauncherPanel.qml (+79/-3) qml/Launcher/Tooltip.qml (+72/-0) tests/qmltests/Launcher/tst_Launcher.qml (+89/-0) |
To merge this branch: | bzr merge lp:~azzar1/unity8/launcher-tooltips |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Zanetti (community) | Approve | ||
Unity8 CI Bot | continuous-integration | Approve | |
Michał Sawicz | Needs Fixing | ||
Albert Astals Cid (community) | Abstain | ||
Lukáš Tinkl | Pending | ||
Review via email: mp+308903@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-11-29.
Commit message
Implement launcher tooltips.
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
Yes, lp:~azzar1/unity8/remove-UbuntuShapeForItem. But it has been merged in this branch and listed as a prerequiste.
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
Yes, alexm approved them
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Albert Astals Cid (aacid) wrote : | # |
Looks good :)
Some minor stuff
Please mark
property var hoveredItem:
property int itemCenter:
as readonly.
Since you changed a == to === i'll ask you to change tooltipShape.
Andrea Azzarone (azzar1) wrote : | # |
> Looks good :)
>
> Some minor stuff
>
> Please mark
> property var hoveredItem:
> property int itemCenter:
> as readonly.
>
> Since you changed a == to === i'll ask you to change tooltipShape.
> == null too, or if you don't want the really really really equal maybe use
> !tooltipShape.
Done.
Andrea Azzarone (azzar1) wrote : | # |
Please note tha there are extra lines in the diff due to the fact the prerequisite branch is not in sync with the unified stages (I cannot update it because it's already in the silo).
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2632
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Albert Astals Cid (aacid) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
* Did CI run pass? If not, please explain why.
No, there's Launcher tests failing but not related to this (i.e. Launcher has been known to be unstable in the init in the past and this doesn't touch the init)
Albert Astals Cid (aacid) wrote : | # |
Text conflict in tests/qmltests/
1 conflicts encountered.
Note: Was top approved already.
Andrea Azzarone (azzar1) wrote : | # |
> Text conflict in tests/qmltests/
> 1 conflicts encountered.
>
> Note: Was top approved already.
Done.
Michael Zanetti (mzanetti) wrote : | # |
ok, re-approving after merge
Albert Astals Cid (aacid) : | # |
Michał Sawicz (saviq) wrote : | # |
tests/qmltests/
- 2634. By Andrea Azzarone
-
Fix broken test.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2633
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2634
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Michael Zanetti (mzanetti) wrote : | # |
wheee! ci is green now :)
Unmerged revisions
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2016-11-16 10:44:00 +0000 |
3 | +++ debian/control 2016-11-24 16:06:51 +0000 |
4 | @@ -49,6 +49,7 @@ |
5 | python3-all:any, |
6 | python3-setuptools, |
7 | qml-module-qt-labs-folderlistmodel, |
8 | + qml-module-qtqml-statemachine, |
9 | qml-module-qtmultimedia (>= 5.4.1-1ubuntu19~overlay2), |
10 | qml-module-qtquick-layouts, |
11 | qml-module-qtquick-xmllistmodel, |
12 | |
13 | === modified file 'qml/Launcher/LauncherDelegate.qml' |
14 | --- qml/Launcher/LauncherDelegate.qml 2016-06-03 11:13:46 +0000 |
15 | +++ qml/Launcher/LauncherDelegate.qml 2016-11-24 16:06:51 +0000 |
16 | @@ -22,6 +22,7 @@ |
17 | |
18 | property int itemIndex: 0 |
19 | property string iconName |
20 | + property string name |
21 | property int count: 0 |
22 | property bool countVisible: false |
23 | property int progress: -1 |
24 | |
25 | === modified file 'qml/Launcher/LauncherPanel.qml' |
26 | --- qml/Launcher/LauncherPanel.qml 2016-11-09 15:02:55 +0000 |
27 | +++ qml/Launcher/LauncherPanel.qml 2016-11-24 16:06:51 +0000 |
28 | @@ -15,6 +15,7 @@ |
29 | */ |
30 | |
31 | import QtQuick 2.4 |
32 | +import QtQml.StateMachine 1.0 as DSM |
33 | import Ubuntu.Components 1.3 |
34 | import Unity.Launcher 0.1 |
35 | import Ubuntu.Components.Popups 1.3 |
36 | @@ -31,7 +32,7 @@ |
37 | property bool dragging: false |
38 | property bool moving: launcherListView.moving || launcherListView.flicking |
39 | property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed |
40 | - || mouseEventEater.containsMouse || dashItem.hovered |
41 | + || dndArea.containsMouse || dashItem.hovered |
42 | property int highlightIndex: -2 |
43 | property bool shortcutHintsShown: false |
44 | |
45 | @@ -40,7 +41,7 @@ |
46 | signal kbdNavigationCancelled() |
47 | |
48 | onXChanged: { |
49 | - if (quickList.state == "open") { |
50 | + if (quickList.state === "open") { |
51 | quickList.state = "" |
52 | } |
53 | } |
54 | @@ -69,7 +70,6 @@ |
55 | id: mouseEventEater |
56 | anchors.fill: parent |
57 | acceptedButtons: Qt.AllButtons |
58 | - hoverEnabled: true |
59 | onWheel: wheel.accepted = true; |
60 | } |
61 | |
62 | @@ -225,6 +225,7 @@ |
63 | // the right app when running autopilot tests for |
64 | // multiple apps. |
65 | readonly property string appId: model.appId |
66 | + name: model.name |
67 | itemIndex: index |
68 | itemHeight: launcherListView.itemHeight |
69 | itemWidth: launcherListView.itemWidth |
70 | @@ -399,6 +400,7 @@ |
71 | id: dndArea |
72 | objectName: "dndArea" |
73 | acceptedButtons: Qt.LeftButton | Qt.RightButton |
74 | + hoverEnabled: true |
75 | anchors { |
76 | fill: parent |
77 | topMargin: launcherListView.topMargin |
78 | @@ -828,4 +830,78 @@ |
79 | } |
80 | } |
81 | } |
82 | + |
83 | + Tooltip { |
84 | + id: tooltipShape |
85 | + objectName: "tooltipShape" |
86 | + |
87 | + visible: tooltipShownState.active |
88 | + rotation: root.rotation |
89 | + y: itemCenter - (height / 2) |
90 | + |
91 | + anchors { |
92 | + left: root.inverted ? undefined : parent.right |
93 | + right: root.inverted ? parent.left : undefined |
94 | + margins: units.gu(1) |
95 | + } |
96 | + |
97 | + readonly property var hoveredItem: dndArea.containsMouse ? launcherListView.itemAt(dndArea.mouseX, dndArea.mouseY + launcherListView.realContentY) : null |
98 | + readonly property int itemCenter: !hoveredItem ? 0 : root.mapFromItem(hoveredItem, 0, 0).y + (hoveredItem.height / 2) + hoveredItem.offset |
99 | + |
100 | + text: !hoveredItem ? "" : hoveredItem.name |
101 | + } |
102 | + |
103 | + DSM.StateMachine { |
104 | + id: tooltipStateMachine |
105 | + initialState: tooltipHiddenState |
106 | + running: true |
107 | + |
108 | + DSM.State { |
109 | + id: tooltipHiddenState |
110 | + |
111 | + DSM.SignalTransition { |
112 | + targetState: tooltipShownState |
113 | + signal: tooltipShape.hoveredItemChanged |
114 | + // !dndArea.pressed allows us to filter out touch input events |
115 | + guard: tooltipShape.hoveredItem !== null && !dndArea.pressed && !root.moving |
116 | + } |
117 | + } |
118 | + |
119 | + DSM.State { |
120 | + id: tooltipShownState |
121 | + |
122 | + DSM.SignalTransition { |
123 | + targetState: tooltipHiddenState |
124 | + signal: tooltipShape.hoveredItemChanged |
125 | + guard: tooltipShape.hoveredItem === null |
126 | + } |
127 | + |
128 | + DSM.SignalTransition { |
129 | + targetState: tooltipDismissedState |
130 | + signal: dndArea.onPressed |
131 | + } |
132 | + |
133 | + DSM.SignalTransition { |
134 | + targetState: tooltipDismissedState |
135 | + signal: quickList.stateChanged |
136 | + guard: quickList.state === "open" |
137 | + } |
138 | + } |
139 | + |
140 | + DSM.State { |
141 | + id: tooltipDismissedState |
142 | + |
143 | + DSM.SignalTransition { |
144 | + targetState: tooltipHiddenState |
145 | + signal: dndArea.positionChanged |
146 | + guard: quickList.state != "open" && !dndArea.pressed && !dndArea.moving |
147 | + } |
148 | + |
149 | + DSM.SignalTransition { |
150 | + targetState: tooltipHiddenState |
151 | + signal: dndArea.exited |
152 | + guard: quickList.state != "open" |
153 | + } |
154 | + } |
155 | + } |
156 | } |
157 | |
158 | === added file 'qml/Launcher/Tooltip.qml' |
159 | --- qml/Launcher/Tooltip.qml 1970-01-01 00:00:00 +0000 |
160 | +++ qml/Launcher/Tooltip.qml 2016-11-24 16:06:51 +0000 |
161 | @@ -0,0 +1,72 @@ |
162 | +/* |
163 | + * Copyright (C) 2016 Canonical, Ltd. |
164 | + * |
165 | + * This program is free software; you can redistribute it and/or modify |
166 | + * it under the terms of the GNU General Public License as published by |
167 | + * the Free Software Foundation; version 3. |
168 | + * |
169 | + * This program is distributed in the hope that it will be useful, |
170 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
171 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
172 | + * GNU General Public License for more details. |
173 | + * |
174 | + * You should have received a copy of the GNU General Public License |
175 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
176 | + */ |
177 | + |
178 | +import QtQuick 2.4 |
179 | +import Ubuntu.Components 1.3 |
180 | + |
181 | +UbuntuShape { |
182 | + id: root |
183 | + |
184 | + // This property holds the delay (milliseconds) after which the tool tip is shown. |
185 | + // A tooltip with a negative delay is shown immediately. The default value is 500 ms. |
186 | + property int delay: 500 |
187 | + |
188 | + // This property holds the text shown on the tool tip. |
189 | + property alias text: label.text |
190 | + |
191 | + aspect: UbuntuShape.Flat |
192 | + color: theme.palette.normal.background |
193 | + width: label.implicitWidth + units.gu(4) |
194 | + height: label.implicitHeight + units.gu(2) |
195 | + opacity: 0 |
196 | + |
197 | + Image { |
198 | + anchors { |
199 | + right: parent.left |
200 | + rightMargin: -units.dp(4) |
201 | + verticalCenter: parent.verticalCenter |
202 | + } |
203 | + source: "graphics/quicklist_tooltip.png" |
204 | + rotation: 90 |
205 | + } |
206 | + |
207 | + Label { |
208 | + id: label |
209 | + anchors.centerIn: parent |
210 | + color: theme.palette.normal.backgroundText |
211 | + } |
212 | + |
213 | + states: [ |
214 | + State { |
215 | + name: "visible" |
216 | + when: root.visible |
217 | + PropertyChanges { |
218 | + target: root |
219 | + opacity: 0.95 |
220 | + } |
221 | + } |
222 | + ] |
223 | + |
224 | + transitions: [ |
225 | + Transition { |
226 | + from: ""; to: "visible" |
227 | + SequentialAnimation { |
228 | + PauseAnimation { duration: root.delay } |
229 | + UbuntuNumberAnimation { target: root; property: "opacity"; duration: UbuntuAnimation.BriskDuration } |
230 | + } |
231 | + } |
232 | + ] |
233 | +} |
234 | \ No newline at end of file |
235 | |
236 | === modified file 'tests/qmltests/Launcher/tst_Launcher.qml' |
237 | --- tests/qmltests/Launcher/tst_Launcher.qml 2016-11-16 10:44:13 +0000 |
238 | +++ tests/qmltests/Launcher/tst_Launcher.qml 2016-11-24 16:06:51 +0000 |
239 | @@ -1369,6 +1369,95 @@ |
240 | tryCompare(clickThroughSpy, "count", 0); |
241 | } |
242 | |
243 | + function test_tooltip() { |
244 | + launcher.lockedVisible = true; |
245 | + revealByEdgePush(); |
246 | + |
247 | + var item = findChild(launcher, "launcherDelegate0"); |
248 | + var tooltipShape = findChild(launcher, "tooltipShape"); |
249 | + |
250 | + // Initial state |
251 | + tryCompare(tooltipShape, "visible", false); |
252 | + tryCompare(tooltipShape, "opacity", .0); |
253 | + |
254 | + // Move the mouse on the launcher icon |
255 | + mouseMove(item, item.width / 2, item.height / 2, 10); |
256 | + mouseMove(item, item.width / 2 + 1, item.height / 2, 10); |
257 | + tryCompare(tooltipShape, "visible", true); |
258 | + tryCompare(tooltipShape, "opacity", .95); |
259 | + |
260 | + // Move the mouse away |
261 | + mouseMove(root, root.width, root.height / 2, 10); |
262 | + tryCompare(tooltipShape, "visible", false); |
263 | + tryCompare(tooltipShape, "opacity", .0); |
264 | + } |
265 | + |
266 | + function test_quicklist_dismisses_tooltip() { |
267 | + launcher.lockedVisible = true; |
268 | + revealByEdgePush(); |
269 | + |
270 | + var item = findChild(launcher, "launcherDelegate0"); |
271 | + var tooltipShape = findChild(launcher, "tooltipShape"); |
272 | + var quickListShape = findChild(launcher, "quickListShape"); |
273 | + |
274 | + // Initial state |
275 | + tryCompare(tooltipShape, "visible", false); |
276 | + tryCompare(tooltipShape, "opacity", .0); |
277 | + |
278 | + // Move the mouse on the launcher icon |
279 | + mouseMove(item, item.width / 2, item.height / 2, 10); |
280 | + mouseMove(item, item.width / 2 + 1, item.height / 2, 10); |
281 | + tryCompare(tooltipShape, "visible", true); |
282 | + tryCompare(tooltipShape, "opacity", .95); |
283 | + |
284 | + // Right click to show the quicklist |
285 | + mouseClick(item, item.width / 2, item.height / 2, Qt.RightButton); |
286 | + tryCompare(quickListShape, "visible", true); |
287 | + tryCompare(tooltipShape, "visible", false); |
288 | + tryCompare(tooltipShape, "opacity", .0); |
289 | + |
290 | + // Left click hides the quicklist, tooltip is still dismissed |
291 | + mouseClick(item, item.width / 2, item.height / 2, Qt.LefftButton); |
292 | + tryCompare(quickListShape, "visible", false); |
293 | + tryCompare(tooltipShape, "visible", false); |
294 | + tryCompare(tooltipShape, "opacity", .0); |
295 | + |
296 | + // Mouse motion should should show tooltip again |
297 | + mouseMove(item, item.width / 2, item.height / 2, 10); |
298 | + mouseMove(item, item.width / 2 + 1, item.height / 2, 10); |
299 | + tryCompare(tooltipShape, "visible", true); |
300 | + tryCompare(tooltipShape, "opacity", .95); |
301 | + } |
302 | + |
303 | + function test_click_dismisses_tooltip() { |
304 | + launcher.lockedVisible = true; |
305 | + revealByEdgePush(); |
306 | + |
307 | + var item = findChild(launcher, "launcherDelegate0"); |
308 | + var tooltipShape = findChild(launcher, "tooltipShape"); |
309 | + |
310 | + // Initial state |
311 | + tryCompare(tooltipShape, "visible", false); |
312 | + tryCompare(tooltipShape, "opacity", .0); |
313 | + |
314 | + // Move the mouse on the launcher icon |
315 | + mouseMove(item, item.width / 2, item.height / 2, 10); |
316 | + mouseMove(item, item.width / 2 + 1, item.height / 2, 10); |
317 | + tryCompare(tooltipShape, "visible", true); |
318 | + tryCompare(tooltipShape, "opacity", .95); |
319 | + |
320 | + // Left click should dismiss the tooltip |
321 | + mouseClick(item, item.width / 2 + 1, item.height / 2, Qt.LeftButton); |
322 | + tryCompare(tooltipShape, "visible", false); |
323 | + tryCompare(tooltipShape, "opacity", .0); |
324 | + |
325 | + // Mouse motion should should show tooltip again |
326 | + mouseMove(item, item.width / 2, item.height / 2, 10); |
327 | + mouseMove(item, item.width / 2 + 1, item.height / 2, 10); |
328 | + tryCompare(tooltipShape, "visible", true); |
329 | + tryCompare(tooltipShape, "opacity", .95); |
330 | + } |
331 | + |
332 | function test_launcherEnabledSetting() { |
333 | launcher.available = true; |
334 |
PASSED: Continuous integration, rev:2630 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2420/ /unity8- jenkins. ubuntu. com/job/ build/3174 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= vivid+overlay, testname= qmluitests. sh/1811 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/1811 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= yakkety, testname= qmluitests. sh/1811 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/3202 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3058/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 3058 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 3058/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2420/ rebuild
https:/