@@ -50,37 +50,23 @@ FocusScope {
50 // transitions in stateGroup take place.
50 // transitions in stateGroup take place.
51 // More specifically, the moment surfaceContainer.surface gets updated relative to the
51 // More specifically, the moment surfaceContainer.surface gets updated relative to the
52 // other instructions.
52 // other instructions.
53+ print("AAA surface changed,", surface)
53 if (surface) {
54 if (surface) {
54 surfaceContainer.surface = surface;
55 surfaceContainer.surface = surface;
55− d.liveSurface = surface.live;
56− d.hadSurface = false;
56+ d.hadSurface = true;
57 surfaceInitTimer.start();
57 surfaceInitTimer.start();
59− if (d.surfaceInitialized) {
62 d.surfaceInitialized = false;
59 d.surfaceInitialized = false;
63 surfaceContainer.surface = null;
60 surfaceContainer.surface = null;
64+ Component.onCompleted: print("AAA completed")
67 QtObject {
65 QtObject {
70− property bool liveSurface: false;
68+ onHadSurfaceChanged: print("AAA had surface changed,", hadSurface)
71− property var con: Connections {
69+ onSurfaceInitializedChanged: print("AAA surface initialized changed", surfaceInitialized)
73− onLiveChanged: d.liveSurface = root.surface.live
75− // using liveSurface instead of root.surface.live because with the latter
76− // this expression is not reevaluated when root.surface changes
77− readonly property bool needToTakeScreenshot: root.surface && d.surfaceInitialized && !d.liveSurface
78− && applicationState !== ApplicationInfoInterface.Running
79− onNeedToTakeScreenshotChanged: {
80− if (needToTakeScreenshot && screenshotImage.status === Image.Null) {
81− screenshotImage.take();
85 // helpers so that we don't have to check for the existence of an application everywhere
71 // helpers so that we don't have to check for the existence of an application everywhere
86 // (in order to avoid breaking qml binding due to a javascript exception)
72 // (in order to avoid breaking qml binding due to a javascript exception)
@@ -141,33 +127,12 @@ FocusScope {
141 onTriggered: { if (stateGroup.state === "surface") { d.surfaceOldEnoughToBeResized = true; } }
127 onTriggered: { if (stateGroup.state === "surface") { d.surfaceOldEnoughToBeResized = true; } }
146− objectName: "screenshotImage"
147− anchors.fill: parent
148− fillMode: Image.PreserveAspectCrop
149− horizontalAlignment: Image.AlignLeft
150− verticalAlignment: Image.AlignTop
151− antialiasing: !root.interactive
155− // Save memory by using a half-resolution (thus quarter size) screenshot.
156− // Do not make this a binding, we can only take the screenshot once!
157− surfaceContainer.grabToImage(
159− screenshotImage.source = result.url;
161− Qt.size(root.width / 2, root.height / 2));
166 id: splashLoader
131 id: splashLoader
167 visible: active
132 visible: active
168 active: false
133 active: false
169 anchors.fill: parent
134 anchors.fill: parent
170− z: screenshotImage.z + 1
135+ z: 1
171 sourceComponent: Component {
136 sourceComponent: Component {
173 id: splash
138 id: splash
@@ -234,172 +199,15 @@ FocusScope {
234 property Item first: null
199 property Item first: null
237−// StateGroup {
202+ StateGroup {
238−// id: stateGroup
203+ id: stateGroup
239−// objectName: "applicationWindowStateGroup"
204+ objectName: "applicationWindowStateGroup"
240−// states: [
205+ states: [
241−// State {
206+ State {
242−// name: "void"
207+ name: "splash"
243−// when:
208+ when: !root.surface && !d.surfaceInitialized && !d.hadSurface
244−// d.hadSurface && (!root.surface || !d.surfaceInitialized)
246−// screenshotImage.status !== Image.Ready
249−// name: "splashScreen"
251−// !d.hadSurface && (!root.surface || !d.surfaceInitialized)
253−// screenshotImage.status !== Image.Ready
258−// (root.surface && d.surfaceInitialized)
261−// (d.applicationState !== ApplicationInfoInterface.Running
262−// && screenshotImage.status !== Image.Ready))
265−// implicitWidth: surfaceContainer.implicitWidth
266−// implicitHeight: surfaceContainer.implicitHeight
270−// name: "screenshot"
272−// screenshotImage.status === Image.Ready
274−// (d.applicationState !== ApplicationInfoInterface.Running
275−// || !root.surface || !d.surfaceInitialized)
278−// // This is a dead end. From here we expect the surface to be removed from the model
279−// // shortly after we stop referencing to it in our SurfaceContainer.
282−// // The surface died while the application is running. It must have been closed
283−// // by the shell or the application decided to destroy it by itself
284−// root.surface && d.surfaceInitialized && !d.liveSurface
285−// && d.applicationState === ApplicationInfoInterface.Running
291−// from: ""; to: "splashScreen"
292−// PropertyAction { target: splashLoader; property: "active"; value: true }
209+ PropertyChanges { target: splashLoader; active: true }
293−// PropertyAction { target: surfaceContainer
294−// property: "visible"; value: false }
297−// from: "splashScreen"; to: "surface"
298−// SequentialAnimation {
299−// PropertyAction { target: surfaceContainer
300−// property: "opacity"; value: 0.0 }
301−// PropertyAction { target: surfaceContainer
302−// property: "visible"; value: true }
303−// UbuntuNumberAnimation { target: surfaceContainer; property: "opacity";
304−// from: 0.0; to: 1.0
305−// duration: UbuntuAnimation.BriskDuration }
306−// ScriptAction { script: {
307−// splashLoader.active = false;
308−// surfaceIsOldTimer.start();
313−// from: "surface"; to: "splashScreen"
314−// SequentialAnimation {
315−// ScriptAction { script: {
316−// surfaceIsOldTimer.stop();
317−// d.surfaceOldEnoughToBeResized = false;
318−// splashLoader.active = true;
319−// surfaceContainer.visible = true;
321−// UbuntuNumberAnimation { target: splashLoader; property: "opacity";
322−// from: 0.0; to: 1.0
323−// duration: UbuntuAnimation.BriskDuration }
324−// PropertyAction { target: surfaceContainer
325−// property: "visible"; value: false }
329−// from: "surface"; to: "screenshot"
330−// SequentialAnimation {
331−// ScriptAction { script: {
332−// surfaceIsOldTimer.stop();
333−// d.surfaceOldEnoughToBeResized = false;
334−// screenshotImage.visible = true;
336−// UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
337−// from: 0.0; to: 1.0
338−// duration: UbuntuAnimation.BriskDuration }
339−// ScriptAction { script: {
340−// surfaceContainer.visible = false;
341−// surfaceContainer.surface = null;
342−// d.hadSurface = true;
347−// from: "screenshot"; to: "surface"
348−// SequentialAnimation {
349−// PropertyAction { target: surfaceContainer
350−// property: "visible"; value: true }
351−// UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
352−// from: 1.0; to: 0.0
353−// duration: UbuntuAnimation.BriskDuration }
354−// ScriptAction { script: {
355−// screenshotImage.visible = false;
356−// screenshotImage.source = "";
357−// surfaceIsOldTimer.start();
362−// from: "splashScreen"; to: "screenshot"
363−// SequentialAnimation {
364−// PropertyAction { target: screenshotImage
365−// property: "visible"; value: true }
366−// UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
367−// from: 0.0; to: 1.0
368−// duration: UbuntuAnimation.BriskDuration }
369−// PropertyAction { target: splashLoader; property: "active"; value: false }
373−// from: "surface"; to: "void"
374−// ScriptAction { script: {
375−// surfaceIsOldTimer.stop();
376−// d.surfaceOldEnoughToBeResized = false;
377−// surfaceContainer.visible = false;
381−// from: "void"; to: "surface"
382−// SequentialAnimation {
383−// PropertyAction { target: surfaceContainer; property: "opacity"; value: 0.0 }
384−// PropertyAction { target: surfaceContainer; property: "visible"; value: true }
385−// UbuntuNumberAnimation { target: surfaceContainer; property: "opacity";
386−// from: 0.0; to: 1.0
387−// duration: UbuntuAnimation.BriskDuration }
388−// ScriptAction { script: {
389−// surfaceIsOldTimer.start();
395−// SequentialAnimation {
396−// ScriptAction { script: {
397−// surfaceContainer.visible = false;
398−// surfaceContainer.surface = null;
399−// d.hadSurface = true;