2 * Copyright 2014 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
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 Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 objectName: "sessionContainer"
23 property QtObject session
24 readonly property var childSessions: session ? session.childSessions : null
25 readonly property alias surface: _surfaceContainer.surface
26 property bool interactive: true
27 property int orientation
29 readonly property alias surfaceContainer: _surfaceContainer
33 surface: session ? session.surface : null
34 orientation: root.orientation
38 target: surfaceContainer.surface
39 when: surfaceContainer.surface
41 value: root.interactive
44 target: surfaceContainer.surface
45 when: surfaceContainer.surface
47 value: root.interactive
51 model: root.childSessions
54 objectName: "childDelegate" + index
55 anchors.fill: surfaceContainer
57 // Only way to do recursive qml items.
58 source: Qt.resolvedUrl("SessionContainer.qml")
61 target: item; when: item
62 property: "interactive"; value: root.interactive
66 target: item; when: item
67 property: "session"; value: modelData
71 target: item; when: item
72 property: "width"; value: root.width
76 target: item; when: item
77 property: "height"; value: root.height
81 target: item; when: item
82 property: "orientation"; value: root.orientation
90 when: root.session && !root.session.parentSession
95 when: root.session && root.session.parentSession !== null && root.session.live
96 && !root.session.surface
100 name: "childSessionReady"
101 when: root.session && root.session.parentSession !== null && root.session.live
102 && root.session.surface !== null
106 name: "childSessionZombie"
107 when: root.session && root.session.parentSession !== null && !root.session.live
113 to: "childSessionReady"
114 ScriptAction { script: { if (!surfaceContainer.hadSurface) { animateIn(swipeFromBottom); } } }
117 to: "childSessionZombie"
118 ScriptAction { script: { animateOut(); } }
122 function animateIn(component) {
123 var animation = component.createObject(root, { "container": root, });
126 var tmp = d.animations;
131 function animateOut() {
132 if (d.animations.length > 0) {
133 var tmp = d.animations;
134 var popped = tmp.pop();
135 popped.completed.connect(function() { root.session.release(); } );
143 SwipeFromBottomAnimation {}
148 property var animations: []