orientationLock: PageOrientation.LockLandscape
- Button {
+ function captureImage() {
+ if (!checkBattery()) {
+ showError(qsTr("Not enough battery to capture images."));
+ return;
+ }
+
+ if (!checkDiskSpace()) {
+ showError(qsTr("Not enough space to capture images."));
+ return;
+ }
+
+ if (!fileSystem.available) {
+ showError(qsTr("Camera cannot capture images in mass storage mode."));
+ return;
+ }
+
+ if (!mountProtector.lock()) {
+ showError(qsTr("Failed to lock images directory."));
+ return;
+ }
+
+ metaData.setMetaData();
+
+ var fileName = fileNaming.imageFileName();
+ if (!imageMode.capture(fileName)) {
+ showError(qsTr("Failed to capture image. Please restart the camera."));
+ return;
+ }
+
+ trackerStore.storeImage(fileName);
+ }
+
+ CaptureButton {
id: capture
anchors.right: parent.right
anchors.rightMargin: 20
width: 75
height: 75
opacity: 0.5
- onClicked: {
- if (!checkBattery()) {
- showError(qsTr("Not enough battery to capture images."));
- return;
- }
-
- if (!checkDiskSpace()) {
- showError(qsTr("Not enough space to capture images."));
- return;
- }
-
- if (!fileSystem.available) {
- showError(qsTr("Camera cannot capture images in mass storage mode."));
- return;
- }
+ onClicked: captureImage();
+ visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
- if (!mountProtector.lock()) {
- showError(qsTr("Failed to lock images directory."));
- return;
+ onExited: {
+ if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
+ // Release outside the button:
+ cam.autoFocus.stopAutoFocus();
}
+ }
- metaData.setMetaData();
-
- var fileName = fileNaming.imageFileName();
- if (!imageMode.capture(fileName)) {
- showError(qsTr("Failed to capture image. Please restart the camera."));
- return;
+ Timer {
+ interval: 200
+ running: capture.pressed
+ repeat: false
+ onTriggered: {
+ if (cam.autoFocus.cafStatus != AutoFocus.Success) {
+ cam.autoFocus.startAutoFocus();
+ }
}
-
- trackerStore.storeImage(fileName);
}
-
- visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
}
ImageMode {
id: imageMode
camera: cam
- onPreviewAvailable: page.setPreview(preview);
+ onPreviewAvailable: { page.setPreview(preview); cam.autoFocus.stopAutoFocus(); }
onSaved: mountProtector.unlock();
}