@@ -30,46 +30,38 @@ DashPreview {
3030 title: root.ready ? previewData.title : ""
3131 previewWidthRatio: 0.6
3232
33− // TODO: Need UbuntuShape support for Video component for create the round shape.
34− header: Rectangle {
33+ onPreviewImageClicked: {
34+ if (playable) {
35+ shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', previewData.imageSourceUri);
36+ }
37+ }
38+
39+ header: UbuntuShape {
40+ id: urlLoader
3541 anchors.left: parent.left
3642 anchors.right: parent.right
37− height: width * 9 / 16
38− color: "black"
39−
40− Video {
41− id: video
42− anchors.fill: parent
43+ radius: "medium"
44+ image: Image {
45+ id: previewImage
46+ asynchronous: true
47+ source: root.url
48+ fillMode: Image.PreserveAspectCrop
49+ }
4350
44− source: previewData.imageSourceUri
45− fillMode: VideoOutput.PreserveAspectCrop
46−
47− Image {
48− objectName: "playButton"
49− anchors.centerIn: parent
50− visible: root.playable
51− readonly property bool bigButton: parent.width > units.gu(40)
52− width: bigButton ? units.gu(8) : units.gu(4.5)
53− height: width
54− source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
55− }
51+ Image {
52+ objectName: "playButton"
53+ anchors.centerIn: parent
54+ visible: root.playable
55+ readonly property bool bigButton: parent.width > units.gu(40)
56+ width: bigButton ? units.gu(8) : units.gu(4.5)
57+ height: width
58+ source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
59+ }
5660
57− MouseArea {
58− id: previewImageMouseArea
59− anchors.fill: parent
60− onClicked: {
61− root.previewImageClicked();
62− if (root.playable) {
63− if (video.playbackState == MediaPlayer.PlayingState) {
64− video.pause();
65− } else if (video.playbackState == MediaPlayer.PausedState) {
66− video.play();
67− } else {
68− video.play();
69− }
70− }
71− }
72− }
61+ MouseArea {
62+ id: previewImageMouseArea
63+ anchors.fill: parent
64+ onClicked: root.previewImageClicked()
7365 }
7466 }
7567