on xenial help sign in
Work so far
commit37457f29fcfe770be36e961212f2b4080e9df416 authorGerry Boland <gerry.boland@canonical.com> dateThu 5 Jun 2014, 10:49 (12 years ago) parent444b23c
8 files changed+233−43
qml/Components/Dot.qml+25 qml/Components/WaitingDots.qml+76 qml/Shell.qml+11−1 qml/Stages/PhoneStage.qml+4−3 qml/Stages/Splash.qml+59 qml/Stages/SpreadDelegate.qml+52−37 qml/Stages/StageWithSideStage.qml+1−1 qml/Stages/TabletStage.qml+5−1
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+11−1
@@ -180,7 +180,7 @@ FocusScope {
180180 visible: !fullyHidden
181181
182182 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 } }
184184
185185 property bool shown: false
186186 onShownChanged: {
@@ -225,17 +225,22 @@ FocusScope {
225225 anchors.fill: parent
226226
227227 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
228+ asynchronous: true
229+ visible: status == Loader.Ready
228230
229231 Binding {
230232 target: applicationsDisplayLoader.item
231233 property: "dragAreaWidth"
232234 value: shell.edgeSize
235+ when: applicationsDisplayLoader.status === Loader.Ready
233236 }
234237 Binding {
235238 target: applicationsDisplayLoader.item
236239 property: "maximizedAppTopMargin"
237240 value: panel.panelHeight
241+ when: applicationsDisplayLoader.status === Loader.Ready
238242 }
243+ onLoaded: {print("!!!!!!!!!LOADED", source); gc();}
239244 }
240245 }
241246
@@ -533,6 +538,11 @@ FocusScope {
533538 }
534539 }
535540
541+ InputMethod {
542+ id: inputMethod
543+ anchors.fill: parent
544+ }
545+
536546 focus: true
537547 onFocusChanged: if (!focus) forceActiveFocus();
538548
qml/Stages/PhoneStage.qml+4−3
@@ -36,7 +36,8 @@ Rectangle {
3636 function select(appId) {
3737 spreadView.snapTo(priv.indexOf(appId))
3838 }
39−
39+Component.onCompleted: print("PhoneStage created", root)
40+Component.onDestruction: print("PhoneStage destroyed", root)
4041 onWidthChanged: {
4142 spreadView.selectedIndex = -1;
4243 spreadView.phase = 0;
@@ -57,7 +58,7 @@ Rectangle {
5758 onFocusedApplicationIdChanged: {
5859 if (ApplicationManager.focusedApplicationId.length > 0) {
5960 if (priv.secondApplicationStarting || priv.applicationStarting) {
60− appSplashTimer.restart();
61+ //appSplashTimer.restart(); REMOVEME
6162 } else {
6263 var application = priv.focusedApplication;
6364 root.fullscreen = application.fullscreen;
@@ -109,7 +110,7 @@ Rectangle {
109110 Rectangle {
110111 id: coverFlipBackground
111112 anchors.fill: parent
112− color: "black"
113+ color: "blue"
113114 visible: spreadView.visible
114115 }
115116
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+52−37
@@ -32,9 +32,21 @@ Item {
3232 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
3333 property var surface: application ? application.surface : null
3434 onSurfaceChanged: {
35− if (surface) {
36− surface.parent = root;
37− surface.z = 1;
35+ if (surface && !priv.appHasCreatedASurface) {
36+ priv.appHasCreatedASurface = true;
37+ }
38+ }
39+
40+ QtObject {
41+ id: priv
42+ property bool appHasCreatedASurface: false
43+
44+ function checkFullscreen(surface) {
45+ if (surface.state === MirSurfaceItem.Fullscreen) {
46+ surface.anchors.topMargin = 0;
47+ } else {
48+ surface.anchors.topMargin = maximizedAppTopMargin;
49+ }
3850 }
3951 }
4052
@@ -44,42 +56,42 @@ Item {
4456 value: root.interactive
4557 }
4658
47− state: {
48− if (surface) {
49− if (surface.state === MirSurfaceItem.Fullscreen) {
50− "fullscreen";
51− } else {
52− "maximized";
53− }
54− } else {
55− return "empty"
56− }
59+ Connections {
60+ target: surface
61+ onStateChanged: priv.checkFullScreen(surface);
5762 }
58− states: [
59− State {
60− name: "fullscreen"
61− PropertyChanges {
62− target: surface
63− x: 0
64− y: 0
65− width: root.width
66− height: root.height
67− }
68− },
69− State {
70− name: "maximized"
71− PropertyChanges {
72− target: surface
73− x: 0
74− y: maximizedAppTopMargin
75− width: root.width
76− height: root.height - y
63+
64+ StateGroup {
65+ id: appSurfaceState
66+ states: [
67+ State {
68+ name: "noSurfaceYet"
69+ when: !priv.appHasCreatedASurface
70+ StateChangeScript {
71+ script: {splashLoader.setSource("Splash.qml", { "name": application.name, "image": application.icon }); print("SPLASH!!")}
72+ }
73+ },
74+ State {
75+ name: "hasSurface"
76+ when: priv.appHasCreatedASurface && (root.surface !== null)
77+ PropertyChanges { target: root.surface; parent: root; anchors.fill: parent; z: 1 }
78+ StateChangeScript { script: priv.checkFullscreen(root.surface); }
79+ PropertyChanges { target: splashLoader; source: "" }
80+ },
81+ State {
82+ name: "surfaceLostButAppStillAlive"
83+ when: priv.appHasCreatedASurface && (root.surface === null)
84+ // TODO - use app snapshot
7785 }
78− },
79− State {
80− name: "empty"
81− }
82− ]
86+ ]
87+ state: "noSurfaceYet"
88+ }
89+
90+ Loader {
91+ id: splashLoader
92+ anchors.fill: parent
93+ onLoaded: print("Splash loaded!!")
94+ }
8395
8496 BorderImage {
8597 id: dropShadow
@@ -100,4 +112,7 @@ Item {
100112 root.clicked()
101113 }
102114 }
115+
116+ Component.onCompleted: print("SpreadDelegate created", root, application)
117+ Component.onDestruction: print("SpreadDelegate destroyed", root, application)
103118}
qml/Stages/StageWithSideStage.qml+1−1
@@ -17,7 +17,7 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import "../Components"
20−import Unity.Application 0.1
20+import Mir.Application 0.1
2121import Ubuntu.Gestures 0.1
2222
2323Item {
qml/Stages/TabletStage.qml+5−1
@@ -30,6 +30,7 @@ Item {
3030 property bool shown: false
3131 property bool moving: false
3232 property int dragAreaWidth
33+ property real maximizedAppTopMargin
3334
3435 // State information propagated to the outside
3536 readonly property bool painting: true
@@ -319,11 +320,13 @@ Item {
319320
320321 Rectangle {
321322 id: spreadRow
322− color: "black"
323+ //color: "black"
323324 x: spreadView.contentX
324325 height: root.height
325326 width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
326327
328+ color: "transparent"
329+
327330 Repeater {
328331 id: spreadRepeater
329332 model: ApplicationManager
@@ -343,6 +346,7 @@ Item {
343346 otherSelected: spreadView.selectedIndex >= 0 && !selected
344347 isInSideStage: priv.sideStageAppId == model.appId
345348 interactive: !spreadView.interactive
349+ maximizedAppTopMargin: root.maximizedAppTopMargin
346350
347351 progress: {
348352 var tileProgress = (spreadView.contentX - zIndex * spreadView.tileDistance) / spreadView.width;