on xenial help sign in
more fixes and cleanup
commit05e451d240769010c8aa4657edf24effd9146a9b authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 20 Dec 2013, 15:00 (13 years ago) parent9789118
4 files changed+60−56
qml/Dash/Apps/RunningApplicationTile.qml+1−27 qml/Dash/Apps/RunningApplicationsGrid.qml−10 qml/Shell.qml+25−8 Stages/PhoneStage.qml → qml/Stages/PhoneStage.qml+34−11
qml/Dash/Apps/RunningApplicationTile.qml+1−27
@@ -50,9 +50,7 @@ AbstractButton {
5050 }
5151 }
5252
53− Component.onCompleted: print("---------------created apptile", application, application.source)
54−
55− UbuntuShapeForItem {
53+ UbuntuShape {
5654 id: shapedApplicationImage
5755 anchors { top: parent.top; horizontalCenter: parent.horizontalCenter }
5856
@@ -72,30 +70,6 @@ AbstractButton {
7270
7371 }
7472
75−// // FIXME: should use UbuntuShape from SDK
76−// UbuntuShapeForItem {
77−// id: shapedApplicationImage
78−// anchors {
79−// top: parent.top
80−// horizontalCenter: parent.horizontalCenter
81−// }
82−
83−// // FIXME: width and height should be defined according to the
84−// // application window's aspect ratio.
85−// width: (application.stage === ApplicationInfo.MainStage && __sideStageEnabled) ?
86−// units.gu(22) : units.gu(11)
87−// height: (__sideStageEnabled) ? units.gu(22) : units.gu(19)
88−// radius: "medium"
89−// image: applicationImage
90−// }
91−
92−// ApplicationImage {
93−// id: applicationImage
94−// source: ApplicationManager.findApplication((application) ? application.appId : "")
95−// width: shapedApplicationImage.width
96−// height: shapedApplicationImage.height
97−// }
98−
9973 UbuntuShape {
10074 id: borderPressed
10175
qml/Dash/Apps/RunningApplicationsGrid.qml−10
@@ -28,12 +28,6 @@ ResponsiveFlowView {
2828 property alias enableHeightBehavior: heightBehaviour.enabled
2929 property bool enableHeightBehaviorOnNextCreation: model.count === 0
3030
31− Connections {
32− target: shell
33− onDashShownChanged: if (shell.dashShown && shell.stageScreenshotsReady) updateScreenshots();
34− onStageScreenshotsReadyChanged: if (shell.dashShown && shell.stageScreenshotsReady) updateScreenshots();
35− }
36−
3731 Behavior on height {
3832 id: heightBehaviour
3933 enabled: false
@@ -87,10 +81,6 @@ ResponsiveFlowView {
8781 }
8882
8983 terminationModeEnabled: root.terminationModeEnabled
90−
91− Component.onCompleted: {
92− root.updateScreenshots.connect(updateScreenshotFromCache);
93− }
9484 }
9585 }
9686
qml/Shell.qml+25−8
@@ -208,17 +208,19 @@ FocusScope {
208208 width: parent.width
209209 height: parent.height
210210
211+ property string lastFocusedAppId
211212 onShownChanged: {
212213 print("stages shown", shown)
213− if (!shown) {
214+ if (shown) {
215+ if (!ApplicationManager.focusedApplicationId && lastFocusedAppId) {
216+ ApplicationManager.focusApplication(lastFocusedAppId);
217+ }
218+ } else {
219+ lastFocusedAppId = ApplicationManager.focusedApplicationId;
214220 ApplicationManager.unfocusCurrentApplication();
215221 }
216222 }
217223
218− onFullyShownChanged: {
219− print("kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", fullyShown)
220− }
221−
222224 Connections {
223225 target: ApplicationManager
224226 onFocusedApplicationIdChanged: {
@@ -240,8 +242,6 @@ FocusScope {
240242// source: "Stages/StageWithSideStage.qml"
241243 source: "Stages/PhoneStage.qml"
242244
243−// Rectangle { anchors.fill: parent; color: "blue"; opacity: .5 }
244−
245245 Binding {
246246 target: applicationsDisplayLoader.item
247247 property: "moving"
@@ -253,6 +253,23 @@ FocusScope {
253253 value: stages.shown
254254 }
255255 }
256+
257+ DragHandle {
258+ id: stagesDragHandle
259+
260+ anchors.top: parent.top
261+ anchors.bottom: parent.bottom
262+ anchors.right: parent.left
263+
264+ width: shell.edgeSize
265+ direction: Direction.Leftwards
266+ enabled: greeter.showProgress == 0 && edgeDemo.dashEnabled
267+ property bool haveApps: ApplicationManager.count > 0
268+
269+ maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
270+ // Make autocompletion impossible when !haveApps
271+ edgeDragEvaluator.minDragDistance: haveApps ? maxTotalDragDistance * 0.1 : Number.MAX_VALUE
272+ }
256273 }
257274 }
258275
@@ -413,7 +430,7 @@ FocusScope {
413430 }
414431 property string focusedAppId: ApplicationManager.focusedApplicationId
415432 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
416− fullscreenMode: focusedApplication && focusedApplication.fullscreen
433+ fullscreenMode: focusedApplication && focusedApplication.fullscreen && !greeter.shown && !lockscreen.shown
417434 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
418435
419436 InputFilterArea {
Stages/PhoneStage.qml → qml/Stages/PhoneStage.qmlrenamed+34−11
@@ -15,7 +15,7 @@ Item {
1515 property bool moving: false
1616
1717 // State information propagated to the outside
18− readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible
18+ readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible || appSplash.visible
1919
2020 onMovingChanged: {
2121 if (moving) {
@@ -34,18 +34,24 @@ Item {
3434
3535 onFocusedApplicationIdChanged: {
3636 if (ApplicationManager.focusedApplicationId.length > 0) {
37− priv.applicationStarting = false;
38− priv.secondApplicationStarting = false;
37+ if (priv.secondApplicationStarting || priv.applicationStarting) {
38+ appSplashTimer.start();
39+ } else {
40+ mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot
41+ }
3942 }
4043 }
4144
4245 onApplicationAdded: {
4346 if (!priv.focusedApplication) {
44− print("*** applicationStarting")
47+ mainScreenshotImage.src = "";
48+ mainScreenshotImage.visible = false;
4549 priv.applicationStarting = true;
4650 } else {
47− print("*** SECONDapplicationStarting")
51+ mainScreenshotImage.src = "foobar";
52+ priv.newFocusedAppId = appId;
4853 priv.secondApplicationStarting = true;
54+ priv.requestNewScreenshot();
4955 }
5056 }
5157 }
@@ -65,12 +71,14 @@ Item {
6571 property string newFocusedAppId
6672
6773 onFocusedScreenshotChanged: {
68− waitingForScreenshot = false;
69− if (root.moving) {
74+ if (root.moving && priv.waitingForScreenshot) {
7075 mainScreenshotImage.anchors.leftMargin = 0;
7176 mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot;
7277 mainScreenshotImage.visible = true;
78+ } else if (priv.secondApplicationStarting && priv.waitingForScreenshot) {
79+ applicationSwitchingAnimation.start();
7380 }
81+ waitingForScreenshot = false;
7482 }
7583
7684 function requestNewScreenshot() {
@@ -98,11 +106,26 @@ Item {
98106 }
99107 }
100108
109+ Timer {
110+ id: appSplashTimer
111+ // This is to show the splash screen a bit longer.
112+ // Mir signals us that the newly started app has gotten focus before it paints something on the screen
113+ // This would result in the old app surface becoming visible for a bit.
114+ // FIXME: change appManager to only change the focusedApplicationId when the surface is ready to be shown.
115+ interval: 1500
116+ repeat: false
117+ onTriggered: {
118+ priv.applicationStarting = false;
119+ priv.secondApplicationStarting = false;
120+ }
121+ }
122+
101123 SequentialAnimation {
102124 id: applicationSwitchingAnimation
103125 // setup
104126 PropertyAction { target: mainScreenshotImage; property: "anchors.leftMargin"; value: 0 }
105− PropertyAction { target: mainScreenshotImage; property: "src"; value: priv.focusedScreenshot }
127+ // PropertyAction seems to fail when secondApplicationStarting and we didn't have another screenshot before
128+ ScriptAction { script: mainScreenshotImage.src = priv.focusedScreenshot }
106129 PropertyAction { target: mainScreenshotImage; property: "visible"; value: true }
107130 PropertyAction { target: fadeInScreenshotImage; property: "source"; value: ApplicationManager.findApplication(priv.newFocusedAppId).screenshot }
108131 PropertyAction { target: fadeInScreenshotImage; property: "visible"; value: true }
@@ -124,7 +147,7 @@ Item {
124147
125148 // FIXME: Drop this and make the imageprovider show a splashscreen instead
126149 Rectangle {
127− id: appSplash
150+ id: appSplash2
128151 anchors.fill: parent
129152 color: "white"
130153 visible: priv.secondApplicationStarting
@@ -138,9 +161,9 @@ Item {
138161 }
139162
140163 Rectangle {
141− id: appSplash2
164+ id: appSplash
142165 anchors.fill: parent
143− color: "red"
166+ color: "white"
144167 visible: priv.applicationStarting
145168 }
146169 Image {