on xenial help sign in
more progress on the fake application manager
3570b4aMichael Zanetti
qml/Stages/PhoneStage.qml+16−16
@@ -20,7 +20,6 @@ Item {
20 // State information propagated to the outside
20 // State information propagated to the outside
21 readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible || appSplash.visible
21 readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible || appSplash.visible
22 onPaintingChanged: print("**********************+ painting changed", painting)
22 onPaintingChanged: print("**********************+ painting changed", painting)
23− onShownChanged: print("*********************** shown changed", shown)
24
23
25 onMovingChanged: {
24 onMovingChanged: {
26 if (moving) {
25 if (moving) {
@@ -38,7 +37,6 @@ Item {
38 }
37 }
39
38
40 onFocusedApplicationIdChanged: {
39 onFocusedApplicationIdChanged: {
41− print("foooooooooooooo")
42 if (ApplicationManager.focusedApplicationId.length > 0) {
40 if (ApplicationManager.focusedApplicationId.length > 0) {
43 if (priv.secondApplicationStarting || priv.applicationStarting) {
41 if (priv.secondApplicationStarting || priv.applicationStarting) {
44 appSplashTimer.start();
42 appSplashTimer.start();
@@ -67,7 +65,7 @@ Item {
67
65
68 property string focusedAppId: ApplicationManager.focusedApplicationId
66 property string focusedAppId: ApplicationManager.focusedApplicationId
69 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
67 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
70− property url focusedScreenshot: focusedApplication.screenshot
68+ property url focusedScreenshot: focusedApplication ? focusedApplication.screenshot : ""
71
69
72 property bool waitingForScreenshot: false
70 property bool waitingForScreenshot: false
73
71
@@ -76,10 +74,7 @@ Item {
76
74
77 property string newFocusedAppId
75 property string newFocusedAppId
78
76
79− onFocusedAppIdChanged: print("focusedappidchanged")
80−
81 onFocusedScreenshotChanged: {
77 onFocusedScreenshotChanged: {
82− print("focusedscreenshotchanged")
83 if (root.moving && priv.waitingForScreenshot) {
78 if (root.moving && priv.waitingForScreenshot) {
84 mainScreenshotImage.anchors.leftMargin = 0;
79 mainScreenshotImage.anchors.leftMargin = 0;
85 mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot;
80 mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot;
@@ -91,7 +86,6 @@ Item {
91 }
86 }
92
87
93 function requestNewScreenshot() {
88 function requestNewScreenshot() {
94− print("requesting new screenshot", focusedAppId, focusedScreenshot, focusedApplication, focusedApplication.screenshot)
95 waitingForScreenshot = true;
89 waitingForScreenshot = true;
96 ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
90 ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
97 }
91 }
@@ -104,6 +98,13 @@ Item {
104
98
105 }
99 }
106
100
101+ // FIXME: the signal connection seems to get lost with the fake application manager.
102+ // Check with Qt 5.2, see if we can remove this Connections object
103+ Connections {
104+ target: priv.focusedApplication
105+ onScreenshotChanged: priv.focusedScreenshot = priv.focusedApplication.screenshot
106+ }
107+
107 Timer {
108 Timer {
108 id: grantFocusTimer
109 id: grantFocusTimer
109 // Delay the actual switch to be covered by the animation for sure.
110 // Delay the actual switch to be covered by the animation for sure.
@@ -188,7 +189,7 @@ Item {
188
189
189 EdgeDragArea {
190 EdgeDragArea {
190 id: coverFlipDragArea
191 id: coverFlipDragArea
191− direction: Direction.Rightwards
192+ direction: Direction.Leftwards
192
193
193 //enabled: root.available
194 //enabled: root.available
194 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
195 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
@@ -319,6 +320,7 @@ Item {
319 target: coverFlickable
320 target: coverFlickable
320 properties: "contentX"
321 properties: "contentX"
321 to: snapAnimation.targetContentX
322 to: snapAnimation.targetContentX
323+ duration: UbuntuAnimation.SnapDuration
322 }
324 }
323 ScriptAction {
325 ScriptAction {
324 script: {
326 script: {
@@ -514,7 +516,7 @@ Item {
514 }
516 }
515 EasingCurve {
517 EasingCurve {
516 id: scaleEasing
518 id: scaleEasing
517− type: EasingCurve.OutQuad
519+ type: EasingCurve.Linear
518 period: coverFlip.maxScale - coverFlip.minScale
520 period: coverFlip.maxScale - coverFlip.minScale
519 progress: appImage.translatedProgress
521 progress: appImage.translatedProgress
520 }
522 }
@@ -546,8 +548,11 @@ Item {
546 SequentialAnimation {
548 SequentialAnimation {
547 id: switchToAppAnimation
549 id: switchToAppAnimation
548 property int targetContentX
550 property int targetContentX
549− ParallelAnimation {
551+ UbuntuNumberAnimation {
552+ target: coverFlickable;
553+ property: "contentX";
550− UbuntuNumberAnimation { target: coverFlickable; property: "contentX"; to: switchToAppAnimation.targetContentX }
554+ to: switchToAppAnimation.targetContentX;
555+ duration: UbuntuAnimation.SnapDuration
551 }
556 }
552 ScriptAction {
557 ScriptAction {
553 script: {
558 script: {
@@ -562,9 +567,4 @@ Item {
562 }
567 }
563 }
568 }
564 }
569 }
565− Rectangle {
566− anchors.fill: parent
567− color: "green"
568− opacity: .5
569− }
570}
570}
tests/mocks/Unity/Application/ApplicationScreenshotProvider.cpp+13
@@ -21,6 +21,9 @@
21#include "paths.h"
21#include "paths.h"
22
22
23#include <QDebug>
23#include <QDebug>
24+#include <QGuiApplication>
25+#include <QWindow>
26+#include <QQuickWindow>
24
27
25ApplicationScreenshotProvider::ApplicationScreenshotProvider(ApplicationManager *appManager)
28ApplicationScreenshotProvider::ApplicationScreenshotProvider(ApplicationManager *appManager)
26 : QQuickImageProvider(QQuickImageProvider::Image)
29 : QQuickImageProvider(QQuickImageProvider::Image)
@@ -49,8 +52,18 @@ QImage ApplicationScreenshotProvider::requestImage(const QString &imageId, QSize
49 qDebug() << "failed loading app image" << filePath;
52 qDebug() << "failed loading app image" << filePath;
50 }
53 }
51
54
55+ QGuiApplication *unity = qobject_cast<QGuiApplication*>(qApp);
56+
57+ Q_FOREACH (QWindow *win, unity->allWindows()) {
58+ QQuickWindow *quickWin = qobject_cast<QQuickWindow*>(win);
59+ if (quickWin) {
60+ image = image.scaledToWidth(quickWin->width());
61+ }
62+ }
63+
52 size->setWidth(image.width());
64 size->setWidth(image.width());
53 size->setHeight(image.height());
65 size->setHeight(image.height());
66+ qDebug() << "got image of size" << size->width() << size->height() << requestedSize;
54
67
55 return image;
68 return image;
56}
69}