@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import QtMultimedia 5.0
1819import Ubuntu.Components 0.1
1920import ".."
2021import "../../Components"
@@ -23,7 +24,7 @@ DashPreview {
2324 id: root
2425
2526 property bool ready: previewData ? true : false
26− property bool playable: false
27+ property bool playable: previewData.imageSourceUri != null
2728 property url url: ready ? previewData.image : ""
2829
2930 title: root.ready ? previewData.title : ""
@@ -31,38 +32,52 @@ DashPreview {
3132
3233 onPreviewImageClicked: {
3334 if (playable) {
34− shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', root.fileUri);
35+ //shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', previewData.imageSourceUri);
3536 }
3637 }
3738
3839 // TODO: replace this UbuntuShape with the Video component once that lands
3940 // with the player.
40− header: UbuntuShape {
41− id: urlLoader
41+ header: Rectangle {
4242 anchors.left: parent.left
4343 anchors.right: parent.right
44− radius: "medium"
45− image: Image {
46− id: previewImage
47− asynchronous: true
48− source: root.url
49− fillMode: Image.PreserveAspectCrop
50− }
51−
52− Image {
53− objectName: "playButton"
54− anchors.centerIn: parent
55− visible: root.playable
56− readonly property bool bigButton: parent.width > units.gu(40)
57− width: bigButton ? units.gu(8) : units.gu(4.5)
58− height: width
59− source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
60− }
44+ height: units.gu(16)
45+ color: "black"
6146
62− MouseArea {
63− id: previewImageMouseArea
47+ Video {
48+ id: video
6449 anchors.fill: parent
65− onClicked: root.previewImageClicked()
50+
51+ source: previewData.imageSourceUri
52+ fillMode: VideoOutput.PreserveAspectCrop
53+
54+ Image {
55+ objectName: "playButton"
56+ anchors.centerIn: parent
57+ visible: root.playable
58+ readonly property bool bigButton: parent.width > units.gu(40)
59+ width: bigButton ? units.gu(8) : units.gu(4.5)
60+ height: width
61+ source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
62+ }
63+
64+ MouseArea {
65+ id: previewImageMouseArea
66+ anchors.fill: parent
67+ onClicked: {
68+ root.previewImageClicked();
69+ if (root.playable) {
70+ if (video.playbackState == MediaPlayer.PlayingState) {
71+ video.pause();
72+ } else if (video.playbackState
73+ == MediaPlayer.PausedState) {
74+ video.play();
75+ } else {
76+ video.play();
77+ }
78+ }
79+ }
80+ }
6681 }
6782 }
6883
@@ -126,7 +141,7 @@ DashPreview {
126141 color: "white"
127142 horizontalAlignment: Text.AlignRight
128143 width: parent.firstColWidth
129− text: i18n.tr("Directed by:")
144+ text: i18n.tr("Subtitle:")
130145 style: Text.Raised
131146 styleColor: "black"
132147 }