X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=qml%2FRecordingPage.qml;h=d21314a8f0a37c688ee45a70bb388995155718d3;hb=138b60f5d497b35c0c1b74335f9219acab9eda5f;hp=2f1a1dc8204f3468b68378fb55ba74a93df99ff4;hpb=96fefaa02155998f7e040ab19dfaeaf18236e4ee;p=harmattan%2Fcameraplus diff --git a/qml/RecordingPage.qml b/qml/RecordingPage.qml index 2f1a1dc..d21314a 100644 --- a/qml/RecordingPage.qml +++ b/qml/RecordingPage.qml @@ -26,17 +26,40 @@ import QtCamera 1.0 import CameraPlus 1.0 import "data.js" as Data -// TODO: on error ? -// TODO: resources lost? +// TODO: losing resources in the middle of recording will produce corrupted video +// TODO: optional resources? + CameraPage { id: page modesVisible: false + property bool error: false + + policyMode: CameraResources.Recording + + controlsVisible: cam.running && videoMode.recording && !cameraMode.animationRunning && !previewAnimationRunning && !error + + orientationLock: PageOrientation.LockLandscape + + function policyLost() { + page.stopRecording(); + } + + function cameraError() { + error = true; + page.stopRecording(); + } - Component.onCompleted: startRecording(); Component.onDestruction: videoMode.stopRecording(); + onStatusChanged: { + if (page.status == PageStatus.Active) { + startRecording(); + } + } + function startRecording() { - if (!resourcePolicy.acquired || resourcePolicy.hijacked) { + if (!pipelineManager.acquired || pipelineManager.hijacked) { + showError(qsTr("Failed to acquire needed resources.")); pageStack.pop(undefined, true); return; } @@ -57,19 +80,17 @@ CameraPage { pageStack.pop(undefined, true); mountProtector.unlock(); } + + trackerStore.storeVideo(file); } function stopRecording() { mountProtector.unlock(); - pageStack.pop(undefined, true); + // Something is fishy here but if there is an error + // and we use immediate mode then the page never gets destroyed. + pageStack.pop(undefined, error ? false : true); } - policyMode: CameraResources.Recording - - controlsVisible: cam.running && videoMode.recording && !cameraMode.animationRunning && !previewAnimationRunning && !standbyWidget.visible - - orientationLock: PageOrientation.LockLandscape - DisplayState { inhibitDim: true } @@ -81,7 +102,7 @@ CameraPage { } } - Button { + CaptureButton { id: recording anchors.right: parent.right anchors.rightMargin: 20 @@ -109,30 +130,63 @@ CameraPage { camera: cam } - VideoTorchButton { - id: torch - camera: cam - visible: controlsVisible + Rectangle { anchors.top: parent.top - anchors.left: parent.left anchors.topMargin: 20 + anchors.left: parent.left anchors.leftMargin: 20 + width: 48 + height: col.height + color: "black" + border.color: "gray" + radius: 20 opacity: 0.5 - } - - VideoEvCompButton { - id: evComp visible: controlsVisible - anchors.top: torch.bottom - anchors.left: parent.left - anchors.topMargin: 10 - anchors.leftMargin: 20 + + Column { + id: col + width: parent.width + spacing: 5 + + Indicator { + id: resolutionIndicator + source: "image://theme/" + Data.videoIcon(settings.videoResolution); + } + + Indicator { + id: wbIndicator + source: visible ? "image://theme/" + Data.wbIcon(settings.videoWhiteBalance) + "-screen" : "" + visible: settings.videoWhiteBalance != WhiteBalance.Auto + } + + Indicator { + id: cfIndicator + source: "image://theme/" + Data.cfIcon(settings.videoColorFilter) + "-screen" + visible: settings.videoColorFilter != ColorTone.Normal + } + + Indicator { + id: gpsIndicator + visible: settings.useGps + source: "image://theme/icon-m-camera-location" + + PropertyAnimation on opacity { + easing.type: Easing.OutSine + loops: Animation.Infinite + from: 0.2 + to: 1.0 + duration: 1000 + running: settings.useGps && !positionSource.position.longitudeValid + alwaysRunToEnd: true + } + } + } } Rectangle { - anchors.left: parent.left anchors.bottom: parent.bottom - anchors.leftMargin: 20 + anchors.right: parent.right + anchors.rightMargin: 20 anchors.bottomMargin: 20 visible: controlsVisible @@ -194,4 +248,38 @@ CameraPage { anchors.leftMargin: 5 } } + + CameraToolBar { + id: toolBar + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 20 + opacity: 0.5 + targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5) + visible: controlsVisible + expanded: settings.showToolBar + onExpandedChanged: settings.showToolBar = expanded; + + items: [ + VideoTorchButton { + camera: cam + }, + VideoEvCompButton { + onClicked: toolBar.push(items); + }, + VideoWhiteBalanceButton { + onClicked: toolBar.push(items); + }, + VideoColorFilterButton { + onClicked: toolBar.push(items); + }, + VideoMuteButton { + }, + ToolIcon { + iconSource: "image://theme/icon-m-toolbar-view-menu-white" + onClicked: openFile("VideoSettingsPage.qml"); + } + ] + } }