property bool pressed: capture.pressed || zoomSlider.pressed || modeButton.pressed
property bool controlsVisible: imageMode.canCapture && cam.running && !animationRunning
&& dimmer.opacity == 0.0 && !cameraMode.busy
+ property bool inhibitDim: false
signal previewAvailable(string uri)
id: imageMode
camera: cam
- onCaptureEnded: cam.autoFocus.stopAutoFocus()
+ onCaptureEnded: stopAutoFocus()
onPreviewAvailable: overlay.previewAvailable(preview)
- onSaved: mountProtector.unlock()
+ onSaved: mountProtector.unlock(fileNaming.imagePath)
}
ZoomSlider {
anchors.right: parent.right
anchors.rightMargin: 20
anchors.verticalCenter: parent.verticalCenter
- iconId: cameraTheme.captureButtonImageIconId
+ iconSource: cameraTheme.captureButtonImageIconId
width: 75
height: 75
opacity: 0.5
- onClicked: captureImage()
- visible: controlsVisible && (!settings.zoomAsShutter && keys.active)
+ visible: controlsVisible
onExited: {
if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
// Release outside the button:
- cam.autoFocus.stopAutoFocus()
+ captureControl.canceled = true
}
}
}
Timer {
id: autoFocusTimer
interval: 200
- running: capture.pressed || zoomCapture.zoomPressed
+ running: captureControl.state == "capturing"
repeat: false
onTriggered: {
if (cam.autoFocus.cafStatus != AutoFocus.Success) {
- cam.autoFocus.startAutoFocus()
+ startAutoFocus()
}
}
}
ZoomCaptureButton {
id: zoomCapture
- onReleased: parent.captureImage()
}
- ZoomCaptureCancel {
+ CaptureControl {
+ id: captureControl
+ capturePressed: capture.pressed
+ zoomPressed: zoomCapture.zoomPressed
+ proximityClosed: proximitySensor.sensorClosed
+ onStartCapture: captureImage()
+ onCancelCapture: stopAutoFocus()
+ }
+
+ CaptureCancel {
anchors.fill: parent
- zoomCapture: zoomCapture
- onCanceled: {
- if (!autoFocusTimer.running) {
- cam.autoFocus.stopAutoFocus()
- }
- }
+ enabled: captureControl.showCancelBanner
+ onPressed: captureControl.canceled = true
}
CameraToolBar {
tools: CameraToolBarTools {
FlashButton {
onClicked: toolBar.push(tools)
+ visible: overlay.cam ? !overlay.cam.quirks.hasQuirk(Quirks.NoFlash) : false
}
ImageSceneButton {
Indicator {
id: flashIndicator
- visible: !toolBar.expanded
- source: "image://theme/" + cameraTheme.flashIndicatorIcon(settings.imageFlashMode)
+ visible: !toolBar.expanded && !overlay.cam.quirks.hasQuirk(Quirks.NoFlash)
+ source: cameraTheme.flashIcon(settings.imageFlashMode)
}
- Indicator {
- id: resolutionIndicator
- property string imageAspectRatio: settings.device == 1 ? settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
- property string imageResolution: settings.device == 1 ? settings.secondaryImageResolution : settings.primaryImageResolution
- source: "image://theme/" + cameraTheme.imageIcon(imageAspectRatio, imageResolution, settings.device)
+ CameraLabel {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 5
+ anchors.rightMargin: 5
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ text: imageSettings.currentResolution ? qsTr("%1M").arg(imageSettings.currentResolution.megaPixels) : qsTr("?M")
+ font.bold: true
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
}
Indicator {
id: wbIndicator
- source: visible ? "image://theme/" + cameraTheme.whiteBalanceIndicatorIcon(settings.imageWhiteBalance) : ""
+ source: visible ? cameraTheme.whiteBalanceIcon(settings.imageWhiteBalance) : ""
visible: settings.imageWhiteBalance != WhiteBalance.Auto && !toolBar.expanded
}
Indicator {
id: cfIndicator
- source: visible ? "image://theme/" + cameraTheme.colorFilterIndicatorIcon(settings.imageColorFilter) : ""
+ source: visible ? cameraTheme.colorFilterIcon(settings.imageColorFilter) : ""
visible: settings.imageColorFilter != ColorTone.Normal && !toolBar.expanded
}
Indicator {
id: isoIndicator
visible: settings.imageIso != 0 && !toolBar.expanded
- source: visible ? "image://theme/" + cameraTheme.isoIcon(settings.imageIso) : ""
+ source: visible ? cameraTheme.isoIcon(settings.imageIso) : ""
}
Indicator {
id: sceneIndicator
visible: settings.imageSceneMode != Scene.Auto && !toolBar.expanded
- source: visible ? "image://theme/" + cameraTheme.imageSceneModeIndicatorIcon(settings.imageSceneMode) : ""
+ source: visible ? cameraTheme.imageSceneModeIcon(settings.imageSceneMode) : ""
}
Indicator {
}
function cameraError() {
- mountProtector.unlock()
+ mountProtector.unlock(fileNaming.imagePath)
}
function policyLost() {
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()
- } else if (!checkDiskSpace()) {
+ stopAutoFocus()
+ } else if (!fileSystem.hasFreeSpace(fileNaming.imagePath)) {
showError(qsTr("Not enough space to capture images."))
- cam.autoFocus.stopAutoFocus()
- } else if (!mountProtector.lock()) {
+ stopAutoFocus()
+ } else if (!mountProtector.lock(fileNaming.imagePath)) {
showError(qsTr("Failed to lock images directory."))
- cam.autoFocus.stopAutoFocus()
+ stopAutoFocus()
} else {
metaData.setMetaData()
var fileName = fileNaming.imageFileName()
if (!imageMode.capture(fileName)) {
showError(qsTr("Failed to capture image. Please restart the camera."))
- mountProtector.unlock()
- cam.autoFocus.stopAutoFocus()
+ mountProtector.unlock(fileNaming.imagePath)
+ stopAutoFocus()
} else {
trackerStore.storeImage(fileName)
}
}
}
+ function startAutoFocus() {
+ if (!overlay.cam.quirks.hasQuirk(Quirks.NoAutoFocus)) {
+ cam.autoFocus.startAutoFocus()
+ }
+ }
+
+ function stopAutoFocus() {
+ if (!overlay.cam.quirks.hasQuirk(Quirks.NoAutoFocus)) {
+ if (!autoFocusTimer.running) {
+ cam.autoFocus.stopAutoFocus()
+ }
+ }
+ }
+
+ function resetToolBar() {
+ if (toolBar.depth() > 1) {
+ toolBar.pop()
+ }
+ }
+
+ function cameraDeviceChanged() {
+ resetToolBar()
+ }
}