X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=qml%2FImageOverlay.qml;fp=qml%2FImageOverlay.qml;h=415a0c3f26d0512f70358e0de375c5d4f1e90cc9;hp=1a889c9d324f5b2e370aef811f8bd4c03725ea1b;hb=202fb5ef933fed92358921aeecf63ef0632a8ab6;hpb=cdcb88a118615a70555d502aa52886314a8e34de diff --git a/qml/ImageOverlay.qml b/qml/ImageOverlay.qml index 1a889c9..415a0c3 100644 --- a/qml/ImageOverlay.qml +++ b/qml/ImageOverlay.qml @@ -42,7 +42,7 @@ Item { id: imageMode camera: cam - onCaptureEnded: cam.autoFocus.stopAutoFocus() + onCaptureEnded: stopAutoFocus() onPreviewAvailable: overlay.previewAvailable(preview) @@ -82,7 +82,7 @@ Item { onExited: { if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) { // Release outside the button: - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } } } @@ -94,7 +94,7 @@ Item { repeat: false onTriggered: { if (cam.autoFocus.cafStatus != AutoFocus.Success) { - cam.autoFocus.startAutoFocus() + startAutoFocus() } } } @@ -109,7 +109,7 @@ Item { zoomCapture: zoomCapture onCanceled: { if (!autoFocusTimer.running) { - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } } } @@ -255,19 +255,19 @@ Item { function captureImage() { if (!imageMode.canCapture) { showError(qsTr("Camera is already capturing an image.")) - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } else if (!checkBattery()) { showError(qsTr("Not enough battery to capture images.")) - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } else if (!fileSystem.available) { showError(qsTr("Camera cannot capture images in mass storage mode.")) - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } else if (!fileSystem.hasFreeSpace(fileNaming.imagePath)) { showError(qsTr("Not enough space to capture images.")) - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } else if (!mountProtector.lock(fileNaming.imagePath)) { showError(qsTr("Failed to lock images directory.")) - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } else { metaData.setMetaData() @@ -275,11 +275,23 @@ Item { if (!imageMode.capture(fileName)) { showError(qsTr("Failed to capture image. Please restart the camera.")) mountProtector.unlock(fileNaming.imagePath) - cam.autoFocus.stopAutoFocus() + stopAutoFocus() } else { trackerStore.storeImage(fileName) } } } + function startAutoFocus() { + if (cam.device == 0) { + cam.autoFocus.startAutoFocus() + } + } + + function stopAutoFocus() { + if (cam.device == 0) { + cam.autoFocus.stopAutoFocus() + } + } + }