on xenial help sign in
drop RunningApplications stuff
commitbdf9c74c0cd361537b76b702acf1f526c716ad30 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 22 Jul 2014, 10:45 (12 years ago) parent96223d2
11 files changed+5−543
qml/Dash/Apps/CloseIcon.qml−62 qml/Dash/Apps/RunningApplicationTile.qml−136 qml/Dash/Apps/RunningApplicationsGrid.qml−105 qml/Dash/Apps/graphics/close_btn@9.png qml/Dash/DashContent.qml+1−3 qml/Dash/GenericScopeView.qml+1−8 tests/autopilot/unity8/shell/emulators/dash.py−4 tests/autopilot/unity8/shell/tests/test_emulators.py+1−1 tests/qmltests/CMakeLists.txt−1 tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qml−217 tests/qmltests/tst_Shell.qml+2−6
qml/Dash/Apps/CloseIcon.qmldeleted−62
@@ -1,62 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−
17−import QtQuick 2.0
18−
19−Item {
20− id: root
21−
22− Image {
23− id: closeIcon
24− anchors.centerIn: parent
25− source: "graphics/close_btn.png"
26−
27− state: (root.enabled) ? "shown" : "hidden"
28−
29− states: [
30− State {
31− name: "shown"
32− PropertyChanges {
33− target: closeIcon
34− height: root.height
35− width: root.width
36− }
37− },
38− State {
39− name: "hidden"
40− PropertyChanges {
41− target: closeIcon
42− height: 0
43− width: 0
44− }
45− }
46−
47− ]
48− transitions: [
49− Transition {
50− to: "shown"
51− NumberAnimation {
52− properties: "width, height"; duration: 300
53− easing { type: Easing.OutBack; overshoot: 5 }
54− }
55− },
56− Transition {
57− to: "hidden"
58− NumberAnimation { properties: "width, height"; duration: 250; }
59− }
60− ]
61− }
62−}
qml/Dash/Apps/RunningApplicationTile.qmldeleted−136
@@ -1,136 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import Unity.Application 0.1
20−import "../../Components/"
21−import "../../Components/ListItems"
22−
23−AbstractButton {
24− id: root
25− property var application
26−
27− signal requestedApplicationActivation(var application)
28− signal requestedApplicationTermination(var application)
29− signal requestedActivationMode()
30− signal requestedTerminationMode()
31−
32− width: thumbnail.width
33− height: thumbnail.height + labelContainer.height
34−
35− property bool terminationModeEnabled: false
36−
37− onClicked: {
38− if (!terminationModeEnabled)
39− requestedApplicationActivation(application)
40− }
41−
42− onPressAndHold: {
43− if (terminationModeEnabled) {
44− requestedActivationMode()
45− } else {
46− requestedTerminationMode()
47− }
48− }
49−
50− Item {
51− id: thumbnail
52−
53− width: shapedApplicationImage.width
54− height: shapedApplicationImage.height
55−
56− UbuntuShape {
57− id: shapedApplicationImage
58− x: 0
59− y: 0
60− height: applicationImage.height
61− width: applicationImage.width
62− radius: "medium"
63−
64− image: Image {
65− id: applicationImage
66− source: application.screenshot
67− // height : width = ss.height : ss.width
68−
69− property bool isLandscape: sourceSize.width > sourceSize.height
70− property real maxDimension: units.gu(17)
71−
72− width: isLandscape ? Math.min(sourceSize.width, maxDimension) : height * (sourceSize.width / sourceSize.height)
73− height: isLandscape ? width * (sourceSize.height / sourceSize.width) : Math.min(sourceSize.height, maxDimension)
74− fillMode: Image.Stretch
75− }
76−
77− }
78−
79− UbuntuShape {
80− id: borderPressed
81−
82− anchors.fill: shapedApplicationImage
83− radius: "medium"
84− borderSource: "radius_pressed.sci"
85− opacity: root.pressed ? 1.0 : 0.0
86− Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
87− }
88− }
89−
90− // FIXME: label code duplicated with Tile
91− Item {
92− id: labelContainer
93− anchors {
94− left: thumbnail.left
95− right: thumbnail.right
96− top: thumbnail.bottom
97− }
98− height: units.gu(2)
99−
100− Label {
101− id: label
102− anchors {
103− baseline: parent.bottom
104− left: parent.left
105− right: parent.right
106− }
107− text: (application) ? application.name : ""
108−
109− // TODO karni: Update Ubuntu.Components.Themes.Palette and use theme color instead
110− color: "grey"
111− opacity: 0.9
112− fontSize: "small"
113− elide: Text.ElideMiddle
114− horizontalAlignment: Text.AlignHCenter
115− }
116− }
117−
118− CloseIcon {
119− objectName: "closeIcon " + model.name
120− anchors {
121− left: thumbnail.left
122− leftMargin: -units.gu(1)
123− top: thumbnail.top
124− topMargin: -units.gu(1)
125− }
126− height: units.gu(6)
127− width: units.gu(6)
128− id: closeIcon
129− enabled: root.terminationModeEnabled
130−
131− MouseArea {
132− anchors { fill: parent; margins: -units.gu(1) }
133− onClicked: requestedApplicationTermination(application)
134− }
135− }
136−}
qml/Dash/Apps/RunningApplicationsGrid.qmldeleted−105
@@ -1,105 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−
17−import QtQuick 2.0
18−import "../../Components"
19−
20−import Ubuntu.Gestures 0.1
21−import Unity.Application 0.1
22−
23−ResponsiveFlowView {
24− id: root
25− clip: true
26−
27− signal updateScreenshots
28− property alias enableHeightBehavior: heightBehaviour.enabled
29− property bool enableHeightBehaviorOnNextCreation: model.count === 0
30−
31− Behavior on height {
32− id: heightBehaviour
33− enabled: false
34− NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
35− }
36−
37− Connections {
38− target: root.model
39− onCountChanged: {
40− heightBehaviour.enabled = true;
41− }
42− }
43−
44− property bool canEnableTerminationMode: true
45−
46− onCanEnableTerminationModeChanged: {
47− if (!canEnableTerminationMode)
48− terminationModeEnabled = false
49− }
50−
51− // when false, it means it's on activation mode
52− property bool terminationModeEnabled: false
53−
54− maximumNumberOfColumns: 10
55− minimumHorizontalSpacing: units.gu(2)
56− referenceDelegateWidth: units.gu(11)
57− verticalSpacing: units.gu(2)
58−
59− delegate: Item {
60− width: runningAppTile.width + root.horizontalSpacing
61− height: runningAppTile.height + root.verticalSpacing
62−
63− RunningApplicationTile {
64− id: runningAppTile
65− objectName: "runningAppTile " + model.name
66− anchors {
67− top: parent.top
68− horizontalCenter: parent.horizontalCenter
69− }
70− application: model
71− onRequestedActivationMode: { root.terminationModeEnabled = false }
72− onRequestedTerminationMode: {
73− if (canEnableTerminationMode)
74− root.terminationModeEnabled = true
75− }
76− onRequestedApplicationTermination: {
77− ApplicationManager.stopApplication(model.appId)
78− }
79− onRequestedApplicationActivation: {
80− ApplicationManager.requestFocusApplication(model.appId)
81− }
82−
83− terminationModeEnabled: root.terminationModeEnabled
84− }
85− }
86−
87− move: Transition {
88− NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutCubic }
89− }
90−
91− MouseArea {
92− anchors.fill: parent
93− z: -1 // behind all RunningApplicationTiles
94− enabled: root.terminationModeEnabled
95− onPressed: { root.terminationModeEnabled = false; }
96− }
97−
98− PressedOutsideNotifier {
99− anchors.fill: parent
100− enabled: root.terminationModeEnabled
101− onPressedOutside: {
102− root.terminationModeEnabled = false;
103− }
104− }
105−}
qml/Dash/Apps/graphics/close_btn@9.pngdeleted

