on xenial help sign in
fix tests, some smaller fixes all around
91e4903Michael Zanetti
data/com.canonical.Unity8.gschema.xml+5
@@ -27,6 +27,11 @@
27 <summary>Maximum push needed to overcome edge barrier</summary>
27 <summary>Maximum push needed to overcome edge barrier</summary>
28 <description>How much you have to push (in grid units) the mouse against an edge barrier when sensibility is 1.</description>
28 <description>How much you have to push (in grid units) the mouse against an edge barrier when sensibility is 1.</description>
29 </key>
29 </key>
30+ <key type="b" name="autohide-launcher">
31+ <default>false</default>
32+ <summary>Autohide the launcher</summary>
33+ <description>This will only be applied in windowed mode. In staged mode, the launcher will always hide.</description>
34+ </key>
30 </schema>
35 </schema>
31
36
32 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
37 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
qml/Launcher/Launcher.qml−3
@@ -55,7 +55,6 @@ FocusScope {
55 signal showDashHome()
55 signal showDashHome()
56
56
57 onStateChanged: {
57 onStateChanged: {
58− print("state changed", state)
59 if (state == "") {
58 if (state == "") {
60 dismissTimer.stop()
59 dismissTimer.stop()
61 } else {
60 } else {
@@ -96,7 +95,6 @@ FocusScope {
96
95
97 onLockedVisibleChanged: {
96 onLockedVisibleChanged: {
98 if (lockedVisible && state == "") {
97 if (lockedVisible && state == "") {
99− print("have to show")
100 dismissTimer.stop();
98 dismissTimer.stop();
101 fadeOutAnimation.stop();
99 fadeOutAnimation.stop();
102 switchToNextState("visible")
100 switchToNextState("visible")
@@ -284,7 +282,6 @@ FocusScope {
284 script: {
282 script: {
285 panel.layer.enabled = false
283 panel.layer.enabled = false
286 panel.animate = false;
284 panel.animate = false;
287− print("setting state to \"\"")
288 root.state = "";
285 root.state = "";
289 panel.x = -panel.width
286 panel.x = -panel.width
290 panel.opacity = 1;
287 panel.opacity = 1;
qml/Launcher/LauncherDelegate.qml+1−1
@@ -158,7 +158,7 @@ Item {
158 right: parent.right
158 right: parent.right
159 bottom: parent.bottom
159 bottom: parent.bottom
160 rightMargin: (iconItem.width - root.itemWidth) / 2 - units.dp(2)
160 rightMargin: (iconItem.width - root.itemWidth) / 2 - units.dp(2)
161− margins: units.dp(3)
161+ margins: units.dp(5)
162 }
162 }
163 width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
163 width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
164 height: units.gu(2)
164 height: units.gu(2)
qml/Launcher/LauncherPanel.qml+20−24
@@ -52,14 +52,14 @@ Rectangle {
52 if (highlightIndex >= launcherListView.count) {
52 if (highlightIndex >= launcherListView.count) {
53 highlightIndex = -1;
53 highlightIndex = -1;
54 }
54 }
55− moveAnimation.moveToIndex(Math.max(highlightIndex, 0));
55+ launcherListView.moveToIndex(Math.max(highlightIndex, 0));
56 }
56 }
57 function highlightPrevious() {
57 function highlightPrevious() {
58 highlightIndex--;
58 highlightIndex--;
59 if (highlightIndex <= -2) {
59 if (highlightIndex <= -2) {
60 highlightIndex = launcherListView.count - 1;
60 highlightIndex = launcherListView.count - 1;
61 }
61 }
62− moveAnimation.moveToIndex(Math.max(highlightIndex, 0));
62+ launcherListView.moveToIndex(Math.max(highlightIndex, 0));
63 }
63 }
64 function openQuicklist(index) {
64 function openQuicklist(index) {
65 quickList.open(index);
65 quickList.open(index);
@@ -136,7 +136,6 @@ Rectangle {
136 highlightRangeMode: ListView.ApplyRange
136 highlightRangeMode: ListView.ApplyRange
137 preferredHighlightBegin: (height - itemHeight) / 2
137 preferredHighlightBegin: (height - itemHeight) / 2
138 preferredHighlightEnd: (height + itemHeight) / 2
138 preferredHighlightEnd: (height + itemHeight) / 2
139− spacing: units.gu(1)
140
139
141 // for the single peeking icon, when alert-state is set on delegate
140 // for the single peeking icon, when alert-state is set on delegate
142 property int peekingIndex: -1
141 property int peekingIndex: -1
@@ -165,7 +164,7 @@ Rectangle {
165 // The height of the area where the items reach the final folding angle
164 // The height of the area where the items reach the final folding angle
166 property int foldingStopHeight: foldingStartHeight - itemHeight - spacing
165 property int foldingStopHeight: foldingStartHeight - itemHeight - spacing
167 property int itemWidth: width * .75
166 property int itemWidth: width * .75
168− property int itemHeight: itemWidth * 15 / 16
167+ property int itemHeight: itemWidth * 15 / 16 + units.gu(1)
169 property int clickFlickSpeed: units.gu(60)
168 property int clickFlickSpeed: units.gu(60)
170 property int draggedIndex: dndArea.draggedIndex
169 property int draggedIndex: dndArea.draggedIndex
171 property real realContentY: contentY - originY + topMargin
170 property real realContentY: contentY - originY + topMargin
@@ -193,23 +192,24 @@ Rectangle {
193
192
194 UbuntuNumberAnimation {
193 UbuntuNumberAnimation {
195 id: moveAnimation
194 id: moveAnimation
195+ objectName: "moveAnimation"
196 target: launcherListView
196 target: launcherListView
197 property: "contentY"
197 property: "contentY"
198 function moveTo(contentY) {
198 function moveTo(contentY) {
199 from = launcherListView.contentY;
199 from = launcherListView.contentY;
200 to = contentY;
200 to = contentY;
201− start();
201+ restart();
202 }
202 }
203+ }
203− function moveToIndex(index) {
204+ function moveToIndex(index) {
204− var totalItemHeight = launcherListView.itemHeight + launcherListView.spacing
205+ var totalItemHeight = launcherListView.itemHeight + launcherListView.spacing
205− var itemPosition = index * totalItemHeight;
206+ var itemPosition = index * totalItemHeight;
206− var height = launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin
207+ var height = launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin
207− var distanceToEnd = index == 0 || index == launcherListView.count - 1 ? 0 : totalItemHeight
208+ var distanceToEnd = index == 0 || index == launcherListView.count - 1 ? 0 : totalItemHeight
208− if (itemPosition + totalItemHeight + distanceToEnd > launcherListView.contentY + launcherListView.originY + launcherListView.topMargin + height) {
209+ if (itemPosition + totalItemHeight + distanceToEnd > launcherListView.contentY + launcherListView.originY + launcherListView.topMargin + height) {
209− moveAnimation.moveTo(itemPosition + launcherListView.itemHeight - launcherListView.topMargin - height + distanceToEnd - launcherListView.originY);
210+ moveAnimation.moveTo(itemPosition + launcherListView.itemHeight - launcherListView.topMargin - height + distanceToEnd - launcherListView.originY);
210− } else if (itemPosition - distanceToEnd < launcherListView.contentY - launcherListView.originY + launcherListView.topMargin) {
211+ } else if (itemPosition - distanceToEnd < launcherListView.contentY - launcherListView.originY + launcherListView.topMargin) {
211− moveAnimation.moveTo(itemPosition - distanceToEnd - launcherListView.topMargin + launcherListView.originY);
212+ moveAnimation.moveTo(itemPosition - distanceToEnd - launcherListView.topMargin + launcherListView.originY);
212− }
213 }
213 }
214 }
214 }
215
215
@@ -276,7 +276,7 @@ Rectangle {
276 onAlertingChanged: {
276 onAlertingChanged: {
277 if(alerting) {
277 if(alerting) {
278 if (!dragging && (launcherListView.peekingIndex === -1 || launcher.visibleWidth > 0)) {
278 if (!dragging && (launcherListView.peekingIndex === -1 || launcher.visibleWidth > 0)) {
279− moveAnimation.moveToIndex(index)
279+ launcherListView.moveToIndex(index)
280 if (!dragging && launcher.state !== "visible") {
280 if (!dragging && launcher.state !== "visible") {
281 peekingAnimation.start()
281 peekingAnimation.start()
282 }
282 }
@@ -433,10 +433,8 @@ Rectangle {
433
433
434 // First/last item do the scrolling at more than 12 degrees
434 // First/last item do the scrolling at more than 12 degrees
435 if (index == 0 || index == launcherListView.count - 1) {
435 if (index == 0 || index == launcherListView.count - 1) {
436− if (clickedItem.angle > 12) {
436+ if (clickedItem.angle > 12 || clickedItem.angle < -12) {
437− launcherListView.flick(0, -launcherListView.clickFlickSpeed);
437+ launcherListView.moveToIndex(index);
438− } else if (clickedItem.angle < -12) {
439− launcherListView.flick(0, launcherListView.clickFlickSpeed);
440 } else {
438 } else {
441 root.applicationSelected(LauncherModel.get(index).appId);
439 root.applicationSelected(LauncherModel.get(index).appId);
442 }
440 }
@@ -444,10 +442,8 @@ Rectangle {
444 }
442 }
445
443
446 // the rest launches apps up to an angle of 30 degrees
444 // the rest launches apps up to an angle of 30 degrees
447− if (clickedItem.angle > 30) {
445+ if (clickedItem.angle > 30 || clickedItem.angle < -30) {
448− launcherListView.flick(0, -launcherListView.clickFlickSpeed);
446+ launcherListView.moveToIndex(index);
449− } else if (clickedItem.angle < -30) {
450− launcherListView.flick(0, launcherListView.clickFlickSpeed);
451 } else {
447 } else {
452 root.applicationSelected(LauncherModel.get(index).appId);
448 root.applicationSelected(LauncherModel.get(index).appId);
453 }
449 }
qml/Shell.qml+7−1
@@ -25,6 +25,7 @@ import Ubuntu.Telephony 0.1 as Telephony
25import Unity.Connectivity 0.1
25import Unity.Connectivity 0.1
26import Unity.Launcher 0.1
26import Unity.Launcher 0.1
27import GlobalShortcut 1.0 // has to be before Utils, because of WindowKeysFilter
27import GlobalShortcut 1.0 // has to be before Utils, because of WindowKeysFilter
28+import GSettings 1.0
28import Utils 0.1
29import Utils 0.1
29import Powerd 0.1
30import Powerd 0.1
30import SessionBroadcast 0.1
31import SessionBroadcast 0.1
@@ -558,7 +559,12 @@ Item {
558 superPressed: physicalKeysMapper.superPressed
559 superPressed: physicalKeysMapper.superPressed
559 superTabPressed: physicalKeysMapper.superTabPressed
560 superTabPressed: physicalKeysMapper.superTabPressed
560 panelWidth: shell.usageScenario == "desktop" ? units.gu(10) : units.gu(8)
561 panelWidth: shell.usageScenario == "desktop" ? units.gu(10) : units.gu(8)
561− lockedVisible: shell.usageScenario == "desktop"
562+ lockedVisible: shell.usageScenario == "desktop" && !launcherSettings.autohideLauncher
563+
564+ GSettings {
565+ id: launcherSettings
566+ schema.id: "com.canonical.Unity8"
567+ }
562
568
563 onShowDashHome: showHome()
569 onShowDashHome: showHome()
564 onDash: showDash()
570 onDash: showDash()
tests/qmltests/Launcher/tst_Launcher.qml+21−13
@@ -29,7 +29,7 @@ import Utils 0.1 // For EdgeBarrierSettings
29Item {
29Item {
30 id: root
30 id: root
31 width: units.gu(70)
31 width: units.gu(70)
32− height: units.gu(55)
32+ height: units.gu(70)
33
33
34 Loader {
34 Loader {
35 id: launcherLoader
35 id: launcherLoader
@@ -227,10 +227,6 @@ Item {
227 // growing while populating it with icons etc.
227 // growing while populating it with icons etc.
228 tryCompare(listView, "flicking", false);
228 tryCompare(listView, "flicking", false);
229
229
230− // Make sure noone changed the height of the window. The issue this test case
231− // is verifying only happens on certain heights of the Launcher
232− compare(root.height, units.gu(55));
233−
234 compare(listView.contentY, -listView.topMargin, "Launcher did not start up with first item unfolded");
230 compare(listView.contentY, -listView.topMargin, "Launcher did not start up with first item unfolded");
235
231
236 // Now do check that snapping is in fact enabled
232 // Now do check that snapping is in fact enabled
@@ -285,14 +281,21 @@ Item {
285
281
286 function positionLauncherListAtBeginning() {
282 function positionLauncherListAtBeginning() {
287 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
283 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
288− listView.contentY = -listView.topMargin;
284+ var moveAnimation = findInvisibleChild(listView, "moveAnimation")
285+
286+ listView.moveToIndex(0);
287+
288+ waitForRendering(listView);
289+ tryCompare(moveAnimation, "running", false);
289 }
290 }
290 function positionLauncherListAtEnd() {
291 function positionLauncherListAtEnd() {
291 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
292 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
292− if ((listView.contentHeight + listView.topMargin + listView.bottomMargin) > listView.height) {
293+ var moveAnimation = findInvisibleChild(listView, "moveAnimation")
293− listView.contentY = listView.topMargin + listView.contentHeight
294+
295+ listView.moveToIndex(listView.count -1);
296+
294− - listView.height;
297+ waitForRendering(listView);
295− }
298+ tryCompare(moveAnimation, "running", false);
296 }
299 }
297
300
298 function assertFocusOnIndex(index) {
301 function assertFocusOnIndex(index) {
@@ -431,6 +434,8 @@ Item {
431 dragLauncherIntoView();
434 dragLauncherIntoView();
432 var launcherListView = findChild(launcher, "launcherListView");
435 var launcherListView = findChild(launcher, "launcherListView");
433 for (var i = 0; i < launcherListView.count; ++i) {
436 for (var i = 0; i < launcherListView.count; ++i) {
437+ launcherListView.moveToIndex(i);
438+ waitForRendering(launcherListView);
434 var delegate = findChild(launcherListView, "launcherDelegate" + i)
439 var delegate = findChild(launcherListView, "launcherDelegate" + i)
435 compare(findChild(delegate, "countEmblem").visible, LauncherModel.get(i).countVisible)
440 compare(findChild(delegate, "countEmblem").visible, LauncherModel.get(i).countVisible)
436 // Intentionally allow type coercion (string/number)
441 // Intentionally allow type coercion (string/number)
@@ -491,6 +496,7 @@ Item {
491 launcher.lastSelectedApplication = "";
496 launcher.lastSelectedApplication = "";
492 dragLauncherIntoView();
497 dragLauncherIntoView();
493 var listView = findChild(launcher, "launcherListView");
498 var listView = findChild(launcher, "launcherListView");
499+ var moveAnimation = findInvisibleChild(listView, "moveAnimation")
494
500
495 // flicking is unreliable. sometimes it works, sometimes the
501 // flicking is unreliable. sometimes it works, sometimes the
496 // list view moves just a tiny bit or not at all, making tests fail.
502 // list view moves just a tiny bit or not at all, making tests fail.
@@ -501,12 +507,14 @@ Item {
501 } else {
507 } else {
502 positionLauncherListAtEnd();
508 positionLauncherListAtEnd();
503 }
509 }
504− tryCompare(listView, "flicking", false);
505−
506 var oldY = listView.contentY;
510 var oldY = listView.contentY;
507
511
508 mouseClick(listView, listView.width / 2, data.clickY);
512 mouseClick(listView, listView.width / 2, data.clickY);
513+
514+ if (data.expectFlick) {
515+ tryCompare(moveAnimation, "running", true);
516+ }
509− tryCompare(listView, "flicking", false);
517+ tryCompare(moveAnimation, "running", false);
510
518
511 if (data.expectFlick) {
519 if (data.expectFlick) {
512 verify(listView.contentY != oldY);
520 verify(listView.contentY != oldY);