on xenial help sign in
moved inline video to old files
3e0fd99Nick Dedekind
qml/Dash/Previews/PreviewInlineVideo.qmldeleted−89
@@ -1,89 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtMultimedia 5.0
19−import Ubuntu.Components 1.2
20−import Ubuntu.Thumbnailer 0.1
21−//import Ubuntu.Content 0.1
22−import "../../Components/MediaServices"
23−
24−/*! \brief Preview widget for video.
25−
26− This widget shows video contained in widgetData["source"],
27− with a placeholder screenshot specified by widgetData["screenshot"].
28− */
29−
30−PreviewWidget {
31− id: root
32− implicitWidth: units.gu(35)
33− implicitHeight: services.height
34−
35− property alias rootItem: services.rootItem
36−
37− MediaServices {
38− id: services
39− width: parent.width
40−
41− context: "video"
42− sourceData: root.isCurrentPreview ? widgetData : undefined
43− fullscreen: false
44− maximumEmbeddedHeight: rootItem.height / 2
45−
46− onClose: fullscreen = false
47−
48−// actions: [
49−// Action {
50−// text: i18n.tr("Share")
51−// iconSource: "image://theme/share"
52−// onTriggered: sharePicker.visible = true
53−// }
54−// ]
55− }
56−
57−// Component {
58−// id: contentItemComp
59−// ContentItem {
60−// url: widgetData["source"]
61−// }
62−// }
63−// ContentPeerPicker {
64−// id: sharePicker
65−// objectName: "sharePickerEvents"
66−// anchors.fill: parent
67−// showTitle: false
68−// visible: false
69−// parent: rootItem
70−// z: 100
71−
72−// contentType: ContentType.Videos
73−// handler: ContentHandler.Share
74−
75−// onPeerSelected: {
76−// visible = false;
77−
78−// var curTransfer = peer.request();
79−// if (curTransfer.state === ContentTransfer.InProgress)
80−// {
81−// var medias = [ contentItemComp.createObject(parent) ]
82−// curTransfer.state = ContentTransfer.Charged;
83−// }
84−// }
85−// onCancelPressed: {
86−// visible = false;
87−// }
88−// }
89−}
qml/Dash/Previews/PreviewVideoPlayback.qml+15−41
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -15,9 +15,11 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18+import QtMultimedia 5.0
18−import Ubuntu.Components 0.1
19+import Ubuntu.Components 1.2
19import Ubuntu.Thumbnailer 0.1
20import Ubuntu.Thumbnailer 0.1
21+//import Ubuntu.Content 0.1
20−import "../../Components"
22+import "../../Components/MediaServices"
21
23
22/*! \brief Preview widget for video.
24/*! \brief Preview widget for video.
23
25
@@ -28,47 +30,19 @@ import "../../Components"
28PreviewWidget {
30PreviewWidget {
29 id: root
31 id: root
30 implicitWidth: units.gu(35)
32 implicitWidth: units.gu(35)
31− implicitHeight: childrenRect.height
33+ implicitHeight: services.height
32
34
33− LazyImage {
35+ property alias rootItem: services.rootItem
34− objectName: "screenshot"
35− anchors {
36− left: parent.left
37− right: parent.right
38− }
39− scaleTo: "width"
40− source: {
41− var screenshot = widgetData["screenshot"];
42− if (screenshot) return screenshot;
43
36
44− var source = widgetData["source"];
37+ MediaServices {
45− if (source) {
38+ id: services
46− if (source.toString().indexOf("file://") === 0) {
39+ width: parent.width
47− return "image://thumbnailer/" + source.toString().substr(7);
48− }
49− }
50
40
51− return "";
41+ context: "video"
52− }
42+ sourceData: root.isCurrentPreview ? widgetData : undefined
53− initialHeight: width * 10 / 16
43+ fullscreen: false
44+ maximumEmbeddedHeight: rootItem.height / 2
54
45
55− Image {
46+ onClose: fullscreen = false
56− objectName: "playButton"
57−
58− readonly property bool bigButton: parent.width > units.gu(40)
59−
60− anchors.centerIn: parent
61− width: bigButton ? units.gu(8) : units.gu(4.5)
62− height: width
63− source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
64− visible: parent.state === "ready"
65− }
66−
67− MouseArea {
68− enabled: parent.state === "ready"
69− id: previewImageMouseArea
70− anchors.fill: parent
71− onClicked: Qt.openUrlExternally(widgetData["source"])
72− }
73 }
47 }
74}
48}
qml/Dash/Previews/PreviewWidgetFactory.qml+1−1
@@ -61,7 +61,7 @@ Loader {
61 case "reviews": return "PreviewRatingDisplay.qml";
61 case "reviews": return "PreviewRatingDisplay.qml";
62 case "table": return "PreviewTable.qml";
62 case "table": return "PreviewTable.qml";
63 case "text": return "PreviewTextSummary.qml";
63 case "text": return "PreviewTextSummary.qml";
64− case "video": return "PreviewInlineVideo.qml";
64+ case "video": return "PreviewVideoPlayback.qml";
65 default: return "";
65 default: return "";
66 }
66 }
67 }
67 }
tests/qmltests/CMakeLists.txt+1−1
@@ -10,6 +10,7 @@ add_unity8_qmltest(Components Dialogs LIGHTDM)
10add_unity8_qmltest(Components DraggingArea)
10add_unity8_qmltest(Components DraggingArea)
11add_unity8_qmltest(Components LazyImage)
11add_unity8_qmltest(Components LazyImage)
12add_unity8_qmltest(Components Lockscreen)
12add_unity8_qmltest(Components Lockscreen)
13+add_unity8_qmltest(Components MediaServices)
13add_unity8_qmlunittest(Components PhysicalKeysMapper)
14add_unity8_qmlunittest(Components PhysicalKeysMapper)
14add_unity8_qmltest(Components Rating)
15add_unity8_qmltest(Components Rating)
15add_unity8_qmltest(Components ResponsiveGridView)
16add_unity8_qmltest(Components ResponsiveGridView)
@@ -30,7 +31,6 @@ add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
30add_unity8_qmltest(Dash/Previews PreviewExpandable)
31add_unity8_qmltest(Dash/Previews PreviewExpandable)
31add_unity8_qmltest(Dash/Previews PreviewHeader)
32add_unity8_qmltest(Dash/Previews PreviewHeader)
32add_unity8_qmltest(Dash/Previews PreviewImageGallery)
33add_unity8_qmltest(Dash/Previews PreviewImageGallery)
33−add_unity8_qmltest(Dash/Previews PreviewInlineVideo)
34add_unity8_qmltest(Dash/Previews PreviewPayments)
34add_unity8_qmltest(Dash/Previews PreviewPayments)
35add_unity8_qmltest(Dash/Previews PreviewProgress)
35add_unity8_qmltest(Dash/Previews PreviewProgress)
36add_unity8_qmltest(Dash/Previews PreviewRatingDisplay)
36add_unity8_qmltest(Dash/Previews PreviewRatingDisplay)
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qmldeleted−106
@@ -1,106 +0,0 @@
1−/*
2− * Copyright 2015 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../../qml/Dash/Previews"
20−import Unity.Test 0.1 as UT
21−import Ubuntu.Components 1.2
22−import QtMultimedia 5.0
23−
24−Rectangle {
25− width: units.gu(70)
26− height: units.gu(80)
27− color: "lightgrey"
28−
29− property var widgetData0: {
30− "source": "file:///test-video1",
31− "screenshot": Qt.resolvedUrl("../artwork/avatar.png")
32− }
33−
34− property var widgetData1: {
35− "source": "file:///test-video2",
36− "screenshot": "file:///test-video2-screenshot"
37− }
38−
39− MediaDataSource {
40− source: "file:///test-video1"
41− duration: 6000000
42− metaData: {
43− "title" : "TEST MPEG",
44− "resolution" : { "width": 1920, "height": 1080 }
45− }
46− }
47−
48− Item {
49− anchors.fill: parent
50−
51− Item {
52− id: inner
53− anchors {
54− top: parent.top
55− bottom: parent.bottom
56− left: parent.left
57− right: controls.left
58− }
59−
60− Item {
61− anchors.fill: parent
62− anchors.margins: units.gu(2)
63−
64− PreviewInlineVideo {
65− id: videoPlayback
66− width: parent.width
67− widgetData: widgetData0
68−
69− rootItem: inner
70− }
71− }
72−
73− }
74−
75− Rectangle {
76− id: controls
77− color: "darkgrey"
78− anchors {
79− top: parent.top
80− bottom: parent.bottom
81− right: parent.right
82− }
83− width: units.gu(30)
84−
85− Column {
86− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
87−
88− UT.MouseTouchEmulationCheckbox {}
89− }
90− }
91− }
92−
93− UT.UnityTestCase {
94− name: "PreviewInlineVideoTest"
95− when: windowShown
96−
97− function test_loadScreenshot() {
98− var screenshot = findChild(videoPlayback, "screenshot");
99− verify(screenshot !== null);
100−
101− videoPlayback.widgetData = widgetData1;
102− var screenshotSource = screenshot.source
103− compare(screenshotSource.toString(), "file:///test-video2-screenshot");
104− }
105− }
106−}
tests/qmltests/Dash/Previews/tst_PreviewVideoPlayback.qml+62−17
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2015 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -18,44 +18,89 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import "../../../../qml/Dash/Previews"
19import "../../../../qml/Dash/Previews"
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21+import Ubuntu.Components 1.2
22+import QtMultimedia 5.0
21
23
22Rectangle {
24Rectangle {
23− id: root
24− width: units.gu(40)
25+ width: units.gu(70)
25 height: units.gu(80)
26 height: units.gu(80)
26 color: "lightgrey"
27 color: "lightgrey"
27
28
28 property var widgetData0: {
29 property var widgetData0: {
29− "source": "",
30+ "source": "file:///test-video1",
30− "screenshot": ""
31+ "screenshot": Qt.resolvedUrl("../artwork/avatar.png")
31 }
32 }
32
33
33 property var widgetData1: {
34 property var widgetData1: {
34− "source": "",
35+ "source": "file:///test-video2",
35− "screenshot": "../../../tests/qmltests/Components/tst_LazyImage/square.png"
36+ "screenshot": "file:///test-video2-screenshot"
36 }
37 }
37
38
38− property var widgetData2: {
39+ MediaDataSource {
39− "source": "file:///path/to/local/file",
40+ source: "file:///test-video1"
40− "screenshot": ""
41+ duration: 6000000
42+ metaData: {
43+ "title" : "TEST MPEG",
44+ "resolution" : { "width": 1920, "height": 1080 }
45+ }
41 }
46 }
42
47
48+ Item {
49+ anchors.fill: parent
50+
51+ Item {
52+ id: inner
53+ anchors {
54+ top: parent.top
55+ bottom: parent.bottom
56+ left: parent.left
57+ right: controls.left
58+ }
59+
60+ Item {
61+ anchors.fill: parent
62+ anchors.margins: units.gu(2)
63+
43− PreviewVideoPlayback {
64+ PreviewVideoPlayback {
44− id: videoPlayback
65+ id: videoPlayback
45− width: parent.width
66+ width: parent.width
46− widgetData: widgetData1
67+ widgetData: widgetData0
68+
69+ rootItem: inner
70+ }
71+ }
72+
73+ }
74+
75+ Rectangle {
76+ id: controls
77+ color: "darkgrey"
78+ anchors {
79+ top: parent.top
80+ bottom: parent.bottom
81+ right: parent.right
82+ }
83+ width: units.gu(30)
84+
85+ Column {
86+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
87+
88+ UT.MouseTouchEmulationCheckbox {}
89+ }
90+ }
47 }
91 }
48
92
49 UT.UnityTestCase {
93 UT.UnityTestCase {
50− name: "PreviewVideoPlaybackTest"
94+ name: "PreviewInlineVideoTest"
51 when: windowShown
95 when: windowShown
52
96
53 function test_loadScreenshot() {
97 function test_loadScreenshot() {
54 var screenshot = findChild(videoPlayback, "screenshot");
98 var screenshot = findChild(videoPlayback, "screenshot");
99+ verify(screenshot !== null);
55
100
56− videoPlayback.widgetData = widgetData2;
101+ videoPlayback.widgetData = widgetData1;
57 var screenshotSource = screenshot.source
102 var screenshotSource = screenshot.source
58− verify(screenshotSource.toString().indexOf("image://thumbnailer/") === 0)
103+ compare(screenshotSource.toString(), "file:///test-video2-screenshot");
59 }
104 }
60 }
105 }
61}
106}