on xenial help sign in
Add sharing to inline video
a41bd80Andrea Cimitan
qml/Dash/Previews/PreviewInlineVideo.qml+15
@@ -18,6 +18,7 @@ import QtQuick 2.4
18import QtMultimedia 5.0
18import QtMultimedia 5.0
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20import Ubuntu.Thumbnailer 0.1
20import Ubuntu.Thumbnailer 0.1
21+import "../../Components"
21import "../../Components/MediaServices"
22import "../../Components/MediaServices"
22
23
23/*! \brief Preview widget for video.
24/*! \brief Preview widget for video.
@@ -39,11 +40,25 @@ PreviewWidget {
39 id: services
40 id: services
40 width: parent.width
41 width: parent.width
41
42
43+ actions: sharingAction
42 context: "video"
44 context: "video"
43 sourceData: widgetData
45 sourceData: widgetData
44 fullscreen: false
46 fullscreen: false
45 maximumEmbeddedHeight: rootItem.height / 2
47 maximumEmbeddedHeight: rootItem.height / 2
46
48
47 onClose: fullscreen = false
49 onClose: fullscreen = false
50+
51+ Action {
52+ id: sharingAction
53+ iconName: "share"
54+ visible: sharingPicker.active
55+ onTriggered: sharingPicker.showPeerPicker()
56+ }
57+ }
58+
59+ SharingPicker {
60+ id: sharingPicker
61+ objectName: "sharingPicker"
62+ shareData: widgetData["share-data"]
48 }
63 }
49}
64}
qml/Dash/Previews/PreviewMediaToolbar.qml+5−5
@@ -19,16 +19,16 @@ import Ubuntu.Components 1.3
19import "../../Components"
19import "../../Components"
20
20
21Rectangle {
21Rectangle {
22− property alias shareData: sharingWidget.shareData
22+ property alias shareData: sharingPicker.shareData
23
23
24 implicitHeight: units.gu(6)
24 implicitHeight: units.gu(6)
25 color: Qt.rgba(0, 0, 0, 0.8)
25 color: Qt.rgba(0, 0, 0, 0.8)
26− visible: sharingWidget.active
26+ visible: sharingPicker.active
27
27
28 Action {
28 Action {
29 id: sharingAction
29 id: sharingAction
30 iconName: "share"
30 iconName: "share"
31− onTriggered: sharingWidget.showPeerPicker()
31+ onTriggered: sharingPicker.showPeerPicker()
32 }
32 }
33
33
34 AbstractButton {
34 AbstractButton {
@@ -51,7 +51,7 @@ Rectangle {
51 }
51 }
52
52
53 SharingPicker {
53 SharingPicker {
54− id: sharingWidget
54+ id: sharingPicker
55− objectName: "sharingWidget"
55+ objectName: "sharingPicker"
56 }
56 }
57}
57}
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+9−1
@@ -28,7 +28,15 @@ Rectangle {
28
28
29 property var widgetData0: {
29 property var widgetData0: {
30 "source": "file:///test-video1",
30 "source": "file:///test-video1",
31− "screenshot": Qt.resolvedUrl("../artwork/avatar.png")
31+ "screenshot": Qt.resolvedUrl("../artwork/avatar.png"),
32+ "share-data": {
33+ "uri": [
34+ "file:///this/is/an/url",
35+ "file:///this/is/an/url/2",
36+ "file:///this/is/an/url/3"
37+ ],
38+ "content-type": "text"
39+ }
32 }
40 }
33
41
34 property var widgetData1: {
42 property var widgetData1: {