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 implicitWidth: _surfaceContainer.implicitWidth
24 implicitHeight: _surfaceContainer.implicitHeight
25 property QtObject session
26 readonly property var childSessions: session ? session.childSessions : null
27 readonly property alias surface: _surfaceContainer.surface
28 property alias interactive: _surfaceContainer.interactive
29 property alias surfaceOrientationAngle: _surfaceContainer.surfaceOrientationAngle
30 property alias resizeSurface: _surfaceContainer.resizeSurface
32 readonly property alias surfaceContainer: _surfaceContainer
36 surface: session ? session.surface : null
40 id: childSessionsRepeater
41 model: root.childSessions
44 objectName: "childDelegate" + index
45 anchors.fill: surfaceContainer
47 // Only way to do recursive qml items.
48 source: Qt.resolvedUrl("SessionContainer.qml")
52 // Since a Loader is a FocusScope, propagate its focus to the loaded Item
54 target: item; when: item
55 property: "focus"; value: focus
59 target: item; when: item
60 property: "interactive"; value: index == (childSessionsRepeater.count - 1) && root.interactive
64 target: item; when: item
65 property: "session"; value: modelData
69 target: item; when: item
70 property: "width"; value: root.width
74 target: item; when: item
75 property: "height"; value: root.height
83 when: root.session && !root.session.parentSession
88 when: root.session && root.session.parentSession !== null && root.session.live
89 && !root.session.surface
93 name: "childSessionReady"
94 when: root.session && root.session.parentSession !== null && root.session.live
95 && root.session.surface !== null
99 name: "childSessionZombie"
100 when: root.session && root.session.parentSession !== null && !root.session.live
106 to: "childSessionReady"
107 ScriptAction { script: { if (!surfaceContainer.hadSurface) { animateIn(swipeFromBottom); } } }
110 to: "childSessionZombie"
111 ScriptAction { script: { animateOut(); } }
115 function animateIn(component) {
116 var animation = component.createObject(root, { "container": root, });
119 var tmp = d.animations;
124 function animateOut() {
125 if (d.animations.length > 0) {
126 var tmp = d.animations;
127 var popped = tmp.pop();
128 popped.completed.connect(function() { root.session.release(); } );
136 SwipeFromBottomAnimation {}
141 property var animations: []
143 property var focusedChild: {
144 if (childSessionsRepeater.count == 0) {
145 return _surfaceContainer;
147 return childSessionsRepeater.itemAt(childSessionsRepeater.count - 1);
150 onFocusedChildChanged: {
151 focusedChild.focus = true;