on xenial help sign in
Fixed promptSurface over app splash
8a36dc4Nick Dedekind
qml/Stages/AppSurfaceContainer.qml+53−1
@@ -21,6 +21,34 @@ SurfaceContainer {
21 id: container
21 id: container
22 property var promptSurfaces
22 property var promptSurfaces
23
23
24+ property bool appHasCreatedASurface: false
25+
26+ onSurfaceChanged: {
27+ if (surface) {
28+ if (!appHasCreatedASurface) {
29+ surface.visible = false; // hide until splash screen removed
30+ appHasCreatedASurface = true;
31+ }
32+ }
33+ }
34+
35+ function revealSurface() {
36+ surface.visible = true;
37+ splashLoader.source = "";
38+ }
39+
40+ Timer { //FIXME - need to delay removing splash screen to allow surface resize to complete
41+ id: surfaceRevealDelay
42+ interval: 100
43+ onTriggered: surfaceContainer.revealSurface()
44+ }
45+
46+ Loader {
47+ z: 3
48+ id: splashLoader
49+ anchors.fill: parent
50+ }
51+
24 Repeater {
52 Repeater {
25 model: container.promptSurfaces
53 model: container.promptSurfaces
26
54
@@ -33,7 +61,7 @@ SurfaceContainer {
33 leftMargin: container.surface.anchors.leftMargin
61 leftMargin: container.surface.anchors.leftMargin
34 }
62 }
35
63
36− z: 3 + index
64+ z: 4 + index
37 surface: modelData
65 surface: modelData
38
66
39 Component.onCompleted: {
67 Component.onCompleted: {
@@ -41,4 +69,28 @@ SurfaceContainer {
41 }
69 }
42 }
70 }
43 }
71 }
72+
73+ StateGroup {
74+ id: appSurfaceState
75+ states: [
76+ State {
77+ name: "noSurfaceYet"
78+ when: !surfaceContainer.appHasCreatedASurface
79+ StateChangeScript {
80+ script: { splashLoader.setSource("Splash.qml", { "name": model.name, "image": model.icon }); }
81+ }
82+ },
83+ State {
84+ name: "hasSurface"
85+ when: surfaceContainer.appHasCreatedASurface && (surfaceContainer.surface !== null)
86+ StateChangeScript { script: { surfaceRevealDelay.start(); } }
87+ },
88+ State {
89+ name: "surfaceLostButAppStillAlive"
90+ when: surfaceContainer.appHasCreatedASurface && (surfaceContainer.surface === null)
91+ // TODO - use app snapshot
92+ }
93+ ]
94+ state: "noSurfaceYet"
95+ }
44}
96}
qml/Stages/SpreadDelegate.qml−52
@@ -42,22 +42,6 @@ Item {
42 surface: model.surface
42 surface: model.surface
43 promptSurfaces: model.application.promptSurfaces
43 promptSurfaces: model.application.promptSurfaces
44
44
45− property bool appHasCreatedASurface: false
46−
47− onSurfaceChanged: {
48− if (surface) {
49− if (!appHasCreatedASurface) {
50− surface.visible = false; // hide until splash screen removed
51− appHasCreatedASurface = true;
52− }
53− }
54− }
55−
56− function revealSurface() {
57− surface.visible = true;
58− splashLoader.source = "";
59− }
60−
61 Binding {
45 Binding {
62 target: surfaceContainer.surface
46 target: surfaceContainer.surface
63 property: "anchors.topMargin"
47 property: "anchors.topMargin"
@@ -77,12 +61,6 @@ Item {
77 value: root.interactive
61 value: root.interactive
78 }
62 }
79
63
80− Timer { //FIXME - need to delay removing splash screen to allow surface resize to complete
81− id: surfaceRevealDelay
82− interval: 100
83− onTriggered: surfaceContainer.revealSurface()
84− }
85−
86 Connections {
64 Connections {
87 target: surface
65 target: surface
88 // FIXME: I would rather not need to do this, but currently it doesn't get
66 // FIXME: I would rather not need to do this, but currently it doesn't get
@@ -117,36 +95,6 @@ Item {
117 }
95 }
118 }
96 }
119
97
120−
121− StateGroup {
122− id: appSurfaceState
123− states: [
124− State {
125− name: "noSurfaceYet"
126− when: !surfaceContainer.appHasCreatedASurface
127− StateChangeScript {
128− script: { splashLoader.setSource("Splash.qml", { "name": model.name, "image": model.icon }); }
129− }
130− },
131− State {
132− name: "hasSurface"
133− when: surfaceContainer.appHasCreatedASurface && (surfaceContainer.surface !== null)
134− StateChangeScript { script: { surfaceRevealDelay.start(); } }
135− },
136− State {
137− name: "surfaceLostButAppStillAlive"
138− when: surfaceContainer.appHasCreatedASurface && (surfaceContainer.surface === null)
139− // TODO - use app snapshot
140− }
141− ]
142− state: "noSurfaceYet"
143− }
144−
145− Loader {
146− id: splashLoader
147− anchors.fill: surfaceContainer
148− }
149−
150 DraggingArea {
98 DraggingArea {
151 id: dragArea
99 id: dragArea
152 anchors.fill: parent
100 anchors.fill: parent