Merge lp:~azzar1/unity8/launcher-tooltips into lp:unity8

Proposed by Andrea Azzarone
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
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

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2630
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2420/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3174
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1811
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1811
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1811
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3202
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3058/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3058
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3058/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2420/rebuild

review: Approve (continuous-integration)
Revision history for this message
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.hoveredItem == null too, or if you don't want the really really really equal maybe use !tooltipShape.hoveredItem ?

review: Needs Fixing
Revision history for this message
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.hoveredItem
> == null too, or if you don't want the really really really equal maybe use
> !tooltipShape.hoveredItem ?

Done.

Revision history for this message
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).

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2632
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2437/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3191
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1824
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1824
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1824
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3219
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3075/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3075
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3075/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2437/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
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)

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/qmltests/Launcher/tst_Launcher.qml
1 conflicts encountered.

Note: Was top approved already.

review: Needs Fixing
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Text conflict in tests/qmltests/Launcher/tst_Launcher.qml
> 1 conflicts encountered.
>
> Note: Was top approved already.

Done.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

ok, re-approving after merge

review: Approve
Revision history for this message
Albert Astals Cid (aacid) :
review: Abstain
Revision history for this message
Michał Sawicz (saviq) wrote :

tests/qmltests/Launcher/tst_Launcher.qml:1482:1: Expected token `}'

review: Needs Fixing
lp:~azzar1/unity8/launcher-tooltips updated
2634. By Andrea Azzarone

Fix broken test.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2633
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2559/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3370
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1933
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1933
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1933
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3398
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3249/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3249
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3249/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2559/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2634
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2565/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3377
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1940
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1940
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1940
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3405
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3256/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3256
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3256/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2565/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

wheee! ci is green now :)

review: Approve

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2016-11-16 10:44:00 +0000
+++ debian/control 2016-11-24 16:06:51 +0000
@@ -49,6 +49,7 @@
49 python3-all:any,49 python3-all:any,
50 python3-setuptools,50 python3-setuptools,
51 qml-module-qt-labs-folderlistmodel,51 qml-module-qt-labs-folderlistmodel,
52 qml-module-qtqml-statemachine,
52 qml-module-qtmultimedia (>= 5.4.1-1ubuntu19~overlay2),53 qml-module-qtmultimedia (>= 5.4.1-1ubuntu19~overlay2),
53 qml-module-qtquick-layouts,54 qml-module-qtquick-layouts,
54 qml-module-qtquick-xmllistmodel,55 qml-module-qtquick-xmllistmodel,
5556
=== modified file 'qml/Launcher/LauncherDelegate.qml'
--- qml/Launcher/LauncherDelegate.qml 2016-06-03 11:13:46 +0000
+++ qml/Launcher/LauncherDelegate.qml 2016-11-24 16:06:51 +0000
@@ -22,6 +22,7 @@
2222
23 property int itemIndex: 023 property int itemIndex: 0
24 property string iconName24 property string iconName
25 property string name
25 property int count: 026 property int count: 0
26 property bool countVisible: false27 property bool countVisible: false
27 property int progress: -128 property int progress: -1
2829
=== modified file 'qml/Launcher/LauncherPanel.qml'
--- qml/Launcher/LauncherPanel.qml 2016-11-09 15:02:55 +0000
+++ qml/Launcher/LauncherPanel.qml 2016-11-24 16:06:51 +0000
@@ -15,6 +15,7 @@
15 */15 */
1616
17import QtQuick 2.417import QtQuick 2.4
18import QtQml.StateMachine 1.0 as DSM
18import Ubuntu.Components 1.319import Ubuntu.Components 1.3
19import Unity.Launcher 0.120import Unity.Launcher 0.1
20import Ubuntu.Components.Popups 1.321import Ubuntu.Components.Popups 1.3
@@ -31,7 +32,7 @@
31 property bool dragging: false32 property bool dragging: false
32 property bool moving: launcherListView.moving || launcherListView.flicking33 property bool moving: launcherListView.moving || launcherListView.flicking
33 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed34 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
34 || mouseEventEater.containsMouse || dashItem.hovered35 || dndArea.containsMouse || dashItem.hovered
35 property int highlightIndex: -236 property int highlightIndex: -2
36 property bool shortcutHintsShown: false37 property bool shortcutHintsShown: false
3738
@@ -40,7 +41,7 @@
40 signal kbdNavigationCancelled()41 signal kbdNavigationCancelled()
4142
42 onXChanged: {43 onXChanged: {
43 if (quickList.state == "open") {44 if (quickList.state === "open") {
44 quickList.state = ""45 quickList.state = ""
45 }46 }
46 }47 }
@@ -69,7 +70,6 @@
69 id: mouseEventEater70 id: mouseEventEater
70 anchors.fill: parent71 anchors.fill: parent
71 acceptedButtons: Qt.AllButtons72 acceptedButtons: Qt.AllButtons
72 hoverEnabled: true
73 onWheel: wheel.accepted = true;73 onWheel: wheel.accepted = true;
74 }74 }
7575
@@ -225,6 +225,7 @@
225 // the right app when running autopilot tests for225 // the right app when running autopilot tests for
226 // multiple apps.226 // multiple apps.
227 readonly property string appId: model.appId227 readonly property string appId: model.appId
228 name: model.name
228 itemIndex: index229 itemIndex: index
229 itemHeight: launcherListView.itemHeight230 itemHeight: launcherListView.itemHeight
230 itemWidth: launcherListView.itemWidth231 itemWidth: launcherListView.itemWidth
@@ -399,6 +400,7 @@
399 id: dndArea400 id: dndArea
400 objectName: "dndArea"401 objectName: "dndArea"
401 acceptedButtons: Qt.LeftButton | Qt.RightButton402 acceptedButtons: Qt.LeftButton | Qt.RightButton
403 hoverEnabled: true
402 anchors {404 anchors {
403 fill: parent405 fill: parent
404 topMargin: launcherListView.topMargin406 topMargin: launcherListView.topMargin
@@ -828,4 +830,78 @@
828 }830 }
829 }831 }
830 }832 }
833
834 Tooltip {
835 id: tooltipShape
836 objectName: "tooltipShape"
837
838 visible: tooltipShownState.active
839 rotation: root.rotation
840 y: itemCenter - (height / 2)
841
842 anchors {
843 left: root.inverted ? undefined : parent.right
844 right: root.inverted ? parent.left : undefined
845 margins: units.gu(1)
846 }
847
848 readonly property var hoveredItem: dndArea.containsMouse ? launcherListView.itemAt(dndArea.mouseX, dndArea.mouseY + launcherListView.realContentY) : null
849 readonly property int itemCenter: !hoveredItem ? 0 : root.mapFromItem(hoveredItem, 0, 0).y + (hoveredItem.height / 2) + hoveredItem.offset
850
851 text: !hoveredItem ? "" : hoveredItem.name
852 }
853
854 DSM.StateMachine {
855 id: tooltipStateMachine
856 initialState: tooltipHiddenState
857 running: true
858
859 DSM.State {
860 id: tooltipHiddenState
861
862 DSM.SignalTransition {
863 targetState: tooltipShownState
864 signal: tooltipShape.hoveredItemChanged
865 // !dndArea.pressed allows us to filter out touch input events
866 guard: tooltipShape.hoveredItem !== null && !dndArea.pressed && !root.moving
867 }
868 }
869
870 DSM.State {
871 id: tooltipShownState
872
873 DSM.SignalTransition {
874 targetState: tooltipHiddenState
875 signal: tooltipShape.hoveredItemChanged
876 guard: tooltipShape.hoveredItem === null
877 }
878
879 DSM.SignalTransition {
880 targetState: tooltipDismissedState
881 signal: dndArea.onPressed
882 }
883
884 DSM.SignalTransition {
885 targetState: tooltipDismissedState
886 signal: quickList.stateChanged
887 guard: quickList.state === "open"
888 }
889 }
890
891 DSM.State {
892 id: tooltipDismissedState
893
894 DSM.SignalTransition {
895 targetState: tooltipHiddenState
896 signal: dndArea.positionChanged
897 guard: quickList.state != "open" && !dndArea.pressed && !dndArea.moving
898 }
899
900 DSM.SignalTransition {
901 targetState: tooltipHiddenState
902 signal: dndArea.exited
903 guard: quickList.state != "open"
904 }
905 }
906 }
831}907}
832908
=== added file 'qml/Launcher/Tooltip.qml'
--- qml/Launcher/Tooltip.qml 1970-01-01 00:00:00 +0000
+++ qml/Launcher/Tooltip.qml 2016-11-24 16:06:51 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19
20UbuntuShape {
21 id: root
22
23 // This property holds the delay (milliseconds) after which the tool tip is shown.
24 // A tooltip with a negative delay is shown immediately. The default value is 500 ms.
25 property int delay: 500
26
27 // This property holds the text shown on the tool tip.
28 property alias text: label.text
29
30 aspect: UbuntuShape.Flat
31 color: theme.palette.normal.background
32 width: label.implicitWidth + units.gu(4)
33 height: label.implicitHeight + units.gu(2)
34 opacity: 0
35
36 Image {
37 anchors {
38 right: parent.left
39 rightMargin: -units.dp(4)
40 verticalCenter: parent.verticalCenter
41 }
42 source: "graphics/quicklist_tooltip.png"
43 rotation: 90
44 }
45
46 Label {
47 id: label
48 anchors.centerIn: parent
49 color: theme.palette.normal.backgroundText
50 }
51
52 states: [
53 State {
54 name: "visible"
55 when: root.visible
56 PropertyChanges {
57 target: root
58 opacity: 0.95
59 }
60 }
61 ]
62
63 transitions: [
64 Transition {
65 from: ""; to: "visible"
66 SequentialAnimation {
67 PauseAnimation { duration: root.delay }
68 UbuntuNumberAnimation { target: root; property: "opacity"; duration: UbuntuAnimation.BriskDuration }
69 }
70 }
71 ]
72}
0\ No newline at end of file73\ No newline at end of file
174
=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
--- tests/qmltests/Launcher/tst_Launcher.qml 2016-11-16 10:44:13 +0000
+++ tests/qmltests/Launcher/tst_Launcher.qml 2016-11-24 16:06:51 +0000
@@ -1369,6 +1369,95 @@
1369 tryCompare(clickThroughSpy, "count", 0);1369 tryCompare(clickThroughSpy, "count", 0);
1370 }1370 }
13711371
1372 function test_tooltip() {
1373 launcher.lockedVisible = true;
1374 revealByEdgePush();
1375
1376 var item = findChild(launcher, "launcherDelegate0");
1377 var tooltipShape = findChild(launcher, "tooltipShape");
1378
1379 // Initial state
1380 tryCompare(tooltipShape, "visible", false);
1381 tryCompare(tooltipShape, "opacity", .0);
1382
1383 // Move the mouse on the launcher icon
1384 mouseMove(item, item.width / 2, item.height / 2, 10);
1385 mouseMove(item, item.width / 2 + 1, item.height / 2, 10);
1386 tryCompare(tooltipShape, "visible", true);
1387 tryCompare(tooltipShape, "opacity", .95);
1388
1389 // Move the mouse away
1390 mouseMove(root, root.width, root.height / 2, 10);
1391 tryCompare(tooltipShape, "visible", false);
1392 tryCompare(tooltipShape, "opacity", .0);
1393 }
1394
1395 function test_quicklist_dismisses_tooltip() {
1396 launcher.lockedVisible = true;
1397 revealByEdgePush();
1398
1399 var item = findChild(launcher, "launcherDelegate0");
1400 var tooltipShape = findChild(launcher, "tooltipShape");
1401 var quickListShape = findChild(launcher, "quickListShape");
1402
1403 // Initial state
1404 tryCompare(tooltipShape, "visible", false);
1405 tryCompare(tooltipShape, "opacity", .0);
1406
1407 // Move the mouse on the launcher icon
1408 mouseMove(item, item.width / 2, item.height / 2, 10);
1409 mouseMove(item, item.width / 2 + 1, item.height / 2, 10);
1410 tryCompare(tooltipShape, "visible", true);
1411 tryCompare(tooltipShape, "opacity", .95);
1412
1413 // Right click to show the quicklist
1414 mouseClick(item, item.width / 2, item.height / 2, Qt.RightButton);
1415 tryCompare(quickListShape, "visible", true);
1416 tryCompare(tooltipShape, "visible", false);
1417 tryCompare(tooltipShape, "opacity", .0);
1418
1419 // Left click hides the quicklist, tooltip is still dismissed
1420 mouseClick(item, item.width / 2, item.height / 2, Qt.LefftButton);
1421 tryCompare(quickListShape, "visible", false);
1422 tryCompare(tooltipShape, "visible", false);
1423 tryCompare(tooltipShape, "opacity", .0);
1424
1425 // Mouse motion should should show tooltip again
1426 mouseMove(item, item.width / 2, item.height / 2, 10);
1427 mouseMove(item, item.width / 2 + 1, item.height / 2, 10);
1428 tryCompare(tooltipShape, "visible", true);
1429 tryCompare(tooltipShape, "opacity", .95);
1430 }
1431
1432 function test_click_dismisses_tooltip() {
1433 launcher.lockedVisible = true;
1434 revealByEdgePush();
1435
1436 var item = findChild(launcher, "launcherDelegate0");
1437 var tooltipShape = findChild(launcher, "tooltipShape");
1438
1439 // Initial state
1440 tryCompare(tooltipShape, "visible", false);
1441 tryCompare(tooltipShape, "opacity", .0);
1442
1443 // Move the mouse on the launcher icon
1444 mouseMove(item, item.width / 2, item.height / 2, 10);
1445 mouseMove(item, item.width / 2 + 1, item.height / 2, 10);
1446 tryCompare(tooltipShape, "visible", true);
1447 tryCompare(tooltipShape, "opacity", .95);
1448
1449 // Left click should dismiss the tooltip
1450 mouseClick(item, item.width / 2 + 1, item.height / 2, Qt.LeftButton);
1451 tryCompare(tooltipShape, "visible", false);
1452 tryCompare(tooltipShape, "opacity", .0);
1453
1454 // Mouse motion should should show tooltip again
1455 mouseMove(item, item.width / 2, item.height / 2, 10);
1456 mouseMove(item, item.width / 2 + 1, item.height / 2, 10);
1457 tryCompare(tooltipShape, "visible", true);
1458 tryCompare(tooltipShape, "opacity", .95);
1459 }
1460
1372 function test_launcherEnabledSetting() {1461 function test_launcherEnabledSetting() {
1373 launcher.available = true;1462 launcher.available = true;
13741463

Subscribers

People subscribed via source and target branches