@@ -54,35 +54,66 @@ Item {
5454
5555 // Only way to do recursive qml items.
5656 source: Qt.resolvedUrl("SessionContainer.qml")
57− onLoaded: {
58− item.session = modelData;
59− item.interactive = Qt.binding(function() { return root.interactive; } );
60− if (!modelData.live) {
61− modelData.release();
62− }
63− if (modelData.surface) {
64− item.animateIn(swipeFromBottom);
65− }
57+
58+ Binding {
59+ target: item; when: item
60+ property: "interactive"; value: root.interactive
61+ }
62+
63+ Binding {
64+ target: item; when: item
65+ property: "session"; value: modelData
6666 }
6767
68− Connections {
69− target: modelData
70− onSurfaceChanged: {
71− if (modelData.surface) {
72− item.animateIn();
73− }
74− }
75− onLiveChanged: {
76− if (!modelData.live) {
77− item.animateOut();
78− }
79− }
68+ Binding {
69+ target: item; when: item
70+ property: "width"; value: root.width
71+ }
72+
73+ Binding {
74+ target: item; when: item
75+ property: "height"; value: root.height
8076 }
8177 }
8278 }
8379
84− function animateIn() {
85− var animation = swipeFromBottom.createObject(root, { "container": root, });
80+ states: [
81+ State {
82+ name: "rootSession"
83+ when: root.session && !root.session.parentSession
84+ },
85+
86+ State {
87+ name: "childSession"
88+ when: root.session && root.session.parentSession !== null && root.session.live
89+ && !root.session.surface
90+ },
91+
92+ State {
93+ name: "childSessionReady"
94+ when: root.session && root.session.parentSession !== null && root.session.live
95+ && root.session.surface !== null
96+ },
97+
98+ State {
99+ name: "childSessionZombie"
100+ when: root.session && root.session.parentSession !== null && !root.session.live
101+ }
102+ ]
103+
104+ transitions: [
105+ Transition {
106+ to: "childSessionReady"
107+ ScriptAction { script: { if (!surfaceContainer.hadSurface) { animateIn(swipeFromBottom); } } }
108+ },
109+ Transition {
110+ to: "childSessionZombie"
111+ ScriptAction { script: { animateOut(); } }
112+ }
113+ ]
114+
115+ function animateIn(component) {
116+ var animation = component.createObject(root, { "container": root, });
86117 animation.start();
87118
88119 var tmp = d.animations;
@@ -94,6 +125,7 @@ Item {
94125 if (d.animations.length > 0) {
95126 var tmp = d.animations;
96127 var popped = tmp.pop();
128+ popped.completed.connect(function() { root.session.release(); } );
97129 popped.end();
98130 d.animations = tmp;
99131 }