Merge lp:~renatofilho/ubuntu-ui-extras/new-mediaplayer-components into lp:ubuntu-ui-extras

Proposed by Renato Araujo Oliveira Filho
Status: Needs review
Proposed branch: lp:~renatofilho/ubuntu-ui-extras/new-mediaplayer-components
Merge into: lp:ubuntu-ui-extras
Diff against target: 1550 lines (+1384/-8)
19 files modified
debian/control (+14/-1)
modules/Ubuntu/Components/Extras/CMakeLists.txt (+1/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/AbstractPlayer.qml (+201/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/CMakeLists.txt (+25/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/Controls.qml (+347/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/ControlsMask.qml (+52/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/HLine.qml (+28/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/IconButton.qml (+43/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/SceneFrame.qml (+79/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/SceneSelector.qml (+74/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/TimeLabel.qml (+57/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml (+81/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/VLine.qml (+54/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/VideoPlayer.qml (+188/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/VideoSlider.qml (+89/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/assets/CMakeLists.txt (+10/-0)
modules/Ubuntu/Components/Extras/MediaPlayer/qmldir (+15/-0)
po/CMakeLists.txt (+4/-1)
po/ubuntu-ui-extras.pot (+22/-6)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-ui-extras/new-mediaplayer-components
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+241794@code.launchpad.net

Commit message

Imported MediaPlayer components from MediaPlayer app.

To post a comment you must log in.
67. By Renato Araujo Oliveira Filho

Make the Mediaplayer componets package plataform independent.

68. By Renato Araujo Oliveira Filho

Make sure that strings from mediaplayer components files get inserted on the project .pot file.

69. By Renato Araujo Oliveira Filho

Updated .pot.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

What's the status of this MR?

Unmerged revisions

69. By Renato Araujo Oliveira Filho

Updated .pot.

68. By Renato Araujo Oliveira Filho

Make sure that strings from mediaplayer components files get inserted on the project .pot file.

67. By Renato Araujo Oliveira Filho

Make the Mediaplayer componets package plataform independent.

66. By Renato Araujo Oliveira Filho

Imported MediaPlayer components from MediaPlayer app.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-11-10 15:50:25 +0000
3+++ debian/control 2014-11-14 19:03:25 +0000
4@@ -33,7 +33,7 @@
5 Depends: ${misc:Depends},
6 ${shlibs:Depends},
7 libqt5sql5-sqlite,
8- libqt5webkit5-qmlwebkitplugin,
9+ libqt5webkit5-qmlwebkitplugin,
10 qtdeclarative5-qtquick2-plugin,
11 qtdeclarative5-ubuntu-ui-toolkit-plugin,
12 qtdeclarative5-accounts-plugin,
13@@ -44,3 +44,16 @@
14 A collection of UI components that for various reasons can't be included in
15 the main Ubuntu UI toolkit - mostly because of the level of quality, lack of
16 documentation and/or lack of automated tests.
17+
18+Package: qtdeclarative5-ubuntu-ui-extras-mediaplayer0.1
19+Architecture: all
20+Depends: qtdeclarative5-qtquick2-plugin,
21+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
22+ qtdeclarative5-qtmultimedia-plugin,
23+ ${misc:Depends},
24+ ${shlibs:Depends},
25+Description: Ubuntu UI Extra Components - MediaPlayer components
26+ A collection of UI components that for various reasons can't be included in
27+ the main Ubuntu UI toolkit - mostly because of the level of quality, lack of
28+ documentation and/or lack of automated tests.
29+
30
31=== modified file 'modules/Ubuntu/Components/Extras/CMakeLists.txt'
32--- modules/Ubuntu/Components/Extras/CMakeLists.txt 2013-08-20 12:29:04 +0000
33+++ modules/Ubuntu/Components/Extras/CMakeLists.txt 2014-11-14 19:03:25 +0000
34@@ -22,3 +22,4 @@
35 add_subdirectory(plugin)
36 add_subdirectory(Example)
37 add_subdirectory(Share)
38+add_subdirectory(MediaPlayer)
39
40=== added directory 'modules/Ubuntu/Components/Extras/MediaPlayer'
41=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/AbstractPlayer.qml'
42--- modules/Ubuntu/Components/Extras/MediaPlayer/AbstractPlayer.qml 1970-01-01 00:00:00 +0000
43+++ modules/Ubuntu/Components/Extras/MediaPlayer/AbstractPlayer.qml 2014-11-14 19:03:25 +0000
44@@ -0,0 +1,201 @@
45+/*
46+ * Copyright (C) 2013 Canonical, Ltd.
47+ *
48+ * Authors:
49+ * Ugo Riboni <ugo.riboni@canonical.com>
50+ * Michał Sawicz <michal.sawicz@canonical.com>
51+ * Renato Araujo Oliveira Filho <renato@canonical.com>
52+ *
53+ * This program is free software; you can redistribute it and/or modify
54+ * it under the terms of the GNU General Public License as published by
55+ * the Free Software Foundation; version 3.
56+ *
57+ * This program is distributed in the hope that it will be useful,
58+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
59+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60+ * GNU General Public License for more details.
61+ *
62+ * You should have received a copy of the GNU General Public License
63+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
64+ */
65+import QtQuick 2.0
66+import QtMultimedia 5.0
67+
68+Rectangle {
69+ id: player
70+
71+ property bool playing: state == "playing"
72+ property bool paused: state == "paused"
73+ property real aspectRatio: width / height
74+ property variant video: mediaPlayer
75+ property alias videoOutput: _videoOutput
76+
77+ property alias source: mediaPlayer.source
78+ property alias status: mediaPlayer.status
79+ property alias volume: mediaPlayer.volume
80+
81+ property int forwardSeekStep: Math.min(60000, mediaPlayer.duration * 0.05)
82+ property int backwardSeekStep: Math.min(30000, mediaPlayer.duration * 0.025)
83+
84+
85+ signal error(int errorCode, string errorString)
86+
87+ objectName: "videoPlayer"
88+ state: "stopped"
89+ color: "black"
90+
91+ function stop() {
92+ state = "stopped"
93+ }
94+
95+ function play() {
96+ state = "playing"
97+ }
98+
99+ function pause() {
100+ state = "paused"
101+ }
102+
103+ function togglePause() {
104+ if (playing) {
105+ pause()
106+ } else if (paused) {
107+ play()
108+ }
109+ }
110+
111+ function seekForward() {
112+ return seek(forwardSeekStep)
113+ }
114+
115+ function seekBackward() {
116+ return seek(-backwardSeekStep)
117+ }
118+
119+ function seek(value) {
120+ if (mediaPlayer.seekable) {
121+ if (state != "playing" && state != "paused") {
122+ state = "playing"
123+ state = "paused"
124+ }
125+ mediaPlayer.seek(mediaPlayer.position + value)
126+ } else {
127+ return false
128+ }
129+ return true
130+ }
131+
132+ function fastForward() {
133+ if (mediaPlayer.seekable) {
134+ if (state == "forwarding") {
135+ scrubbingTimer.step = Math.min(5 * forwardSeekStep, scrubbingTimer.step * 1.5)
136+ } else {
137+ state = "forwarding"
138+ }
139+ return true
140+ } else {
141+ return false
142+ }
143+ }
144+
145+ function rewind() {
146+ if (mediaPlayer.seekable) {
147+ if (state == "rewinding") {
148+ scrubbingTimer.step = Math.max(-5 * forwardSeekStep, scrubbingTimer.step * 1.5)
149+ } else {
150+ state = "rewinding"
151+ }
152+ return true
153+ } else {
154+ return false
155+ }
156+ }
157+
158+ VideoOutput {
159+ id: _videoOutput
160+
161+ source: mediaPlayer
162+ anchors.fill: parent
163+ smooth: true
164+
165+ Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuad } }
166+ }
167+
168+ MediaPlayer {
169+ id: mediaPlayer
170+
171+ property real aspectRatio: metaData.resolution !== undefined ? metaData.resolution.width / metaData.resolution.height : -1
172+ property int realWidth: aspectRatio != -1 ? Math.min(width, (aspectRatio >= parent.aspectRatio ? width : aspectRatio * height)) : -1
173+ property int realHeight: aspectRatio != -1 ? Math.min(height, (aspectRatio < parent.aspectRatio ? height : width / aspectRatio)) : -1
174+ property int widthMargin: aspectRatio != -1 ? (aspectRatio >= parent.aspectRatio ? 0 : (width - realWidth) / 2) : -1
175+ property int heightMargin: aspectRatio != -1 ? (aspectRatio < parent.aspectRatio ? 0 : (height - realHeight) / 2) : -1
176+
177+ onError: {
178+ console.error("AbstractPlayer: " + error + ":" + errorString)
179+ player.error(error, errorString)
180+ }
181+ }
182+
183+ Timer {
184+ id: scrubbingTimer
185+ interval: 500
186+ repeat: true
187+
188+ property int step
189+
190+ onTriggered:
191+ if (mediaPlayer.position + step < 0) {
192+ mediaPlayer.seek(0)
193+ player.state = "playing"
194+ } else {
195+ mediaPlayer.seek(mediaPlayer.position + step)
196+ }
197+ }
198+
199+ states: [
200+ State {
201+ name: "stopped"
202+ StateChangeScript { script: mediaPlayer.stop() }
203+ PropertyChanges { target: scrubbingTimer; running: false }
204+ },
205+
206+ State {
207+ name: "playing"
208+ PropertyChanges { target: mediaPlayer; playbackRate: 1.0; muted: false }
209+ StateChangeScript { script: mediaPlayer.play() }
210+ PropertyChanges { target: scrubbingTimer; running: false }
211+ },
212+
213+ State {
214+ name: "paused"
215+ StateChangeScript { script: mediaPlayer.pause() }
216+ PropertyChanges { target: scrubbingTimer; running: false }
217+ },
218+
219+ State {
220+ name: "forwarding"
221+ PropertyChanges { target: mediaPlayer; muted: true }
222+ StateChangeScript { script: mediaPlayer.pause() }
223+ PropertyChanges { target: scrubbingTimer; running: true }
224+ },
225+
226+ State {
227+ name: "rewinding"
228+ PropertyChanges { target: mediaPlayer; muted: true }
229+ StateChangeScript { script: mediaPlayer.pause() }
230+ PropertyChanges { target: scrubbingTimer; running: true }
231+ }
232+ ]
233+
234+ transitions: [
235+ Transition {
236+ to: "forwarding"
237+ PropertyAction { target: scrubbingTimer; property: "step"; value: forwardSeekStep }
238+ },
239+
240+ Transition {
241+ to: "rewinding"
242+ PropertyAction { target: scrubbingTimer; property: "step"; value: -forwardSeekStep }
243+ }
244+ ]
245+}
246
247=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/CMakeLists.txt'
248--- modules/Ubuntu/Components/Extras/MediaPlayer/CMakeLists.txt 1970-01-01 00:00:00 +0000
249+++ modules/Ubuntu/Components/Extras/MediaPlayer/CMakeLists.txt 2014-11-14 19:03:25 +0000
250@@ -0,0 +1,25 @@
251+project(mediaplayer_components)
252+
253+set(MEDIAPLAYER_COMPONENTS_QMLS
254+ AbstractPlayer.qml
255+ CMakeLists.txt
256+ ControlsMask.qml
257+ Controls.qml
258+ HLine.qml
259+ IconButton.qml
260+ qmldir
261+ SceneFrame.qml
262+ SceneSelector.qml
263+ TimeLabel.qml
264+ TimeLine.qml
265+ VideoPlayer.qml
266+ VideoSlider.qml
267+ VLine.qml
268+)
269+
270+# make the files visible on qtcreator
271+add_custom_target(mediaplayer_components_QmlFiles ALL SOURCES ${MEDIAPLAYER_COMPONENTS_QMLS})
272+
273+install(FILES ${MEDIAPLAYER_COMPONENTS_QMLS} DESTINATION ${PLUGIN_DIR}/MediaPlayer)
274+
275+add_subdirectory(assets)
276
277=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/Controls.qml'
278--- modules/Ubuntu/Components/Extras/MediaPlayer/Controls.qml 1970-01-01 00:00:00 +0000
279+++ modules/Ubuntu/Components/Extras/MediaPlayer/Controls.qml 2014-11-14 19:03:25 +0000
280@@ -0,0 +1,347 @@
281+/*
282+ * Copyright (C) 2013 Canonical, Ltd.
283+ *
284+ * Authors:
285+ * Ugo Riboni <ugo.riboni@canonical.com>
286+ * Michał Sawicz <michal.sawicz@canonical.com>
287+ * Renato Araujo Oliveira Filho <renato@canonical.com>
288+ *
289+ * This program is free software; you can redistribute it and/or modify
290+ * it under the terms of the GNU General Public License as published by
291+ * the Free Software Foundation; version 3.
292+ *
293+ * This program is distributed in the hope that it will be useful,
294+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
295+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
296+ * GNU General Public License for more details.
297+ *
298+ * You should have received a copy of the GNU General Public License
299+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
300+ */
301+import QtQuick 2.0
302+import Ubuntu.Components 1.1
303+
304+Item {
305+ id: controls
306+
307+ readonly property string orientation: controls.width >= units.gu(60) ? "LANDSCAPE" : "PORTRAIT"
308+ property variant video: null
309+ property int maximumHeight: 0
310+ property alias sceneSelectorHeight: _sceneSelector.height
311+ property alias sceneSelectorVisible: _sceneSelector.visible
312+ property int heightOffset: 0
313+
314+ property alias settingsEnabled: _settingsButton.enabled
315+
316+ signal fullscreenClicked
317+ signal playbackClicked
318+ signal settingsClicked
319+ signal shareClicked
320+ signal seekRequested(int time)
321+ signal startSeek
322+ signal endSeek
323+
324+ focus: true
325+ height: sceneSelectorVisible ? maximumHeight - heightOffset : _toolbar.height
326+
327+ function removeExt(uri) {
328+ return uri.toString().substring(0, uri.toString().lastIndexOf("."))
329+ }
330+
331+ ListModel {
332+ id: _sceneSelectorModel
333+ }
334+
335+ Rectangle {
336+ id: _bgColor
337+
338+ color: "black"
339+ opacity: 0.8
340+ anchors.fill: parent
341+ }
342+
343+ SceneSelector {
344+ id: _sceneSelector
345+
346+ property bool show: false
347+
348+ property bool parentActive: _controls.visible
349+
350+ function selectSceneAt(time) {
351+ // SKIP it for now, we need to fix hybris bug #1231147
352+ return
353+ }
354+
355+ objectName: "Controls.SceneSelector"
356+ opacity: 0
357+ visible: opacity > 0
358+ // SKIP it for now, we need to fix hybris bug #1231147
359+ //model: _sceneSelectorModel
360+ anchors {
361+ left: parent.left
362+ right: parent.right
363+ top: parent.top
364+ }
365+
366+ onSceneSelected: controls.seekRequested(start)
367+ onParentActiveChanged: {
368+ if (!parentActive) {
369+ show = false
370+ }
371+ }
372+
373+ ParallelAnimation {
374+ id: _showAnimation
375+
376+ // SKIP it for now, we need to fix hybris bug #1231147
377+ running: false //_sceneSelector.show
378+ NumberAnimation { target: _sceneSelector; property: "opacity"; to: 1; duration: 175 }
379+ NumberAnimation { target: controls; property: "heightOffset"; to: 0; duration: 175 }
380+ }
381+
382+ ParallelAnimation {
383+ id: _hideAnimation
384+
385+ // SKIP it for now, we need to fix hybris bug #1231147
386+ running: false //!_sceneSelector.show
387+ NumberAnimation { target: _sceneSelector; property: "opacity"; to: 0; duration: 175 }
388+ NumberAnimation { target: controls; property: "heightOffset"; to: units.gu(2); duration: 175 }
389+ }
390+ }
391+
392+ HLine {
393+ id: _divLine
394+ anchors {
395+ left: _toolbar.left
396+ right: _toolbar.right
397+ top: parent.top
398+ }
399+ }
400+ Column {
401+ id: _toolbar
402+
403+ anchors {
404+ bottom: parent.bottom
405+ left: parent.left
406+ right: parent.right
407+ }
408+ height: childrenRect.height
409+
410+ Item {
411+ id: timelinePlaceHolderPortrait
412+
413+ anchors {
414+ left: parent.left
415+ right: parent.right
416+ }
417+ height: controls.orientation === "PORTRAIT" ? units.gu(5) : 0
418+ }
419+
420+ Row {
421+ id: controlsRow
422+ anchors {
423+ left: parent.left
424+ right: parent.right
425+ margins: units.gu(2)
426+ }
427+ height: units.gu(5)
428+
429+ IconButton {
430+ id: _fullScreenButton
431+
432+ //TODO: use the correct icon based on window state
433+ iconSource: mpApplication.desktopMode ? "assets/icon_exitfscreen.png" : "image://theme/back"
434+ iconSize: units.gu(3)
435+ anchors.verticalCenter: parent.verticalCenter
436+ width: units.gu(8)
437+ height: units.gu(4)
438+ onClicked: controls.fullscreenClicked()
439+ leftAlignment: true
440+ }
441+
442+ VLine {
443+ }
444+
445+ IconButton {
446+ id: _playbackButtom
447+ objectName: "Controls.PlayBackButton"
448+
449+ property string icon
450+
451+ iconSource: icon ? "image://theme/media-playback-%1".arg(icon) : ""
452+ iconSize: units.gu(3)
453+ anchors.verticalCenter: parent.verticalCenter
454+ width: controls.orientation === "LANDSCAPE" ? units.gu(10) :
455+ controlsRow.width -
456+ _fullScreenButton.width -
457+ _timeLabel.width -
458+ _shareButton.width -
459+ _settingsButton.width
460+
461+ height: units.gu(4)
462+ onClicked: controls.playbackClicked()
463+ }
464+
465+ VLine {
466+ }
467+
468+ Item {
469+ id: timelinePlaceHolderLandscape
470+
471+ anchors {
472+ top: parent.top
473+ bottom: parent.bottom
474+ }
475+
476+ width: controls.orientation === "LANDSCAPE" ? controlsRow.width -
477+ _fullScreenButton.width -
478+ _playbackButtom.width -
479+ _timeLabel.width -
480+ _shareButton.width -
481+ _settingsButton.width -
482+ units.gu(2) : 0
483+
484+
485+ TimeLine {
486+ id: _timeline
487+
488+ property bool seeking: false
489+
490+ anchors {
491+ left: parent.left
492+ right: parent.right
493+ margins: units.gu(2)
494+ verticalCenter: parent.verticalCenter
495+ }
496+ height: units.gu(4)
497+ parent: controls.orientation === "PORTRAIT" ? timelinePlaceHolderPortrait : timelinePlaceHolderLandscape
498+ minimumValue: 0
499+ maximumValue: video ? video.duration / 1000 : 0
500+ videoPosition: video ? video.position / 1000 : 0
501+
502+ // pause the video during the seek
503+ onPressedChanged: {
504+ if (!pressed && seeking) {
505+ endSeek()
506+ seeking = false
507+ }
508+ }
509+
510+ // Live value is the real slider value. Ex: User dragging the slider
511+ onLiveValueChanged: {
512+ if (video) {
513+ var changed = Math.abs(liveValue - videoPosition)
514+ if (changed > 1) {
515+ if (!seeking) {
516+ startSeek()
517+ seeking = true
518+ }
519+ seekRequested(liveValue * 1000)
520+ _sceneSelector.selectSceneAt(liveValue * 1000)
521+ }
522+ }
523+ }
524+
525+ onValueChanged: _sceneSelector.selectSceneAt(video.position)
526+ onClicked: {
527+ if (insideThumb) {
528+ _sceneSelector.show = !_sceneSelector.show
529+ } else {
530+ _sceneSelector.show = true
531+ }
532+ }
533+ }
534+ }
535+
536+ VLine {
537+ visible: controls.orientation === "LANDSCAPE"
538+ }
539+
540+ TimeLabel {
541+ id: _timeLabel
542+
543+ remainingTime: _timeline.remainingTime
544+ currentTime: _timeline.currentTime
545+
546+ anchors {
547+ top: parent.top
548+ bottom: parent.bottom
549+ }
550+ width: controls.orientation === "LANDSCAPE" ? units.gu(10) : units.gu(8)
551+ }
552+
553+ VLine {
554+ visible: _shareButton.visible
555+ }
556+
557+ IconButton {
558+ id: _shareButton
559+
560+ /* Disable share button for now until we get some feedback from designers */
561+ visible: false
562+ iconSource: "assets/icon_share.png"
563+ iconSize: units.gu(3)
564+ anchors {
565+ top: parent.top
566+ bottom: parent.bottom
567+ }
568+ width: visible ? units.gu(7) : 0
569+ onClicked: controls.shareClicked()
570+ }
571+
572+ VLine {
573+ visible: _settingsButton.visible
574+ }
575+
576+ IconButton {
577+ id: _settingsButton
578+
579+ visible: false
580+ iconSource: "assets/icon_settings.png"
581+ iconSize: units.gu(3)
582+ anchors {
583+ top: parent.top
584+ bottom: parent.bottom
585+ }
586+ width: visible ? units.gu(7) : 0
587+ enabled: false
588+ opacity: enabled ? 1.0 : 0.2
589+ onClicked: settingsClicked()
590+ }
591+ }
592+ }
593+
594+ Connections {
595+ target: video
596+ onDurationChanged: {
597+ _sceneSelector.currentIndex = -1
598+ _sceneSelectorModel.clear()
599+ var frameSize = video.duration / 10;
600+ for (var i = 0; i < 10; ++i) {
601+ var pos = Math.floor(i * frameSize);
602+ if (pos <= video.duration) {
603+ _sceneSelectorModel.append({"thumbnail": "image://video/" + video.source + "/" + pos,
604+ "start" : pos,
605+ "duration" : frameSize})
606+ }
607+ }
608+ }
609+ }
610+
611+ states: [
612+ State {
613+ name: "stopped"
614+ PropertyChanges { target: _playbackButtom; icon: "start" }
615+ },
616+
617+ State {
618+ name: "playing"
619+ PropertyChanges { target: _playbackButtom; icon: "pause" }
620+ },
621+
622+ State {
623+ name: "paused"
624+ PropertyChanges { target: _playbackButtom; icon: "start" }
625+ }
626+ ]
627+}
628
629=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/ControlsMask.qml'
630--- modules/Ubuntu/Components/Extras/MediaPlayer/ControlsMask.qml 1970-01-01 00:00:00 +0000
631+++ modules/Ubuntu/Components/Extras/MediaPlayer/ControlsMask.qml 2014-11-14 19:03:25 +0000
632@@ -0,0 +1,52 @@
633+/*
634+ * Copyright (C) 2013 Canonical, Ltd.
635+ *
636+ * Authors:
637+ * Renato Araujo Oliveira Filho <renato@canonical.com>
638+ *
639+ * This program is free software; you can redistribute it and/or modify
640+ * it under the terms of the GNU General Public License as published by
641+ * the Free Software Foundation; version 3.
642+ *
643+ * This program is distributed in the hope that it will be useful,
644+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
645+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
646+ * GNU General Public License for more details.
647+ *
648+ * You should have received a copy of the GNU General Public License
649+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
650+ */
651+
652+import QtQuick 2.0
653+import QtGraphicalEffects 1.0
654+
655+
656+Item {
657+ id: _controlsMask
658+
659+ property variant controls
660+ property variant videoOutput
661+
662+ LinearGradient {
663+ id: _mask
664+
665+ anchors.fill: parent
666+ start: Qt.point(0, controls.y)
667+ end: Qt.point(0, controls.y + controls.height)
668+ visible: false
669+
670+ gradient: Gradient {
671+ GradientStop { position: 0.0; color: "#00ffffff" }
672+ GradientStop { position: 0.1; color: "#000000" }
673+ }
674+ }
675+
676+ MaskedBlur {
677+ anchors.fill: parent
678+ source: videoOutput
679+ maskSource: _mask
680+ radius: 99
681+ samples: 39
682+ fast: true
683+ }
684+}
685
686=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/HLine.qml'
687--- modules/Ubuntu/Components/Extras/MediaPlayer/HLine.qml 1970-01-01 00:00:00 +0000
688+++ modules/Ubuntu/Components/Extras/MediaPlayer/HLine.qml 2014-11-14 19:03:25 +0000
689@@ -0,0 +1,28 @@
690+/*
691+ * Copyright (C) 2013 Canonical, Ltd.
692+ *
693+ * Authors:
694+ * Renato Araujo Oliveira Filho <renato@canonical.com>
695+ *
696+ * This program is free software; you can redistribute it and/or modify
697+ * it under the terms of the GNU General Public License as published by
698+ * the Free Software Foundation; version 3.
699+ *
700+ * This program is distributed in the hope that it will be useful,
701+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
702+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
703+ * GNU General Public License for more details.
704+ *
705+ * You should have received a copy of the GNU General Public License
706+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
707+ */
708+
709+import QtQuick 2.0
710+import Ubuntu.Components 1.1
711+
712+Rectangle {
713+ height: units.dp(1)
714+ anchors.left: parent.left
715+ anchors.right: parent.right
716+ color: UbuntuColors.coolGrey
717+}
718
719=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/IconButton.qml'
720--- modules/Ubuntu/Components/Extras/MediaPlayer/IconButton.qml 1970-01-01 00:00:00 +0000
721+++ modules/Ubuntu/Components/Extras/MediaPlayer/IconButton.qml 2014-11-14 19:03:25 +0000
722@@ -0,0 +1,43 @@
723+/*
724+ * Copyright (C) 2013 Canonical, Ltd.
725+ *
726+ * Authors:
727+ * Renato Araujo Oliveira Filho <renato@canonical.com>
728+ *
729+ * This program is free software; you can redistribute it and/or modify
730+ * it under the terms of the GNU General Public License as published by
731+ * the Free Software Foundation; version 3.
732+ *
733+ * This program is distributed in the hope that it will be useful,
734+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
735+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
736+ * GNU General Public License for more details.
737+ *
738+ * You should have received a copy of the GNU General Public License
739+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
740+ */
741+
742+import QtQuick 2.0
743+import Ubuntu.Components 1.1
744+
745+AbstractButton {
746+ id: root
747+
748+ property alias iconSource: _image.source
749+ property alias iconSize: _image.height
750+ property bool leftAlignment: false
751+
752+ focus: false
753+
754+ Image {
755+ id: _image
756+
757+ width: height
758+ smooth: true
759+ anchors {
760+ verticalCenter: parent.verticalCenter
761+ horizontalCenter: root.leftAlignment ? undefined : parent.horizontalCenter
762+ left: root.leftAlignment ? parent.left : undefined
763+ }
764+ }
765+}
766
767=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/SceneFrame.qml'
768--- modules/Ubuntu/Components/Extras/MediaPlayer/SceneFrame.qml 1970-01-01 00:00:00 +0000
769+++ modules/Ubuntu/Components/Extras/MediaPlayer/SceneFrame.qml 2014-11-14 19:03:25 +0000
770@@ -0,0 +1,79 @@
771+/*
772+ * Copyright (C) 2013 Canonical, Ltd.
773+ *
774+ * Authors:
775+ * Renato Araujo Oliveira Filho <renato@canonical.com>
776+ *
777+ * This program is free software; you can redistribute it and/or modify
778+ * it under the terms of the GNU General Public License as published by
779+ * the Free Software Foundation; version 3.
780+ *
781+ * This program is distributed in the hope that it will be useful,
782+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
783+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
784+ * GNU General Public License for more details.
785+ *
786+ * You should have received a copy of the GNU General Public License
787+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
788+ */
789+
790+import QtQuick 2.0
791+import Ubuntu.Components 1.1
792+
793+MouseArea {
794+ id: _imageFrame
795+
796+ property int start
797+ property int duration
798+ property alias source: _image.source
799+ property bool active: false
800+ readonly property bool ready: (_image.status === Image.Ready)
801+
802+ Behavior on width {
803+ NumberAnimation { duration: 150; easing.type: Easing.InOutQuart }
804+ }
805+
806+ UbuntuShape {
807+ id: _shape
808+ radius: "medium"
809+
810+ anchors {
811+ fill: parent
812+ topMargin: active ? 0 : units.gu(2)
813+ bottomMargin: active ? 0 : units.gu(2)
814+ leftMargin: units.gu(1)
815+ rightMargin: units.gu(1)
816+
817+ Behavior on topMargin {
818+ NumberAnimation { duration: 150; easing.type: Easing.InOutQuart }
819+ }
820+
821+ Behavior on bottomMargin {
822+ NumberAnimation { duration: 150; easing.type: Easing.InOutQuart }
823+ }
824+ }
825+
826+ image: Image {
827+ id: _image
828+
829+ fillMode: Image.PreserveAspectCrop
830+ smooth: true
831+ asynchronous: true
832+ sourceSize.width: _shape.width
833+ sourceSize.height: _shape.height
834+ }
835+ }
836+
837+ ActivityIndicator {
838+ id: imgLoading
839+
840+ anchors {
841+ verticalCenter: _shape.verticalCenter
842+ horizontalCenter: _shape.horizontalCenter
843+ margins: units.gu(0.5)
844+ }
845+
846+ running: _image.status != Image.Ready
847+ visible: running
848+ }
849+}
850
851=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/SceneSelector.qml'
852--- modules/Ubuntu/Components/Extras/MediaPlayer/SceneSelector.qml 1970-01-01 00:00:00 +0000
853+++ modules/Ubuntu/Components/Extras/MediaPlayer/SceneSelector.qml 2014-11-14 19:03:25 +0000
854@@ -0,0 +1,74 @@
855+/*
856+ * Copyright (C) 2013 Canonical, Ltd.
857+ *
858+ * Authors:
859+ * Renato Araujo Oliveira Filho <renato@canonical.com>
860+ *
861+ * This program is free software; you can redistribute it and/or modify
862+ * it under the terms of the GNU General Public License as published by
863+ * the Free Software Foundation; version 3.
864+ *
865+ * This program is distributed in the hope that it will be useful,
866+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
867+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
868+ * GNU General Public License for more details.
869+ *
870+ * You should have received a copy of the GNU General Public License
871+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
872+ */
873+
874+import QtQuick 2.0
875+import Ubuntu.Components 1.1
876+
877+ListView {
878+ id: _sceneList
879+
880+ signal sceneSelected(int start, int duration)
881+
882+ orientation: ListView.Horizontal
883+
884+ delegate: SceneFrame {
885+ objectName: "SceneSelector.Scene" + index
886+ active: (currentIndex == index)
887+ start: model.start
888+ duration: model.duration
889+ source: model.thumbnail
890+
891+ width: active ? units.gu(27) : units.gu(20)
892+ anchors {
893+ top: parent.top
894+ topMargin: units.gu(2)
895+ bottom: parent.bottom
896+ }
897+
898+ onClicked: {
899+ currentIndex = index
900+ sceneSelected(start, duration)
901+ }
902+ }
903+
904+ function selectSceneAt(time) {
905+ if (time <= 0) {
906+ currentIndex = -1;
907+ }
908+
909+ if (currentItem) {
910+ if ((time >= currentItem.start) &&
911+ (time <= (currentItem.start + currentItem.duration))) {
912+ return
913+ }
914+ }
915+
916+ for(var index = 0; index < _sceneList.model.count; index++) {
917+ var item = _sceneList.model.get(index)
918+ if (item) {
919+ if ((time >= item.start) &&
920+ (time <= (item.start + item.duration))) {
921+ currentIndex = index
922+ return;
923+ }
924+ }
925+ }
926+ currentIndex = -1
927+ }
928+}
929
930=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/TimeLabel.qml'
931--- modules/Ubuntu/Components/Extras/MediaPlayer/TimeLabel.qml 1970-01-01 00:00:00 +0000
932+++ modules/Ubuntu/Components/Extras/MediaPlayer/TimeLabel.qml 2014-11-14 19:03:25 +0000
933@@ -0,0 +1,57 @@
934+/*
935+ * Copyright (C) 2013 Canonical, Ltd.
936+ *
937+ * Authors:
938+ * Renato Araujo Oliveira Filho <renato@canonical.com>
939+ *
940+ * This program is free software; you can redistribute it and/or modify
941+ * it under the terms of the GNU General Public License as published by
942+ * the Free Software Foundation; version 3.
943+ *
944+ * This program is distributed in the hope that it will be useful,
945+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
946+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
947+ * GNU General Public License for more details.
948+ *
949+ * You should have received a copy of the GNU General Public License
950+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
951+ */
952+
953+import QtQuick 2.0
954+import Ubuntu.Components 1.1
955+
956+Label {
957+ id: _TimeLabel
958+ objectName: "TimeLine.TimeLabel"
959+
960+ property string currentTime
961+ property string remainingTime
962+
963+ color: "#e8e1d0"
964+ fontSize: "small"
965+ state: "PROGRESSIVE"
966+ verticalAlignment: Text.AlignVCenter
967+ horizontalAlignment: Text.AlignRight
968+
969+ states: [
970+ State {
971+ name: "PROGRESSIVE"
972+ PropertyChanges { target: _TimeLabel; text: _TimeLabel.currentTime }
973+ },
974+ State {
975+ name: "DEGRESSIVE"
976+ PropertyChanges { target: _TimeLabel; text: "- %1".arg(_TimeLabel.remainingTime) }
977+ }
978+ ]
979+
980+ MouseArea {
981+ anchors.fill: parent
982+ onClicked: {
983+ if (_TimeLabel.state === "PROGRESSIVE") {
984+ _TimeLabel.state = "DEGRESSIVE"
985+ } else {
986+ _TimeLabel.state = "PROGRESSIVE"
987+ }
988+ }
989+ }
990+}
991
992=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml'
993--- modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml 1970-01-01 00:00:00 +0000
994+++ modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml 2014-11-14 19:03:25 +0000
995@@ -0,0 +1,81 @@
996+/*
997+ * Copyright (C) 2013 Canonical, Ltd.
998+ *
999+ * Authors:
1000+ * Renato Araujo Oliveira Filho <renato@canonical.com>
1001+ *
1002+ * This program is free software; you can redistribute it and/or modify
1003+ * it under the terms of the GNU General Public License as published by
1004+ * the Free Software Foundation; version 3.
1005+ *
1006+ * This program is distributed in the hope that it will be useful,
1007+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1008+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1009+ * GNU General Public License for more details.
1010+ *
1011+ * You should have received a copy of the GNU General Public License
1012+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1013+ */
1014+
1015+import QtQuick 2.0
1016+import Ubuntu.Components 1.1
1017+
1018+Slider {
1019+ id: _slider
1020+ objectName: "TimeLine.Slider"
1021+
1022+ readonly property alias liveValue: _slider.value
1023+ property real videoPosition: -1
1024+ property string currentTime
1025+ property string remainingTime
1026+
1027+ signal clicked(bool insideThumb)
1028+
1029+ function formatProgress(time) {
1030+ var hour = 0
1031+ var min = 0
1032+ var secs = 0
1033+ time = Math.floor(time)
1034+
1035+ secs = time % 60
1036+ time = Math.floor(time / 60)
1037+ min = time % 60
1038+ hour = Math.floor(time / 60)
1039+
1040+ if (secs < 10) secs = "0%1".arg(secs)
1041+ if (min < 10) min = "0%1".arg(min)
1042+ if (hour < 10) hour = "0%1".arg(hour)
1043+
1044+ // TRANSLATORS: this refers to a duration/remaining time of the video, of which you can change the order.
1045+ // %1 refers to hours, %2 refers to minutes and %3 refers to seconds.
1046+ return i18n.tr("%1:%2:%3").arg(hour).arg(min).arg(secs)
1047+ }
1048+
1049+ style: VideoSlider {property Item item: _slider}
1050+ minimumValue: 0
1051+ maximumValue: 1000
1052+ live: true
1053+ onVideoPositionChanged: {
1054+ if (!_slider.pressed) {
1055+ _slider.value = _slider.videoPosition
1056+ }
1057+ }
1058+
1059+ onValueChanged: {
1060+ if (value > 0) {
1061+ _slider.currentTime = formatProgress(value)
1062+ if (_slider.maximumValue > 0) {
1063+ _slider.remainingTime = formatProgress(_slider.maximumValue - value)
1064+ } else {
1065+ // TRANSLATORS: this refers to an unknown duration.
1066+ _slider.remainingTime = i18n.tr("unknown")
1067+ }
1068+ } else {
1069+ _slider.currentTime = i18n.tr("0:00:00")
1070+ }
1071+ }
1072+
1073+ onTouched: {
1074+ _slider.clicked(onThumb)
1075+ }
1076+}
1077
1078=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/VLine.qml'
1079--- modules/Ubuntu/Components/Extras/MediaPlayer/VLine.qml 1970-01-01 00:00:00 +0000
1080+++ modules/Ubuntu/Components/Extras/MediaPlayer/VLine.qml 2014-11-14 19:03:25 +0000
1081@@ -0,0 +1,54 @@
1082+/*
1083+ * Copyright (C) 2013 Canonical, Ltd.
1084+ *
1085+ * Authors:
1086+ * Renato Araujo Oliveira Filho <renato@canonical.com>
1087+ *
1088+ * This program is free software; you can redistribute it and/or modify
1089+ * it under the terms of the GNU General Public License as published by
1090+ * the Free Software Foundation; version 3.
1091+ *
1092+ * This program is distributed in the hope that it will be useful,
1093+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1094+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1095+ * GNU General Public License for more details.
1096+ *
1097+ * You should have received a copy of the GNU General Public License
1098+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1099+ */
1100+
1101+import QtQuick 2.0
1102+import Ubuntu.Components 1.1
1103+
1104+Row {
1105+ id: root
1106+
1107+ anchors {
1108+ top: parent.top
1109+ topMargin: units.gu(0.5)
1110+ bottom: parent.bottom
1111+ bottomMargin: units.gu(0.5)
1112+ }
1113+ width: visible ? units.dp(2) : 0
1114+
1115+ Rectangle {
1116+ anchors {
1117+ top: parent.top
1118+ bottom: parent.bottom
1119+ }
1120+
1121+ color: "white"
1122+ opacity: 0.08
1123+ width: root.visible ? units.dp(1) : 0
1124+ }
1125+ Rectangle {
1126+ anchors {
1127+ top: parent.top
1128+ bottom: parent.bottom
1129+ }
1130+
1131+ color: "black"
1132+ opacity: 0.03
1133+ width: root.visible ? units.dp(1) : 0
1134+ }
1135+}
1136
1137=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/VideoPlayer.qml'
1138--- modules/Ubuntu/Components/Extras/MediaPlayer/VideoPlayer.qml 1970-01-01 00:00:00 +0000
1139+++ modules/Ubuntu/Components/Extras/MediaPlayer/VideoPlayer.qml 2014-11-14 19:03:25 +0000
1140@@ -0,0 +1,188 @@
1141+/*
1142+ * Copyright (C) 2013 Canonical, Ltd.
1143+ *
1144+ * Authors:
1145+ * Ugo Riboni <ugo.riboni@canonical.com>
1146+ * Michał Sawicz <michal.sawicz@canonical.com>
1147+ * Renato Araujo Oliveira Filho <renato@canonical.com>
1148+ *
1149+ * This program is free software; you can redistribute it and/or modify
1150+ * it under the terms of the GNU General Public License as published by
1151+ * the Free Software Foundation; version 3.
1152+ *
1153+ * This program is distributed in the hope that it will be useful,
1154+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1155+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1156+ * GNU General Public License for more details.
1157+ *
1158+ * You should have received a copy of the GNU General Public License
1159+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1160+ */
1161+import QtQuick 2.0
1162+import QtMultimedia 5.0
1163+import Ubuntu.Components 1.1
1164+import Ubuntu.Components.Extras 0.1
1165+import Ubuntu.Components.Popups 1.0 as Popups
1166+
1167+AbstractPlayer {
1168+ id: player
1169+ objectName: "player"
1170+
1171+ property alias settingsEnabled: _controlsContents.settingsEnabled
1172+ property variant nfo
1173+ property int pressCount: 0
1174+ property bool wasPlaying: false
1175+ property string uri
1176+ property bool rotating: false
1177+ property alias controlsActive: _controls.opened
1178+ property bool componentLoaded: false
1179+ readonly property int seekStep: 1000
1180+ property var errorDialog: null
1181+ property bool fullscreenMode: false
1182+
1183+ signal timeClicked
1184+ signal settingsClicked
1185+
1186+ function playUri(uri) {
1187+ player.source = uri
1188+ if (componentLoaded) {
1189+ play()
1190+ }
1191+ }
1192+
1193+ function edgeEvent(event) {
1194+ event.accepted = true
1195+ }
1196+
1197+ function playPause() {
1198+ if (["paused", "playing"].indexOf(player.state) != -1) {
1199+ player.togglePause();
1200+ } else {
1201+ player.play();
1202+ }
1203+ }
1204+
1205+//TODO: blur effect does not work fine without multiple thread rendering
1206+// ControlsMask {
1207+// anchors.fill: parent
1208+// controls: _controls
1209+// videoOutput: player.videoOutput
1210+// }
1211+
1212+ Component.onCompleted: {
1213+ componentLoaded = true
1214+ if ((state !== "playing") && (source != "")) {
1215+ play()
1216+ }
1217+ }
1218+
1219+ Panel {
1220+ id: _controls
1221+ objectName: "toolbar"
1222+
1223+ anchors {
1224+ left: parent.left
1225+ right: parent.right
1226+ bottom: parent.bottom
1227+ }
1228+
1229+ height: _controlsContents.height
1230+
1231+ Controls {
1232+ id: _controlsContents
1233+ objectName: "controls"
1234+
1235+ property bool isPaused: false
1236+
1237+ settingsEnabled: player.desktopMode
1238+ state: player.state
1239+ video: player.video
1240+ anchors {
1241+ left: parent.left
1242+ right: parent.right
1243+ bottom: parent.bottom
1244+ }
1245+
1246+ maximumHeight: units.gu(27)
1247+ sceneSelectorHeight: units.gu(18)
1248+
1249+ onPlaybackClicked: player.playPause()
1250+ onFullscreenClicked: player.fullscreenMode = !player.fullscreenMode
1251+ onSeekRequested: player.video.seek(time)
1252+
1253+ onStartSeek: {
1254+ isPaused = (state == "paused")
1255+ player.pause()
1256+ }
1257+
1258+ onEndSeek: {
1259+ if (!isPaused) {
1260+ player.play()
1261+ }
1262+ }
1263+
1264+ onSettingsClicked: player.settingsClicked()
1265+ }
1266+ }
1267+
1268+ MouseArea {
1269+ id: _mouseArea
1270+
1271+ objectName: "videoMouseArea"
1272+ anchors {
1273+ left: parent.left
1274+ right: parent.right
1275+ top: parent.top
1276+ bottom: _controls.top
1277+ }
1278+
1279+ onClicked: {
1280+ if (_controls.opened) {
1281+ _controls.close()
1282+ } else {
1283+ _controls.open()
1284+ }
1285+ }
1286+ }
1287+
1288+ Keys.onPressed: {
1289+ switch(event.key) {
1290+ case Qt.Key_Space:
1291+ player.playPause()
1292+ break;
1293+ case Qt.Key_Right:
1294+ case Qt.Key_Left:
1295+ {
1296+ var currentPos = (video ? video.position : 0)
1297+ var nextPos = currentPos
1298+ if (event.key == Qt.Key_Right) {
1299+ var maxPos = (video ? video.duration : 0)
1300+ nextPos += player.seekStep
1301+ if (nextPos > maxPos) {
1302+ nextPos = -1;
1303+ }
1304+ } else {
1305+ nextPos -= player.seekStep
1306+ if (nextPos < 0) {
1307+ nextPos = -1
1308+ }
1309+ }
1310+
1311+ if (nextPos != -1) {
1312+ player.video.seek(nextPos)
1313+ }
1314+ break;
1315+ }
1316+ case Qt.Key_F11:
1317+ player.fullscreenMode = !player.fullscreenMode
1318+ break;
1319+ case Qt.Key_Escape:
1320+ player.fullscreenMode = false
1321+ break;
1322+ default:
1323+ break;
1324+ }
1325+ }
1326+
1327+ onError: player.error(errorCode)
1328+}
1329
1330=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/VideoSlider.qml'
1331--- modules/Ubuntu/Components/Extras/MediaPlayer/VideoSlider.qml 1970-01-01 00:00:00 +0000
1332+++ modules/Ubuntu/Components/Extras/MediaPlayer/VideoSlider.qml 2014-11-14 19:03:25 +0000
1333@@ -0,0 +1,89 @@
1334+/*
1335+ * Copyright (C) 2013 Canonical, Ltd.
1336+ *
1337+ * Authors:
1338+ * Renato Araujo Oliveira Filho <renato@canonical.com>
1339+ *
1340+ * This program is free software; you can redistribute it and/or modify
1341+ * it under the terms of the GNU General Public License as published by
1342+ * the Free Software Foundation; version 3.
1343+ *
1344+ * This program is distributed in the hope that it will be useful,
1345+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1346+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1347+ * GNU General Public License for more details.
1348+ *
1349+ * You should have received a copy of the GNU General Public License
1350+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1351+ */
1352+
1353+import QtQuick 2.0
1354+import Ubuntu.Components 1.1
1355+
1356+Item {
1357+ id: main
1358+ anchors.fill: parent
1359+
1360+ // properties to be published:
1361+ property Item bar: backgroundShape
1362+ property Item thumb: thumbShape
1363+
1364+ // private properties
1365+ property real thumbSpacing: units.gu(1)
1366+ property real liveValue: SliderUtils.liveValue(item)
1367+ property real normalizedValue: SliderUtils.normalizedValue(item)
1368+
1369+ property real thumbSpace: backgroundShape.width - (2.0 * thumbSpacing + thumbWidth)
1370+ property real thumbWidth: item.height - thumbSpacing
1371+
1372+ BorderImage {
1373+ id: backgroundFilledShape
1374+
1375+ border {
1376+ left: 7
1377+ top: 7
1378+ right: 7
1379+ bottom: 7
1380+ }
1381+ horizontalTileMode: BorderImage.Repeat
1382+ verticalTileMode: BorderImage.Repeat
1383+ source: "assets/slider_shape.png"
1384+ anchors {
1385+ verticalCenter: parent.verticalCenter
1386+ left: parent.left
1387+ leftMargin: units.gu(0.2)
1388+ }
1389+ height: units.gu(1)
1390+ width: normalizedValue * thumbSpace + thumbSpacing + (thumbShape.width / 2)
1391+ }
1392+
1393+ BorderImage {
1394+ id: backgroundShape
1395+
1396+ border {
1397+ left: 7
1398+ top: 7
1399+ right: 7
1400+ bottom: 7
1401+ }
1402+ horizontalTileMode: BorderImage.Repeat
1403+ verticalTileMode: BorderImage.Repeat
1404+ source: "assets/slider_bg.png"
1405+ anchors {
1406+ verticalCenter: parent.verticalCenter
1407+ left: parent.left
1408+ right: parent.right
1409+ }
1410+ height: units.gu(1.5)
1411+ }
1412+
1413+ Image {
1414+ id: thumbShape
1415+
1416+ x: backgroundShape.x + thumbSpacing + normalizedValue * thumbSpace
1417+ anchors.verticalCenter: backgroundShape.verticalCenter
1418+ width: thumbWidth
1419+ height: thumbWidth
1420+ source: "assets/slider_handle.png"
1421+ }
1422+}
1423
1424=== added directory 'modules/Ubuntu/Components/Extras/MediaPlayer/assets'
1425=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/CMakeLists.txt'
1426--- modules/Ubuntu/Components/Extras/MediaPlayer/assets/CMakeLists.txt 1970-01-01 00:00:00 +0000
1427+++ modules/Ubuntu/Components/Extras/MediaPlayer/assets/CMakeLists.txt 2014-11-14 19:03:25 +0000
1428@@ -0,0 +1,10 @@
1429+set(MEDIAPLAYER_COMPONENTS_ARTWORK
1430+ icon_exitfscreen@20.png
1431+ icon_settings@20.png
1432+ icon_share@20.png
1433+ slider_bg.png
1434+ slider_handle.png
1435+ slider_shape.png
1436+)
1437+
1438+install(FILES ${MEDIAPLAYER_COMPONENTS_ARTWORK} DESTINATION ${PLUGIN_DIR}/MediaPlayer/assets)
1439
1440=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_exitfscreen@20.png'
1441Binary files modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_exitfscreen@20.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_exitfscreen@20.png 2014-11-14 19:03:25 +0000 differ
1442=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_settings@20.png'
1443Binary files modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_settings@20.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_settings@20.png 2014-11-14 19:03:25 +0000 differ
1444=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_share@20.png'
1445Binary files modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_share@20.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Extras/MediaPlayer/assets/icon_share@20.png 2014-11-14 19:03:25 +0000 differ
1446=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_bg.png'
1447Binary files modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_bg.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_bg.png 2014-11-14 19:03:25 +0000 differ
1448=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_handle.png'
1449Binary files modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_handle.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_handle.png 2014-11-14 19:03:25 +0000 differ
1450=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_shape.png'
1451Binary files modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_shape.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Extras/MediaPlayer/assets/slider_shape.png 2014-11-14 19:03:25 +0000 differ
1452=== added file 'modules/Ubuntu/Components/Extras/MediaPlayer/qmldir'
1453--- modules/Ubuntu/Components/Extras/MediaPlayer/qmldir 1970-01-01 00:00:00 +0000
1454+++ modules/Ubuntu/Components/Extras/MediaPlayer/qmldir 2014-11-14 19:03:25 +0000
1455@@ -0,0 +1,15 @@
1456+module Ubuntu.MediaPlayer
1457+
1458+VideoPlayer 0.1 VideoPlayer.qml
1459+
1460+internal AbstractPlayer AbstractPlayer.qml
1461+internal ControlsMask ControlsMask.qml
1462+internal Controls Controls.qml
1463+internal HLine HLine.qml
1464+internal IconButton IconButton.qml
1465+internal SceneFrame SceneFrame.qml
1466+internal SceneSelector SceneSelector.qml
1467+internal TimeLabel TimeLabel.qml
1468+internal TimeLine TimeLine.qml
1469+internal VideoSlider VideoSlider.qml
1470+internal VLine VLine.qml
1471
1472=== modified file 'po/CMakeLists.txt'
1473--- po/CMakeLists.txt 2013-08-19 14:24:34 +0000
1474+++ po/CMakeLists.txt 2014-11-14 19:03:25 +0000
1475@@ -5,7 +5,9 @@
1476
1477 file(GLOB_RECURSE I18N_SRC_FILES
1478 RELATIVE ${CMAKE_SOURCE_DIR}
1479- ${CMAKE_SOURCE_DIR}/modules/*.qml)
1480+ ${CMAKE_SOURCE_DIR}/modules/*.qml
1481+ ${mediaplayer_components_SOURCE_DIR}/*.qml
1482+)
1483
1484 set(DOMAIN ${GETTEXT_PACKAGE})
1485 set(POT_FILE ${DOMAIN}.pot)
1486@@ -17,6 +19,7 @@
1487 -D ${CMAKE_SOURCE_DIR}
1488 --from-code=UTF-8
1489 --c++ --qt --add-comments=TRANSLATORS
1490+ --keyword=tr --keyword=tr:1,2
1491 --keyword=dtr:2 --keyword=dtr:2,3
1492 --package-name=ubuntu-ui-extras
1493 --copyright-holder='Canonical Ltd.'
1494
1495=== modified file 'po/ubuntu-ui-extras.pot'
1496--- po/ubuntu-ui-extras.pot 2013-08-13 19:28:33 +0000
1497+++ po/ubuntu-ui-extras.pot 2014-11-14 19:03:25 +0000
1498@@ -8,7 +8,7 @@
1499 msgstr ""
1500 "Project-Id-Version: ubuntu-ui-extras\n"
1501 "Report-Msgid-Bugs-To: \n"
1502-"POT-Creation-Date: 2013-08-13 19:42+0200\n"
1503+"POT-Creation-Date: 2014-11-14 16:00-0300\n"
1504 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1505 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1506 "Language-Team: LANGUAGE <LL@li.org>\n"
1507@@ -17,22 +17,38 @@
1508 "Content-Type: text/plain; charset=CHARSET\n"
1509 "Content-Transfer-Encoding: 8bit\n"
1510
1511-#: modules/Ubuntu/Components/Extras/Share.qml:208
1512+#. TRANSLATORS: this refers to a duration/remaining time of the video, of which you can change the order.
1513+#. %1 refers to hours, %2 refers to minutes and %3 refers to seconds.
1514+#: modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml:51
1515+#, qt-format
1516+msgid "%1:%2:%3"
1517+msgstr ""
1518+
1519+#: modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml:74
1520+msgid "0:00:00"
1521+msgstr ""
1522+
1523+#: modules/Ubuntu/Components/Extras/Share.qml:181
1524 msgid "Cancel"
1525 msgstr ""
1526
1527-#: modules/Ubuntu/Components/Extras/Share.qml:265
1528+#: modules/Ubuntu/Components/Extras/Share.qml:236
1529 msgid "Include location"
1530 msgstr ""
1531
1532-#: modules/Ubuntu/Components/Extras/Share.qml:219
1533+#: modules/Ubuntu/Components/Extras/Share.qml:192
1534 msgid "Post"
1535 msgstr ""
1536
1537-#: modules/Ubuntu/Components/Extras/Share.qml:42
1538+#: modules/Ubuntu/Components/Extras/Share.qml:43
1539 msgid "There was a problem uploading your photo"
1540 msgstr ""
1541
1542-#: modules/Ubuntu/Components/Extras/Share.qml:40
1543+#: modules/Ubuntu/Components/Extras/Share.qml:41
1544 msgid "Your photo has been uploaded"
1545 msgstr ""
1546+
1547+#. TRANSLATORS: this refers to an unknown duration.
1548+#: modules/Ubuntu/Components/Extras/MediaPlayer/TimeLine.qml:71
1549+msgid "unknown"
1550+msgstr ""

Subscribers

People subscribed via source and target branches