Binary file not shown.

qml/Dash/DashContent.qml+1−3
@@ -126,9 +126,7 @@ Item {
126126 return xPositionRelativetoView > -width && xPositionRelativetoView < width
127127 }
128128 asynchronous: true
129− // TODO This if will eventually go away since we're killing DashApps.qml
130− // once we move app closing to the spread
131− source: (scope.id == "clickscope") ? "DashApps.qml" : "GenericScopeView.qml"
129+ source: "GenericScopeView.qml"
132130 objectName: scope.id + " loader"
133131
134132 readonly property bool moving: item ? item.moving : false
qml/Dash/GenericScopeView.qml+1−8
@@ -166,14 +166,7 @@ FocusScope {
166166 item.enableHeightBehavior = scopeView.enableHeightBehaviorOnNextCreation;
167167 scopeView.enableHeightBehaviorOnNextCreation = false;
168168 }
169− if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
170− // TODO: this is still a kludge :D Ideally add some kind of hook so that we
171− // can do this from DashApps.qml or think a better way that needs no special casing
172− item.model = Qt.binding(function() { return runningApps; })
173− item.canEnableTerminationMode = Qt.binding(function() { return scopeView.isCurrent })
174− } else {
175− item.model = Qt.binding(function() { return results })
176− }
169+ item.model = Qt.binding(function() { return results })
177170 item.objectName = Qt.binding(function() { return categoryId })
178171 item.scopeStyle = scopeView.scopeStyle;
179172 if (item.expandable) {
tests/autopilot/unity8/shell/emulators/dash.py−4
@@ -183,10 +183,6 @@ class GenericScopeView(emulators.UnityEmulatorBase):
183183 raise emulators.UnityEmulatorException(
184184 'No category found with name {}'.format(category))
185185
186−
187−class DashApps(GenericScopeView):
188− """Autopilot emulator for the applications scope."""
189−
190186 def get_applications(self, category):
191187 """Return the list of applications on a category.
192188
tests/autopilot/unity8/shell/tests/test_emulators.py+1−1
@@ -141,7 +141,7 @@ class DashEmulatorTestCase(DashBaseTestCase):
141141 scope_id = 'clickscope'
142142 scope = self.dash.open_scope(scope_id)
143143 self._assert_scope_is_opened(scope, scope_id)
144− self.assertIsInstance(scope, dash_emulators.DashApps)
144+ self.assertIsInstance(scope, dash_emulators.GenericScopeView)
145145
146146
147147class GenericScopeViewEmulatorTestCase(DashBaseTestCase):
tests/qmltests/CMakeLists.txt−1
@@ -40,7 +40,6 @@ add_qml_test(Dash Card)
4040add_qml_benchmark(Dash CardBenchmark 1000)
4141add_qml_test(Dash CardTool)
4242add_qml_test(Dash GenericScopeView)
43−add_qml_test(Dash/Apps RunningApplicationsGrid)
4443add_qml_test(Dash/Previews Preview)
4544add_qml_test(Dash/Previews PreviewActions)
4645add_qml_test(Dash/Previews PreviewAudioPlayback)
tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qmldeleted−217
@@ -1,217 +0,0 @@
1−/*
2− * Copyright 2013 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−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../../qml/Dash/Apps"
20−import Unity.Test 0.1 as UT
21−import Unity.Application 0.1
22−import Ubuntu.Components 1.1
23−
24−// Using Rectangle to have an opaque surface because AppManager paints app surfaces behind it.
25−Rectangle {
26− width: units.gu(70)
27− height: units.gu(40)
28−
29− function resetRunningApplications() {
30− while (ApplicationManager.count > 0) {
31− ApplicationManager.stopApplication(ApplicationManager.get(0).appId)
32− }
33−
34− ApplicationManager.startApplication("dialer-app");
35− ApplicationManager.startApplication("webbrowser-app");
36− }
37−
38− Component.onCompleted: {
39− resetRunningApplications()
40− }
41−
42− // The component under test
43− RunningApplicationsGrid {
44− id: runningApplicationsGrid
45− orientationAngle: orientationAngleSelector.selectedIndex * 90
46− anchors.left: parent.left
47− anchors.right: controlPanel.left
48− anchors.top: parent.top
49− anchors.bottom: parent.bottom
50− model: ApplicationManager
51− }
52−
53− Rectangle {
54− id: controlPanel
55− anchors.right: parent.right
56− anchors.top: parent.top
57− anchors.bottom: parent.bottom
58− width: units.gu(20)
59− color: "black"
60−
61− OptionSelector {
62− id: orientationAngleSelector
63− model: ["0","90","180","270"]
64− text: "Orientation Angle"
65− width: parent.width
66− }
67− }
68−
69− UT.UnityTestCase {
70− name: "RunningApplicationsGrid"
71− when: windowShown
72−
73− function init() {
74− runningApplicationsGrid.terminationModeEnabled = false
75− resetRunningApplications()
76− }
77−
78− property var browserTile
79− property var phoneTile
80−
81− property var isBrowserLongPressed: false
82− function onBrowserLongPressed() {isBrowserLongPressed = true}
83−
84− property var isPhoneLongPressed: false
85− function onPhoneLongPressed() {isPhoneLongPressed = true}
86−
87− // Tiles should go to termination mode when any one of them is long-pressed.
88− // Long-pressing when they're in termination mode brings them back to activation mode
89− function test_enterTerminationMode() {
90− browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
91− verify(browserTile != undefined)
92− browserTile.onPressAndHold.connect(onBrowserLongPressed)
93−
94− phoneTile = findChild(runningApplicationsGrid, "runningAppTile Dialer")
95− verify(phoneTile != undefined)
96− phoneTile.onPressAndHold.connect(onPhoneLongPressed)
97−
98− compare(browserTile.terminationModeEnabled, false)
99− compare(phoneTile.terminationModeEnabled, false)
100− compare(runningApplicationsGrid.terminationModeEnabled, false)
101−
102− isBrowserLongPressed = false
103− mousePress(browserTile, browserTile.width/2, browserTile.height/2)
104− tryCompareFunction(checkSwitchToTerminationModeAfterLongPress, true)
105−
106− mouseRelease(browserTile, browserTile.width/2, browserTile.height/2)
107−
108− compare(browserTile.terminationModeEnabled, true)
109− compare(phoneTile.terminationModeEnabled, true)
110− compare(runningApplicationsGrid.terminationModeEnabled, true)
111−
112− isPhoneLongPressed = false
113− mousePress(phoneTile, phoneTile.width/2, phoneTile.height/2)
114− tryCompareFunction(checkSwitchToActivationModeAfterLongPress, true)
115−
116− mouseRelease(phoneTile, phoneTile.width/2, phoneTile.height/2)
117−
118− compare(browserTile.terminationModeEnabled, false)
119− compare(phoneTile.terminationModeEnabled, false)
120− compare(runningApplicationsGrid.terminationModeEnabled, false)
121−
122− browserTile.onPressAndHold.disconnect(onBrowserLongPressed)
123− phoneTile.onPressAndHold.disconnect(onPhoneLongPressed)
124− }
125−
126− // Checks that components swicth to termination mode after (and only after) a long
127− // press happens on Browser tile.
128− function checkSwitchToTerminationModeAfterLongPress() {
129− compare(browserTile.terminationModeEnabled, isBrowserLongPressed)
130− compare(phoneTile.terminationModeEnabled, isBrowserLongPressed)
131− compare(runningApplicationsGrid.terminationModeEnabled, isBrowserLongPressed)
132−
133− return isBrowserLongPressed &&
134− browserTile.terminationModeEnabled &&
135− phoneTile.terminationModeEnabled &&
136− runningApplicationsGrid.terminationModeEnabled
137− }
138−
139− // Checks that components swicth to activation mode after (and only after) a long
140− // press happens on Phone tile.
141− function checkSwitchToActivationModeAfterLongPress() {
142− compare(browserTile.terminationModeEnabled, !isPhoneLongPressed)
143− compare(phoneTile.terminationModeEnabled, !isPhoneLongPressed)
144− compare(runningApplicationsGrid.terminationModeEnabled, !isPhoneLongPressed)
145−
146− return isPhoneLongPressed &&
147− !browserTile.terminationModeEnabled &&
148− !phoneTile.terminationModeEnabled &&
149− !runningApplicationsGrid.terminationModeEnabled
150− }
151−
152− // While on termination mode, clicking a running application tile, outside of
153− // the close icon should do nothing
154− function test_clickTileNotClose() {
155− runningApplicationsGrid.terminationModeEnabled = true
156−
157− var browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
158− verify(browserTile != undefined)
159−
160− verify(ApplicationManager.findApplication("webbrowser-app") !== null)
161−
162− mouseClick(browserTile, browserTile.width/2, browserTile.height/2)
163−
164− verify(ApplicationManager.findApplication("webbrowser-app") !== null)
165−
166− // The tile for the Browser app should stay there
167− tryCompareFunction(checkBrowserTileExists, true)
168− }
169−
170− // While in termination mode, clicking on a running application tile's close icon
171− // causes the corresponding application to be terminated
172− function test_clickCloseIconToTerminateApp() {
173− runningApplicationsGrid.terminationModeEnabled = true
174−
175− var browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
176− var browserTileCloseButton = findChild(runningApplicationsGrid, "closeIcon Browser")
177−
178− verify(browserTile != undefined)
179− verify(browserTileCloseButton != undefined)
180− verify(ApplicationManager.findApplication("webbrowser-app") !== 0)
181−
182− mouseClick(browserTileCloseButton, browserTileCloseButton.width/2, browserTileCloseButton.height/2)
183− wait(0) // spin event loop to start any pending animation
184−
185− verify(ApplicationManager.findApplication("webbrowser-app") === null)
186−
187− // The tile for the Browser app should eventually vanish since the
188− // application has been terminated.
189− tryCompareFunction(checkBrowserTileExists, false)
190− }
191−
192− function checkBrowserTileExists() {
193− return findChild(runningApplicationsGrid, "runningAppTile Browser")
194− != undefined
195− }
196−
197− // While in termination mode, if you click outside any of the tiles, the
198− // termination mode is disabled (i.e. we switch back to activation mode).
199− function test_clickOutsideTilesDisablesTerminationMode() {
200− runningApplicationsGrid.terminationModeEnabled = true
201−
202− var browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
203− verify(browserTile != undefined)
204−
205− verify(runningApplicationsGrid.terminationModeEnabled);
206−
207− // Click on the bottom right corner of the grid, where there's no
208− // RunningApplicationTile lying around
209− mouseClick(runningApplicationsGrid,
210− runningApplicationsGrid.width - 1, runningApplicationsGrid.height - 1);
211−
212− wait(0) // spin event loop to ensure that any pending signal emission went through
213−
214− verify(!runningApplicationsGrid.terminationModeEnabled);
215− }
216− }
217−}
tests/qmltests/tst_Shell.qml+2−6
@@ -305,9 +305,9 @@ Item {
305305 - perform long left edge swipe to go minimize the app and go back to the dash.
306306
307307 Expected Results
308− - apps lens shown and Running Apps visible on screen
308+ - apps lens shown
309309 */
310− function test_minimizingAppTakesToRunningApps() {
310+ function test_minimizingAppTakesToDashApps() {
311311 var dashApps = findChild(shell, "clickscope");
312312 swipeUntilScopeViewIsReached(dashApps);
313313
@@ -345,10 +345,6 @@ Item {
345345 tryCompare(appsCategoryListView, "moving", false);
346346
347347 verify(itemIsOnScreen(dashApps));
348−
349− var runningApplicationsGrid = findChild(appsCategoryListView, "running.apps.category");
350− verify(runningApplicationsGrid);
351− verify(itemIsOnScreen(runningApplicationsGrid));
352348 }
353349
354350 // Wait for the whole UI to settle down