on xenial help sign in
Update app thumbnail to the surface resize strategy
44de197Daniel d'Andrada
qml/Dash/Apps/RunningApplicationTile.qml+31−82
@@ -53,91 +53,40 @@ AbstractButton {
53 Item {
53 Item {
54 id: thumbnail
54 id: thumbnail
55
55
56− width: thumbnailHelper.flippedDimensions ? shapedApplicationImage.height : shapedApplicationImage.width
56+ width: shapedApplicationImage.width
57− height: thumbnailHelper.flippedDimensions ? shapedApplicationImage.width : shapedApplicationImage.height
57+ height: shapedApplicationImage.height
58−
58+
59− onWidthChanged: {console.log("thumbnail.width = " + width);}
60− onHeightChanged: {console.log("thumbnail.height = " + height);}
61−
62−
63− Item {
64− id: thumbnailHelper
65−
66− property bool flippedDimensions: root.orientationAngle == 90 || root.orientationAngle == 270
67−
68− // Compensate for the UI rotation that is done by the application itself
69− // TODO: Only counter-rotate if the application UI is rotated in the first place
70− // Currently we don't have this info, so we just assume every single app rotate
71− // its UI
72− transformOrigin: Item.TopLeft
73− state: orientationAngle.toString()
74− states: [
75− State {
76− name: "0"
77− PropertyChanges {
78− target: thumbnailHelper
79− rotation: 0
80− x: 0
81− y: 0
82− }
83− },
84− State {
85− name: "90"
86− PropertyChanges {
87− target: thumbnailHelper
88− rotation: -90
89− x: 0
90− y: shapedApplicationImage.width
91− }
92− },
93− State {
94− name: "180"
95− PropertyChanges {
96− target: thumbnailHelper
97− rotation: -180
98− x: shapedApplicationImage.width
99− y: shapedApplicationImage.height
100− }
101− },
102− State {
103− name: "270"
104− PropertyChanges {
105− target: thumbnailHelper
106− rotation: -270
107− x: shapedApplicationImage.height
108− y: 0
109− }
110− }
111− ]
112−
113− UbuntuShape {
59+ UbuntuShape {
114− id: shapedApplicationImage
60+ id: shapedApplicationImage
115− x: 0
61+ x: 0
116− y: 0
62+ y: 0
117− height: applicationImage.height
63+ height: applicationImage.height
118− width: applicationImage.width
64+ width: applicationImage.width
119− radius: "medium"
65+ radius: "medium"
120−
66+
121− image: Image {
67+ image: Image {
122− id: applicationImage
68+ id: applicationImage
123− source: application.screenshot
69+ source: application.screenshot
124− // height : width = ss.height : ss.width
70+ // height : width = ss.height : ss.width
125− height: units.gu(17)
71+
72+ property bool isLandscape: sourceSize.width > sourceSize.height
73+ property real maxDimension: units.gu(17)
74+
75+ width: isLandscape ? Math.min(sourceSize.width, maxDimension) : height * (sourceSize.width / sourceSize.height)
76+ height: isLandscape ? width * (sourceSize.height / sourceSize.width) : Math.min(sourceSize.height, maxDimension)
126− fillMode: Image.PreserveAspectCrop
77+ fillMode: Image.PreserveAspectCrop
127− width: Math.min(height, height * sourceSize.width / sourceSize.height)
128− }
129−
130 }
78 }
131
79
80+ }
81+
132− UbuntuShape {
82+ UbuntuShape {
133− id: borderPressed
83+ id: borderPressed
134
84
135− anchors.fill: shapedApplicationImage
85+ anchors.fill: shapedApplicationImage
136− radius: "medium"
86+ radius: "medium"
137− borderSource: "radius_pressed.sci"
87+ borderSource: "radius_pressed.sci"
138− opacity: root.pressed ? 1.0 : 0.0
88+ opacity: root.pressed ? 1.0 : 0.0
139− Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
89+ Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
140− }
141 }
90 }
142 }
91 }
143
92