on xenial help sign in
Fixed promptSurface over app splash
commit8a36dc4950f10a6a6dacb2236eadc2917c5819cf authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 8 Aug 2014, 10:40 (12 years ago) parente25bea4
2 files changed+53−53
qml/Stages/AppSurfaceContainer.qml+53−1 qml/Stages/SpreadDelegate.qml−52
qml/Stages/AppSurfaceContainer.qml+53−1
@@ -21,6 +21,34 @@ SurfaceContainer {
2121 id: container
2222 property var promptSurfaces
2323
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+
2452 Repeater {
2553 model: container.promptSurfaces
2654
@@ -33,7 +61,7 @@ SurfaceContainer {
3361 leftMargin: container.surface.anchors.leftMargin
3462 }
3563
36− z: 3 + index
64+ z: 4 + index
3765 surface: modelData
3866
3967 Component.onCompleted: {
@@ -41,4 +69,28 @@ SurfaceContainer {
4169 }
4270 }
4371 }
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+ }
4496}
qml/Stages/SpreadDelegate.qml−52
@@ -42,22 +42,6 @@ Item {
4242 surface: model.surface
4343 promptSurfaces: model.application.promptSurfaces
4444
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−
6145 Binding {
6246 target: surfaceContainer.surface
6347 property: "anchors.topMargin"
@@ -77,12 +61,6 @@ Item {
7761 value: root.interactive
7862 }
7963
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−
8664 Connections {
8765 target: surface
8866 // FIXME: I would rather not need to do this, but currently it doesn't get
@@ -117,36 +95,6 @@ Item {
11795 }
11896 }
11997
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−
15098 DraggingArea {
15199 id: dragArea
152100 anchors.fill: parent