X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=qml%2FVideoOverlay.qml;h=60e5467b37e453f7b043eae18e5e60f6494cfb36;hp=9e9add1551b9f3ba22ac0b905def1afe48e3c710;hb=c5ecf23d0f96976948626ba51275419067fdd4ee;hpb=9fda7f8b0e9a317b0ab90463f1d0a163abc7e319 diff --git a/qml/VideoOverlay.qml b/qml/VideoOverlay.qml index 9e9add1..60e5467 100644 --- a/qml/VideoOverlay.qml +++ b/qml/VideoOverlay.qml @@ -23,7 +23,6 @@ import QtQuick 2.0 import QtCamera 1.0 import CameraPlus 1.0 -import "data.js" as Data Item { id: overlay @@ -36,6 +35,7 @@ Item { && dimmer.opacity == 0.0 && !cameraMode.busy property bool pressed: overlay.recording || capture.pressed || zoomSlider.pressed || modeButton.pressed + property bool inhibitDim: recording signal previewAvailable(string uri) @@ -67,12 +67,20 @@ Item { ZoomCaptureButton { id: zoomCapture - onReleased: overlay.toggleRecording() } - ZoomCaptureCancel { + CaptureControl { + id: captureControl + capturePressed: capture.pressed + zoomPressed: zoomCapture.zoomPressed + proximityClosed: proximitySensor.sensorClosed + onStartCapture: overlay.toggleRecording() + } + + CaptureCancel { anchors.fill: parent - zoomCapture: zoomCapture + enabled: captureControl.showCancelBanner + onPressed: captureControl.canceled = true } CaptureButton { @@ -80,14 +88,19 @@ Item { anchors.right: parent.right anchors.rightMargin: 20 anchors.verticalCenter: parent.verticalCenter - iconId: overlay.recording ? "icon-m-camera-video-record" : "icon-m-camera-video-record" + iconSource: overlay.recording ? cameraTheme.captureButtonRecordingIconId : cameraTheme.captureButtonVideoIconId width: 75 height: 75 opacity: 0.5 - onClicked: overlay.toggleRecording() + visible: controlsVisible - visible: controlsVisible && (!settings.zoomAsShutter && keys.active) + onExited: { + if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) { + // Release outside the button: + captureControl.canceled = true + } + } } CameraToolBar { @@ -102,26 +115,33 @@ Item { expanded: settings.showToolBar onExpandedChanged: settings.showToolBar = expanded; - items: [ + tools: CameraToolBarTools { VideoTorchButton { camera: cam - }, + visible: overlay.cam ? !overlay.cam.quirks.hasQuirk(Quirks.NoVideoTorch) : false + } + VideoSceneButton { -// TODO: hide when recording - onClicked: toolBar.push(items) - }, + property bool hide: overlay.cam ? (overlay.recording && overlay.cam.quirks.hasQuirk(Quirks.NoSceneModeChangeDuringRecording)) || overlay.cam.quirks.hasQuirk(Quirks.NoNightSceneMode) : false + visible: !hide + onClicked: toolBar.push(tools) + } + VideoEvCompButton { - onClicked: toolBar.push(items) - }, + onClicked: toolBar.push(tools) + } + VideoWhiteBalanceButton { - onClicked: toolBar.push(items) - }, + onClicked: toolBar.push(tools) + } + VideoColorFilterButton { - onClicked: toolBar.push(items) - }, + onClicked: toolBar.push(tools) + } + VideoMuteButton { } - ] + } } Rectangle { @@ -144,25 +164,32 @@ Item { Indicator { id: resolutionIndicator - source: "image://theme/" + Data.videoIcon(settings.videoResolution) + source: cameraTheme.videoIcon(settings.videoAspectRatio, + settings.videoResolution, settings.device) } Indicator { id: wbIndicator - source: visible ? "image://theme/" + Data.wbIcon(settings.videoWhiteBalance) + "-screen" : "" - visible: settings.videoWhiteBalance != WhiteBalance.Auto + source: visible ? cameraTheme.whiteBalanceIcon(settings.videoWhiteBalance) : "" + visible: settings.videoWhiteBalance != WhiteBalance.Auto && !toolBar.expanded } Indicator { id: cfIndicator - source: "image://theme/" + Data.cfIcon(settings.videoColorFilter) + "-screen" - visible: settings.videoColorFilter != ColorTone.Normal + source: visible ? cameraTheme.colorFilterIcon(settings.videoColorFilter) : "" + visible: settings.videoColorFilter != ColorTone.Normal && !toolBar.expanded + } + + Indicator { + id: sceneIndicator + visible: settings.videoSceneMode != Scene.Auto && (!toolBar.expanded || overlay.recording) + source: visible ? cameraTheme.videoSceneModeIcon(settings.videoSceneMode) : "" } Indicator { id: gpsIndicator visible: settings.useGps - source: "image://theme/icon-m-camera-location" + source: cameraTheme.gpsIndicatorIcon PropertyAnimation on opacity { easing.type: Easing.OutSine @@ -177,10 +204,6 @@ Item { } } - DisplayState { - inhibitDim: overlay.recording - } - Connections { target: Qt.application onActiveChanged: { @@ -203,7 +226,7 @@ Item { if (duration == 3600) { overlay.stopRecording() showError(qsTr("Maximum recording time reached.")) - } else if (!checkDiskSpace()) { + } else if (!fileSystem.hasFreeSpace(fileNaming.temporaryVideoPath)) { page.stopRecording() showError(qsTr("Not enough space to continue recording.")) } @@ -216,6 +239,12 @@ Item { duration: recordingDuration.duration } + function resetToolBar() { + if (toolBar.depth() > 1) { + toolBar.pop() + } + } + function doStartRecording() { if (!overlay.recording) { return @@ -229,23 +258,32 @@ Item { metaData.setMetaData() - if (!mountProtector.lock()) { - showError(qsTr("Failed to lock images directory.")) + if (!mountProtector.lock(fileNaming.temporaryVideoPath)) { + showError(qsTr("Failed to lock temporary videos directory.")) overlay.recording = false return } + if (!mountProtector.lock(fileNaming.videoPath)) { + showError(qsTr("Failed to lock videos directory.")) + overlay.recording = false + mountProtector.unlockAll() + return + } + var file = fileNaming.videoFileName() var tmpFile = fileNaming.temporaryVideoFileName() if (!videoMode.startRecording(file, tmpFile)) { showError(qsTr("Failed to record video. Please restart the camera.")) - mountProtector.unlock() + mountProtector.unlockAll() overlay.recording = false return } trackerStore.storeVideo(file); + + resetToolBar() } function startRecording() { @@ -253,7 +291,7 @@ Item { showError(qsTr("Camera cannot record videos in mass storage mode.")) } else if (!checkBattery()) { showError(qsTr("Not enough battery to record video.")) - } else if (!checkDiskSpace()) { + } else if (!fileSystem.hasFreeSpace(fileNaming.videoPath) || !fileSystem.hasFreeSpace(fileNaming.temporaryVideoPath)) { showError(qsTr("Not enough space to record video.")) } else { recordingDuration.duration = 0 @@ -264,7 +302,7 @@ Item { function stopRecording() { videoMode.stopRecording(true) - mountProtector.unlock() + mountProtector.unlockAll() overlay.recording = false } @@ -295,4 +333,7 @@ Item { } } + function cameraDeviceChanged() { + resetToolBar() + } }