on xenial help sign in
Add AbstractStage item to hold shared stage code
c754c56Michael Terry
qml/Shell.qml−16
@@ -214,22 +214,6 @@ Item {
214 width: parent.width
214 width: parent.width
215 height: parent.height
215 height: parent.height
216
216
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−
233 Connections {
217 Connections {
234 target: ApplicationManager
218 target: ApplicationManager
235
219
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"
25import Utils 0.1
25import Utils 0.1
26import Ubuntu.Gestures 0.1
26import Ubuntu.Gestures 0.1
27
27
28−Rectangle {
28+AbstractStage {
29 id: root
29 id: root
30 anchors.fill: parent
30 anchors.fill: parent
31
31
qml/Stages/PhoneStage.qml+2−2
@@ -22,7 +22,7 @@ import Unity.Session 0.1
22import Utils 0.1
22import Utils 0.1
23import "../Components"
23import "../Components"
24
24
25−Rectangle {
25+AbstractStage {
26 id: root
26 id: root
27
27
28 // Controls to be set from outside
28 // Controls to be set from outside
@@ -442,7 +442,7 @@ Rectangle {
442 target: appDelegate.application
442 target: appDelegate.application
443 property: "requestedState"
443 property: "requestedState"
444 value: !model.isTouchApp
444 value: !model.isTouchApp
445− || stages.isExemptFromLifecycle(model.appId)
445+ || isExemptFromLifecycle(model.appId)
446 || (isDash && root.keepDashRunning)
446 || (isDash && root.keepDashRunning)
447 || (!root.suspended && appDelegate.focus)
447 || (!root.suspended && appDelegate.focus)
448 ? ApplicationInfoInterface.RequestedRunning
448 ? ApplicationInfoInterface.RequestedRunning
qml/Stages/ShimStage.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19
19
20−Rectangle {
20+AbstractStage {
21 id: shimStage
21 id: shimStage
22
22
23 anchors.fill: parent
23 anchors.fill: parent
qml/Stages/TabletStage.qml+2−2
@@ -21,7 +21,7 @@ import Unity.Application 0.1
21import Utils 0.1
21import Utils 0.1
22import "../Components"
22import "../Components"
23
23
24−Rectangle {
24+AbstractStage {
25 id: root
25 id: root
26 objectName: "stages"
26 objectName: "stages"
27 anchors.fill: parent
27 anchors.fill: parent
@@ -633,7 +633,7 @@ Rectangle {
633 target: spreadTile.application
633 target: spreadTile.application
634 property: "requestedState"
634 property: "requestedState"
635 value: !model.isTouchApp
635 value: !model.isTouchApp
636− || stages.isExemptFromLifecycle(model.appId)
636+ || isExemptFromLifecycle(model.appId)
637 || (isDash && root.keepDashRunning)
637 || (isDash && root.keepDashRunning)
638 || (!root.suspended && (model.appId == priv.mainStageAppId
638 || (!root.suspended && (model.appId == priv.mainStageAppId
639 || model.appId == priv.sideStageAppId))
639 || model.appId == priv.sideStageAppId))