on xenial help sign in
bring the splash screen back, drop the screenshot image (surfaces keep on to their buffer now anyways)
commite4499be888cf4fd26a2dba856a2e3ed4c0a1c5a5 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 21 Mar 2017, 12:54 (10 years ago) parent12ff9b4
1 file changed+17−209
qml/Stage/ApplicationWindow.qml+17−209
qml/Stage/ApplicationWindow.qml+17−209
@@ -50,37 +50,23 @@ FocusScope {
5050 // transitions in stateGroup take place.
5151 // More specifically, the moment surfaceContainer.surface gets updated relative to the
5252 // other instructions.
53+ print("AAA surface changed,", surface)
5354 if (surface) {
5455 surfaceContainer.surface = surface;
55− d.liveSurface = surface.live;
56− d.hadSurface = false;
56+ d.hadSurface = true;
5757 surfaceInitTimer.start();
5858 } else {
59− if (d.surfaceInitialized) {
60− d.hadSurface = true;
61− }
6259 d.surfaceInitialized = false;
6360 surfaceContainer.surface = null;
6461 }
6562 }
6663
64+ Component.onCompleted: print("AAA completed")
6765 QtObject {
6866 id: d
6967
70− property bool liveSurface: false;
71− property var con: Connections {
72− target: root.surface
73− onLiveChanged: d.liveSurface = root.surface.live
74− }
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();
82− }
83− }
68+ onHadSurfaceChanged: print("AAA had surface changed,", hadSurface)
69+ onSurfaceInitializedChanged: print("AAA surface initialized changed", surfaceInitialized)
8470
8571 // helpers so that we don't have to check for the existence of an application everywhere
8672 // (in order to avoid breaking qml binding due to a javascript exception)
@@ -141,33 +127,12 @@ FocusScope {
141127 onTriggered: { if (stateGroup.state === "surface") { d.surfaceOldEnoughToBeResized = true; } }
142128 }
143129
144− Image {
145− id: screenshotImage
146− objectName: "screenshotImage"
147− anchors.fill: parent
148− fillMode: Image.PreserveAspectCrop
149− horizontalAlignment: Image.AlignLeft
150− verticalAlignment: Image.AlignTop
151− antialiasing: !root.interactive
152− z: 1
153−
154− function take() {
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(
158− function(result) {
159− screenshotImage.source = result.url;
160− },
161− Qt.size(root.width / 2, root.height / 2));
162− }
163− }
164−
165130 Loader {
166131 id: splashLoader
167132 visible: active
168133 active: false
169134 anchors.fill: parent
170− z: screenshotImage.z + 1
135+ z: 1
171136 sourceComponent: Component {
172137 Splash {
173138 id: splash
@@ -234,172 +199,15 @@ FocusScope {
234199 property Item first: null
235200 }
236201
237−// StateGroup {
238−// id: stateGroup
239−// objectName: "applicationWindowStateGroup"
240−// states: [
241−// State {
242−// name: "void"
243−// when:
244−// d.hadSurface && (!root.surface || !d.surfaceInitialized)
245−// &&
246−// screenshotImage.status !== Image.Ready
247−// },
248−// State {
249−// name: "splashScreen"
250−// when:
251−// !d.hadSurface && (!root.surface || !d.surfaceInitialized)
252−// &&
253−// screenshotImage.status !== Image.Ready
254−// },
255−// State {
256−// name: "surface"
257−// when:
258−// (root.surface && d.surfaceInitialized)
259−// &&
260−// (d.liveSurface ||
261−// (d.applicationState !== ApplicationInfoInterface.Running
262−// && screenshotImage.status !== Image.Ready))
263−// PropertyChanges {
264−// target: root
265−// implicitWidth: surfaceContainer.implicitWidth
266−// implicitHeight: surfaceContainer.implicitHeight
267−// }
268−// },
269−// State {
270−// name: "screenshot"
271−// when:
272−// screenshotImage.status === Image.Ready
273−// &&
274−// (d.applicationState !== ApplicationInfoInterface.Running
275−// || !root.surface || !d.surfaceInitialized)
276−// },
277−// State {
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.
280−// name: "closed"
281−// when:
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
286−// }
287−// ]
288−
289−// transitions: [
290−// Transition {
291−// from: ""; to: "splashScreen"
292−// PropertyAction { target: splashLoader; property: "active"; value: true }
293−// PropertyAction { target: surfaceContainer
294−// property: "visible"; value: false }
295−// },
296−// Transition {
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();
309−// } }
310−// }
311−// },
312−// Transition {
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;
320−// } }
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 }
326−// }
327−// },
328−// Transition {
329−// from: "surface"; to: "screenshot"
330−// SequentialAnimation {
331−// ScriptAction { script: {
332−// surfaceIsOldTimer.stop();
333−// d.surfaceOldEnoughToBeResized = false;
334−// screenshotImage.visible = true;
335−// } }
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;
343−// } }
344−// }
345−// },
346−// Transition {
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();
358−// } }
359−// }
360−// },
361−// Transition {
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 }
370−// }
371−// },
372−// Transition {
373−// from: "surface"; to: "void"
374−// ScriptAction { script: {
375−// surfaceIsOldTimer.stop();
376−// d.surfaceOldEnoughToBeResized = false;
377−// surfaceContainer.visible = false;
378−// } }
379−// },
380−// Transition {
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();
390−// } }
391−// }
392−// },
393−// Transition {
394−// to: "closed"
395−// SequentialAnimation {
396−// ScriptAction { script: {
397−// surfaceContainer.visible = false;
398−// surfaceContainer.surface = null;
399−// d.hadSurface = true;
400−// } }
401−// }
402−// }
403−// ]
404−// }
202+ StateGroup {
203+ id: stateGroup
204+ objectName: "applicationWindowStateGroup"
205+ states: [
206+ State {
207+ name: "splash"
208+ when: !root.surface && !d.surfaceInitialized && !d.hadSurface
209+ PropertyChanges { target: splashLoader; active: true }
210+ }
211+ ]
212+ }
405213}