2 * Copyright 2014-2015 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 alias interactive: _surfaceContainer.interactive
27 property alias surfaceOrientationAngle: _surfaceContainer.surfaceOrientationAngle
29 readonly property alias surfaceContainer: _surfaceContainer
33 surface: session ? session.surface : null
37 id: childSessionsRepeater
38 model: root.childSessions
41 objectName: "childDelegate" + index
42 anchors.fill: surfaceContainer
44 // Only way to do recursive qml items.
45 source: Qt.resolvedUrl("SessionContainer.qml")
49 // Since a Loader is a FocusScope, propagate its focus to the loaded Item
51 target: item; when: item
52 property: "focus"; value: focus
56 target: item; when: item
57 property: "interactive"; value: index == (childSessionsRepeater.count - 1) && root.interactive
61 target: item; when: item
62 property: "session"; value: modelData
66 target: item; when: item
67 property: "width"; value: root.width
71 target: item; when: item
72 property: "height"; value: root.height
80 when: root.session && !root.session.parentSession
85 when: root.session && root.session.parentSession !== null && root.session.live
86 && !root.session.surface
90 name: "childSessionReady"
91 when: root.session && root.session.parentSession !== null && root.session.live
92 && root.session.surface !== null
96 name: "childSessionZombie"
97 when: root.session && root.session.parentSession !== null && !root.session.live
103 to: "childSessionReady"
104 ScriptAction { script: { if (!surfaceContainer.hadSurface) { animateIn(swipeFromBottom); } } }
107 to: "childSessionZombie"
108 ScriptAction { script: { animateOut(); } }
112 function animateIn(component) {
113 var animation = component.createObject(root, { "container": root, });
116 var tmp = d.animations;
121 function animateOut() {
122 if (d.animations.length > 0) {
123 var tmp = d.animations;
124 var popped = tmp.pop();
125 popped.completed.connect(function() { root.session.release(); } );
133 SwipeFromBottomAnimation {}
138 property var animations: []
140 property var focusedChild: {
141 if (childSessionsRepeater.count == 0) {
142 return _surfaceContainer;
144 return childSessionsRepeater.itemAt(childSessionsRepeater.count - 1);
147 onFocusedChildChanged: {
148 focusedChild.focus = true;