X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=qml%2FVideoPlayerPage.qml;h=7f4d98139a78ff795398a9fb93343e624d13b9b4;hb=202fb5ef933fed92358921aeecf63ef0632a8ab6;hp=490e6b6ae2e48288ba9772cc692f294b103b19b1;hpb=960eb792acde51e3e0b862c19d58acaf3082c500;p=harmattan%2Fcameraplus diff --git a/qml/VideoPlayerPage.qml b/qml/VideoPlayerPage.qml index 490e6b6..7f4d981 100644 --- a/qml/VideoPlayerPage.qml +++ b/qml/VideoPlayerPage.qml @@ -20,12 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -import QtQuick 1.1 -import com.nokia.meego 1.1 -import QtMultimediaKit 1.1 +import QtQuick 2.0 import CameraPlus 1.0 - -// TODO: error reporting +import QtCamera 1.0 +import QtCameraExtras 1.0 Item { id: page @@ -34,7 +32,11 @@ Item { property alias source: video.source function play() { - video.play() + return video.play() + } + + function stop() { + return video.stop() } MouseArea { @@ -53,19 +55,26 @@ Item { onTriggered: toolBar.show = false } - Video { + VideoPlayer { id: video anchors.fill: parent + cameraConfig: camera.cameraConfig + + onError: showError(qsTr("Error playing video. Please try again or restart the application")) function toggle() { - if (!video.paused) { + if (state != VideoPlayer.StatePaused) { video.pause() } else { page.play() } } - onStopped: page.finished() + onStateChanged: { + if (state == VideoPlayer.StateStopped) { + page.finished() + } + } } Connections { @@ -82,7 +91,7 @@ Item { property bool show: true - manualBack: true + hideBack: true expanded: true anchors.bottom: parent.bottom anchors.bottomMargin: show ? 20 : -1 * (height + 20) @@ -94,20 +103,19 @@ Item { PropertyAnimation { duration: 200; } } - items: [ - ToolIcon { - iconId: "icon-m-toolbar-mediacontrol-stop-white" + tools: CameraToolBarTools { + CameraToolIcon { + iconSource: cameraTheme.videoStopIconId onClicked: video.stop() - }, - Slider { + } + + CameraSlider { id: slider height: toolBar.height anchors.verticalCenter: parent.verticalCenter - platformStyle: SliderStyle { - handleBackground: "" - handleBackgroundPressed: "" - } + handleBackground: "" + handleBackgroundPressed: "" minimumValue: 0 maximumValue: video.duration @@ -121,15 +129,16 @@ Item { hideTimer.restart() } - }, - ToolIcon { + } + + CameraToolIcon { id: control - iconId: !video.paused ? "icon-m-toolbar-mediacontrol-pause-white" : "icon-m-toolbar-mediacontrol-play-white" + iconSource: video.state != VideoPlayer.StatePaused ? cameraTheme.videoPauseIconId : cameraTheme.videoPlayIconId onClicked: { video.toggle() hideTimer.restart() } } - ] + } } }