on xenial help sign in
Splash screen support
0f0d5aeGerry Boland
qml/Components/Dot.qmlnew file+25
@@ -0,0 +1,25 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+
20+Rectangle {
21+ radius: width
22+ width: units.dp(6)
23+ height: width
24+ color: UbuntuColors.orange
25+}
qml/Components/WaitingDots.qmlnew file+76
@@ -0,0 +1,76 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.2
18+import Ubuntu.Components 0.1
19+
20+Item {
21+ id: waitingDots
22+
23+ // center in parent; waitingDots has no size therefore anchors.centerIn cannot be used
24+ x: parent.width / 2
25+ y: parent.height / 2
26+
27+ property var dots: [dot1, dot2, dot3]
28+ property var vertices: [[-units.gu(1), -units.gu(1)],
29+ [units.gu(1), -units.gu(1)],
30+ [0, units.gu(1)]]
31+ property int shift: 0
32+
33+ function cycle () {
34+ var n = vertices.length;
35+ shift = (shift + 1) % n;
36+
37+ for (var i = 0; i < n; i++) {
38+ dots[i].x = vertices[(i+shift) % n][0];
39+ dots[i].y = vertices[(i+shift) % n][1];
40+ }
41+ }
42+
43+ Timer {
44+ interval: 800
45+ running: waitingDots.visible
46+ repeat: true
47+ triggeredOnStart: true
48+ onTriggered: waitingDots.cycle()
49+ }
50+
51+
52+ Dot {
53+ id: dot1
54+ x: vertices[0][0]
55+ y: vertices[0][1]
56+ Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
57+ Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
58+ }
59+
60+ Dot {
61+ id: dot2
62+ x: vertices[1][0]
63+ y: vertices[1][1]
64+ Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
65+ Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
66+
67+ }
68+
69+ Dot {
70+ id: dot3
71+ x: vertices[2][0]
72+ y: vertices[2][1]
73+ Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
74+ Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
75+ }
76+}
qml/Shell.qml+1−1
@@ -180,7 +180,7 @@ FocusScope {
180 visible: !fullyHidden
180 visible: !fullyHidden
181
181
182 x: shown ? launcher.progress : stagesDragArea.progress
182 x: shown ? launcher.progress : stagesDragArea.progress
183− //Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
183+ Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
184
184
185 property bool shown: false
185 property bool shown: false
186 onShownChanged: {
186 onShownChanged: {
qml/Stages/Splash.qmlnew file+59
@@ -0,0 +1,59 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+*/
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import "../Components"
20+
21+Rectangle {
22+ id: root
23+ color: "black"
24+
25+ property string name: ""
26+ property url image: ""
27+
28+ UbuntuShape {
29+ id: iconShape
30+ anchors.horizontalCenter: parent.horizontalCenter
31+ anchors.verticalCenter: parent.verticalCenter
32+ anchors.verticalCenterOffset: -units.gu(4)
33+
34+ radius: "medium"
35+ borderSource: "none"
36+
37+ image: Image {
38+ id: iconImage
39+ sourceSize.width: iconShape.width
40+ sourceSize.height: iconShape.height
41+ source: root.image
42+ }
43+ }
44+
45+ Label {
46+ text: root.name
47+ anchors.horizontalCenter: parent.horizontalCenter
48+ anchors.top: iconShape.bottom
49+ anchors.topMargin: units.gu(2)
50+ fontSize: "large"
51+ }
52+
53+ WaitingDots {
54+ anchors.horizontalCenter: parent.horizontalCenter
55+ anchors.bottom: parent.bottom
56+ anchors.bottomMargin: units.gu(12)
57+ }
58+
59+}
qml/Stages/SpreadDelegate.qml+65−38
@@ -27,65 +27,92 @@ Item {
27 property real topMarginProgress
27 property real topMarginProgress
28 property bool interactive: true
28 property bool interactive: true
29 property real maximizedAppTopMargin
29 property real maximizedAppTopMargin
30− property var application: ApplicationManager.get(index)
31 property bool dropShadow: true
30 property bool dropShadow: true
32
31
33 // FIXME: This really should be invisible to QML code.
32 // FIXME: This really should be invisible to QML code.
34 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
33 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
35− property var surface: application ? application.surface : null
34+ readonly property var surface: model.surface
36− onSurfaceChanged: {
35+ onSurfaceChanged: { print("SURFACE!!", model.surface)
37 if (surface) {
36 if (surface) {
37+ if (!priv.appHasCreatedASurface) {
38+ surface.visible = false; // hide until splash screen removed
39+ priv.appHasCreatedASurface = true;
40+ }
41+
38 surface.parent = root;
42 surface.parent = root;
43+ surface.anchors.fill = root;
44+ priv.checkFullscreen(surface);
39 surface.z = 1;
45 surface.z = 1;
40 }
46 }
41 }
47 }
42
48
49+ QtObject {
50+ id: priv
51+ property bool appHasCreatedASurface: false
52+
53+ function checkFullscreen(surface) {
54+ if (surface.state === MirSurfaceItem.Fullscreen) {
55+ surface.anchors.topMargin = 0;
56+ } else {
57+ surface.anchors.topMargin = maximizedAppTopMargin;
58+ }
59+ }
60+
61+ function revealSurface() {
62+ surface.visible = true;
63+ splashLoader.source = "";
64+ }
65+ }
66+
67+ Timer { //FIXME - need to delay removing splash screen to allow surface resize to complete
68+ id: surfaceRevealDelay
69+ interval: 100
70+ onTriggered: priv.revealSurface()
71+ }
72+
43 Binding {
73 Binding {
44 target: surface
74 target: surface
45 property: "enabled"
75 property: "enabled"
46 value: root.interactive
76 value: root.interactive
47 }
77 }
48
78
49− state: {
79+ Connections {
50− if (surface) {
80+ target: surface
51− if (surface.state === MirSurfaceItem.Fullscreen) {
81+ onStateChanged: priv.checkFullscreen(surface);
52− "fullscreen";
53− } else {
54− "maximized";
55− }
56− } else {
57− return "empty"
58− }
59 }
82 }
83+
84+ StateGroup {
85+ id: appSurfaceState
60− states: [
86+ states: [
61− State {
87+ State {
62− name: "fullscreen"
88+ name: "noSurfaceYet"
63− PropertyChanges {
89+ when: !priv.appHasCreatedASurface
64− target: surface
90+ StateChangeScript {
65− x: 0
91+ script: {splashLoader.setSource("Splash.qml", { "name": model.name, "image": model.icon }); }
66− y: 0
67− width: root.width
68− height: root.height
69− }
92+ }
70− },
93+ },
71− State {
94+ State {
72− name: "maximized"
95+ name: "hasSurface"
73− PropertyChanges {
96+ when: priv.appHasCreatedASurface && (root.surface !== null)
74− target: surface
97+ StateChangeScript { script: { surfaceRevealDelay.start(); } }
75− x: 0
98+ },
76− y: maximizedAppTopMargin
99+ State {
77− width: root.width
100+ name: "surfaceLostButAppStillAlive"
78− height: root.height - y
101+ when: priv.appHasCreatedASurface && (root.surface === null)
102+ // TODO - use app snapshot
79 }
103 }
80− },
104+ ]
81− State {
105+ state: "noSurfaceYet"
82− name: "empty"
106+ }
83− }
107+
84− ]
108+ Loader {
109+ id: splashLoader
110+ anchors.fill: parent
111+ }
85
112
86 BorderImage {
113 BorderImage {
87 id: dropShadowImage
114 id: dropShadowImage
88− anchors.fill: surface
115+ anchors.fill: parent
89 anchors.margins: -units.gu(2)
116 anchors.margins: -units.gu(2)
90 source: "graphics/dropshadow.png"
117 source: "graphics/dropshadow.png"
91 border { left: 50; right: 50; top: 50; bottom: 50 }
118 border { left: 50; right: 50; top: 50; bottom: 50 }
qml/Stages/StageWithSideStage.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import "../Components"
19import "../Components"
20−import Unity.Application 0.1
20+import Mir.Application 0.1
21import Ubuntu.Gestures 0.1
21import Ubuntu.Gestures 0.1
22
22
23Item {
23Item {