on xenial help sign in
Add AbstractStage item to hold shared stage code
commitc754c5605ff3a0bac9c8f1fa1a9cfa7905f20ecc authorMichael Terry <michael.terry@canonical.com> dateThu 1 Oct 2015, 13:59 (11 years ago) parent846cd64
6 files changed+44−22
qml/Shell.qml−16 qml/Stages/AbstractStage.qml+38 qml/Stages/DesktopStage.qml+1−1 qml/Stages/PhoneStage.qml+2−2 qml/Stages/ShimStage.qml+1−1 qml/Stages/TabletStage.qml+2−2
qml/Shell.qml−16
@@ -214,22 +214,6 @@ Item {
214214 width: parent.width
215215 height: parent.height
216216
217− GSettings {
218− id: lifecycleExceptions
219− schema.id: "com.canonical.qtmir"
220− }
221−
222− // Used by stage code
223− function isExemptFromLifecycle(appId) {
224− var shortAppId = appId.split('_')[0];
225− for (var i = 0; i < lifecycleExceptions.lifecycleExemptAppids.length; i++) {
226− if (shortAppId === lifecycleExceptions.lifecycleExemptAppids[i]) {
227− return true;
228− }
229− }
230− return false;
231− }
232−
233217 Connections {
234218 target: ApplicationManager
235219
qml/Stages/AbstractStage.qmlnew file+38
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (C) 2015 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.4
18+import Ubuntu.Components 1.3
19+import GSettings 1.0
20+
21+Rectangle {
22+ id: root
23+
24+ GSettings {
25+ id: lifecycleExceptions
26+ schema.id: "com.canonical.qtmir"
27+ }
28+
29+ function isExemptFromLifecycle(appId) {
30+ var shortAppId = appId.split('_')[0];
31+ for (var i = 0; i < lifecycleExceptions.lifecycleExemptAppids.length; i++) {
32+ if (shortAppId === lifecycleExceptions.lifecycleExemptAppids[i]) {
33+ return true;
34+ }
35+ }
36+ return false;
37+ }
38+}
qml/Stages/DesktopStage.qml+1−1
@@ -25,7 +25,7 @@ import "../Components/PanelState"
2525import Utils 0.1
2626import Ubuntu.Gestures 0.1
2727
28−Rectangle {
28+AbstractStage {
2929 id: root
3030 anchors.fill: parent
3131
qml/Stages/PhoneStage.qml+2−2
@@ -22,7 +22,7 @@ import Unity.Session 0.1
2222import Utils 0.1
2323import "../Components"
2424
25−Rectangle {
25+AbstractStage {
2626 id: root
2727
2828 // Controls to be set from outside
@@ -442,7 +442,7 @@ Rectangle {
442442 target: appDelegate.application
443443 property: "requestedState"
444444 value: !model.isTouchApp
445− || stages.isExemptFromLifecycle(model.appId)
445+ || isExemptFromLifecycle(model.appId)
446446 || (isDash && root.keepDashRunning)
447447 || (!root.suspended && appDelegate.focus)
448448 ? ApplicationInfoInterface.RequestedRunning
qml/Stages/ShimStage.qml+1−1
@@ -17,7 +17,7 @@
1717import QtQuick 2.3
1818import Ubuntu.Components 0.1
1919
20−Rectangle {
20+AbstractStage {
2121 id: shimStage
2222
2323 anchors.fill: parent
qml/Stages/TabletStage.qml+2−2
@@ -21,7 +21,7 @@ import Unity.Application 0.1
2121import Utils 0.1
2222import "../Components"
2323
24−Rectangle {
24+AbstractStage {
2525 id: root
2626 objectName: "stages"
2727 anchors.fill: parent
@@ -633,7 +633,7 @@ Rectangle {
633633 target: spreadTile.application
634634 property: "requestedState"
635635 value: !model.isTouchApp
636− || stages.isExemptFromLifecycle(model.appId)
636+ || isExemptFromLifecycle(model.appId)
637637 || (isDash && root.keepDashRunning)
638638 || (!root.suspended && (model.appId == priv.mainStageAppId
639639 || model.appId == priv.sideStageAppId))