on xenial help sign in
Uninvert Launcher in Desktop Mode

Also some little restruturing Approved by: Gerry Boland

commit8471b26225b43663293affb2903bfe183950ef92 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 11 Dec 2014, 13:23 (12 years ago) parent015e1a3e96410e
6 files changed+85−41
qml/Launcher/Launcher.qml+1 qml/Launcher/LauncherPanel.qml+2−1 qml/Shell.qml+7−5 qml/Stages/DecoratedWindow.qml+60 qml/Stages/DesktopStage.qml+8−24 tests/qmltests/tst_Shell.qml+7−11
qml/Launcher/Launcher.qml+1
@@ -24,6 +24,7 @@ Item {
2424 id: root
2525
2626 property bool available: true // can be used to disable all interactions
27+ property alias inverted: panel.inverted
2728
2829 property int panelWidth: units.gu(8)
2930 property int dragAreaWidth: units.gu(1)
qml/Launcher/LauncherPanel.qml+2−1
@@ -29,7 +29,7 @@ Rectangle {
2929 rotation: inverted ? 180 : 0
3030
3131 property var model
32− property bool inverted: true
32+ property bool inverted: false
3333 property bool dragging: false
3434 property bool moving: launcherListView.moving || launcherListView.flicking
3535 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
@@ -54,6 +54,7 @@ Rectangle {
5454 objectName: "buttonShowDashHome"
5555 width: parent.width
5656 height: units.gu(7)
57+ clip: true
5758
5859 UbuntuShape {
5960 anchors {
qml/Shell.qml+7−5
@@ -129,6 +129,11 @@ Item {
129129 sourceSize.width: 0
130130 }
131131
132+ GSettings {
133+ id: usageModeSettings
134+ schema.id: "com.canonical.Unity8"
135+ }
136+
132137 Binding {
133138 target: LauncherModel
134139 property: "applicationManager"
@@ -270,11 +275,6 @@ Item {
270275 source: usageModeSettings.usageMode === "Windowed" ? "Stages/DesktopStage.qml"
271276 : tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
272277
273− GSettings {
274− id: usageModeSettings
275− schema.id: "com.canonical.Unity8"
276− }
277−
278278 Binding {
279279 target: applicationsDisplayLoader.item
280280 property: "objectName"
@@ -733,10 +733,12 @@ Item {
733733 readonly property bool dashSwipe: progress > 0
734734
735735 anchors.top: parent.top
736+ anchors.topMargin: inverted ? 0 : panel.panelHeight
736737 anchors.bottom: parent.bottom
737738 width: parent.width
738739 dragAreaWidth: shell.edgeSize
739740 available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && !greeter.hasLockedApp
741+ inverted: usageModeSettings.usageMode === "Staged"
740742
741743 onShowDashHome: showHome()
742744 onDash: showDash()
qml/Stages/DecoratedWindow.qmlnew file+60
@@ -0,0 +1,60 @@
1+/*
2+ * Copyright (C) 2014 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+ * Authors: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+import QtQuick 2.3
20+import Ubuntu.Components 1.1
21+import Unity.Application 0.1
22+
23+Item {
24+ id: root
25+
26+ property alias application: applicationWindow.application
27+ property alias active: decoration.active
28+
29+ signal requestFocus();
30+ signal close();
31+ signal maximize();
32+ signal minimize();
33+
34+ BorderImage {
35+ anchors {
36+ fill: root
37+ margins: -units.gu(2)
38+ }
39+ source: "graphics/dropshadow2gu.sci"
40+ opacity: .3
41+ Behavior on opacity { UbuntuNumberAnimation {} }
42+ }
43+
44+ WindowDecoration {
45+ id: decoration
46+ anchors { left: parent.left; top: parent.top; right: parent.right }
47+ height: units.gu(3)
48+ title: model.name
49+ onClose: root.close();
50+ onMaximize: root.maximize();
51+ onMinimize: root.minimize();
52+ }
53+
54+ ApplicationWindow {
55+ id: applicationWindow
56+ anchors.fill: parent
57+ anchors.topMargin: units.gu(3)
58+ interactive: index == 0
59+ }
60+}
qml/Stages/DesktopStage.qml+8−24
@@ -61,9 +61,10 @@ Item {
6161
6262 delegate: Item {
6363 id: appDelegate
64− height: units.gu(30)
65− width: units.gu(30)
6664 z: ApplicationManager.count - index
65+ width: units.gu(60)
66+ height: units.gu(50)
67+
6768
6869 states: [
6970 State {
@@ -84,16 +85,6 @@ Item {
8485 }
8586 ]
8687
87− BorderImage {
88− anchors {
89− fill: appDelegate
90− margins: -units.gu(2)
91− }
92− source: "graphics/dropshadow2gu.sci"
93− opacity: .3
94− Behavior on opacity { UbuntuNumberAnimation {} }
95− }
96−
9788 MouseArea {
9889 anchors.fill: parent
9990 anchors.margins: -units.gu(0.5)
@@ -141,21 +132,14 @@ Item {
141132 }
142133 }
143134
144− WindowDecoration {
145− anchors { left: parent.left; top: parent.top; right: parent.right }
146− height: units.gu(3)
147− title: model.name
135+ DecoratedWindow {
136+ anchors.fill: parent
137+ application: ApplicationManager.get(index)
138+ active: ApplicationManager.focusedApplicationId === model.appId
139+
148140 onClose: ApplicationManager.stopApplication(model.appId)
149141 onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")
150142 onMinimize: appDelegate.state = "minimized"
151− active: ApplicationManager.focusedApplicationId == model.appId
152− }
153−
154− ApplicationWindow {
155− anchors.fill: parent
156− anchors.topMargin: units.gu(3)
157− application: ApplicationManager.get(index)
158− interactive: index == 0
159143 }
160144 }
161145 }
tests/qmltests/tst_Shell.qml+7−11
@@ -496,16 +496,8 @@ Item {
496496 function tapOnAppIconInLauncher() {
497497 var launcherPanel = findChild(shell, "launcherPanel");
498498
499− // pick the first icon, the one at the bottom.
499+ // pick the first icon, the one at the top.
500500 var appIcon = findChild(launcherPanel, "launcherDelegate0")
501−
502− // Swipe upwards over the launcher to ensure that this icon
503− // at the bottom is not folded and faded away.
504− var touchStartX = launcherPanel.width / 2;
505− var touchEndY = launcherPanel.height / 2;
506− touchFlick(launcherPanel, touchStartX, 0, touchStartX, touchEndY);
507− tryCompare(launcherPanel, "moving", false);
508−
509501 tap(appIcon, appIcon.width / 2, appIcon.height / 2);
510502 }
511503
@@ -753,13 +745,17 @@ Item {
753745 dragLauncherIntoView();
754746
755747 // Emulate a tap with a finger, where the touch position drifts during the tap.
748+ // This is to test the touch ownership changes. The tap is happening on the button
749+ // area but then drifting into the left edge drag area. This test makes sure
750+ // the touch ownership stays with the button and doesn't move over to the
751+ // left edge drag area.
756752 {
757753 var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
758754 var startPos = buttonShowDashHome.mapToItem(shell,
759− buttonShowDashHome.width * 0.2,
755+ buttonShowDashHome.width * 0.8,
760756 buttonShowDashHome.height * 0.2);
761757 var endPos = buttonShowDashHome.mapToItem(shell,
762− buttonShowDashHome.width * 0.8,
758+ buttonShowDashHome.width * 0.2,
763759 buttonShowDashHome.height * 0.8);
764760 touchFlick(shell, startPos.x, startPos.y, endPos.x, endPos.y);
765761 }