X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=qml%2FRecordingPage.qml;h=d21314a8f0a37c688ee45a70bb388995155718d3;hb=138b60f5d497b35c0c1b74335f9219acab9eda5f;hp=a8ca768f89ec95ae3f3d57c58eafb113495bd7cc;hpb=026b73fecdd1a92c6795a772ce35e636fb79a553;p=harmattan%2Fcameraplus diff --git a/qml/RecordingPage.qml b/qml/RecordingPage.qml index a8ca768..d21314a 100644 --- a/qml/RecordingPage.qml +++ b/qml/RecordingPage.qml @@ -26,18 +26,29 @@ import QtCamera 1.0 import CameraPlus 1.0 import "data.js" as Data -// TODO: on error ? // 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.onDestruction: videoMode.stopRecording(); onStatusChanged: { @@ -70,21 +81,16 @@ CameraPage { mountProtector.unlock(); } - // TODO: sometimes this fails (fast stop after start). 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 - - orientationLock: PageOrientation.LockLandscape - DisplayState { inhibitDim: true } @@ -124,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 @@ -209,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"); + } + ] + } }