X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;ds=sidebyside;f=qml%2FPostCaptureItem.qml;h=b2911fe67e1d103eca3eb286e50a7e48f8574f12;hb=9299fa292ded077de6e80532f3cfc79c523d7d8f;hp=8b3d243c2469e82be3a1ba2f55a3823ad0d74526;hpb=5d2ea1d2e6f34d940d13bafa6f37d0dada83499c;p=harmattan%2Fcameraplus diff --git a/qml/PostCaptureItem.qml b/qml/PostCaptureItem.qml index 8b3d243..b2911fe 100644 --- a/qml/PostCaptureItem.qml +++ b/qml/PostCaptureItem.qml @@ -3,7 +3,7 @@ /*! * This file is part of CameraPlus. * - * Copyright (C) 2012 Mohammed Sameer + * Copyright (C) 2012-2013 Mohammed Sameer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,58 +20,74 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -import QtQuick 1.1 -import com.nokia.meego 1.1 +@IMPORT_QT_QUICK@ import CameraPlus 1.0 Item { - id: item - property bool isVideo: type.search("nmm#Video") > 0 - property bool error: false + id: postCaptureItem + property bool isVideo: itemData.type.search("nmm#Video") > 0 + property alias error: image.error + property variant itemData: item + property bool playing: loader.source != "" + signal clicked - property bool isCurrentItem: PathView.isCurrentItem - onIsCurrentItemChanged: page.currentItem = item; - - property string fileName: filename - property string creationDate: created - property string itemTitle: title - property bool itemAvailable: available - - function startPlayback() { - openFileNow("VideoPlayerPage.qml"); - pageStack.currentPage.source = url; - pageStack.currentPage.play(); + function startPlayback() { + loader.source = Qt.resolvedUrl("VideoPlayerPage.qml") + loader.item.source = itemData.url + if (!loader.item.play()) { + showError(qsTr("Error playing video. Please try again.")) + loader.source = "" } + } - Label { - anchors.fill: parent - visible: image.error && page.status == PageStatus.Active - text: qsTr("Failed to load preview"); - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 32 + function stopPlayback() { + if (loader.item) { + loader.item.stop() } + } + + Loader { + id: loader + anchors.fill: parent + } - QuillItem { - id: image - anchors.fill: parent - visible: page.status == PageStatus.Activating || page.status == PageStatus.Active + Connections { + target: loader.item + onFinished: loader.source = "" + } - Component.onCompleted: initialize(url, mimetype); +// TODO: rotation + QuillItem { + id: image + width: parent.width - 10 + height: parent.height + anchors.centerIn: parent + Component.onCompleted: initialize(itemData.url, itemData.mimetype) + visible: loader.source == "" - MouseArea { - id: mouse - anchors.fill: parent - enabled: true - onClicked: toolBar.visible = !toolBar.visible - } + CameraLabel { + anchors.fill: parent + visible: image.error + text: qsTr("Failed to load preview") + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 32 + } + + MouseArea { + id: mouse + anchors.fill: parent + enabled: true + onClicked: postCaptureItem.clicked() + } - ToolIcon { - id: playIcon - anchors.centerIn: parent - iconSource: "image://theme/icon-s-music-video-play" - visible: isVideo - onClicked: startPlayback(); - } + CameraToolIcon { + // TODO: this is overlapping with error. + id: playIcon + anchors.centerIn: parent + iconSource: "image://theme/icon-s-music-video-play" + visible: isVideo + onClicked: startPlayback() } + } }