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 alias interactive: _surfaceContainer.interactive
27 property int orientation
29 readonly property alias surfaceContainer: _surfaceContainer
33 surface: session ? session.surface : null
34 orientation: root.orientation
39 model: root.childSessions
42 objectName: "childDelegate" + index
43 anchors.fill: surfaceContainer
45 // Only way to do recursive qml items.
46 source: Qt.resolvedUrl("SessionContainer.qml")
49 target: item; when: item
50 property: "interactive"; value: root.interactive
54 target: item; when: item
55 property: "session"; value: modelData
59 target: item; when: item
60 property: "width"; value: root.width
64 target: item; when: item
65 property: "height"; value: root.height
69 target: item; when: item
70 property: "orientation"; value: root.orientation
73 Component.onDestruction: {
74 root.session.surface.forceActiveFocus();
82 when: root.session && !root.session.parentSession
87 when: root.session && root.session.parentSession !== null && root.session.live
88 && !root.session.surface
92 name: "childSessionReady"
93 when: root.session && root.session.parentSession !== null && root.session.live
94 && root.session.surface !== null
98 name: "childSessionZombie"
99 when: root.session && root.session.parentSession !== null && !root.session.live
105 to: "childSessionReady"
106 ScriptAction { script: { if (!surfaceContainer.hadSurface) { animateIn(swipeFromBottom); } } }
109 to: "childSessionZombie"
110 ScriptAction { script: { animateOut(); } }
114 function animateIn(component) {
115 var animation = component.createObject(root, { "container": root, });
118 var tmp = d.animations;
123 function animateOut() {
124 if (d.animations.length > 0) {
125 var tmp = d.animations;
126 var popped = tmp.pop();
127 popped.completed.connect(function() { root.session.release(); } );
135 SwipeFromBottomAnimation {}
140 property var animations: []