diff --git a/OptionValueButton.qml b/OptionValueButton.qml index b56ce47..3137c40 100644 --- a/OptionValueButton.qml +++ b/OptionValueButton.qml @@ -24,6 +24,7 @@ AbstractButton { property alias label: label.text property alias iconName: icon.name + property alias iconSource: icon.source property bool selected property bool isLast property int columnWidth diff --git a/OptionsOverlay.qml b/OptionsOverlay.qml index fbd09c9..0f9c40c 100644 --- a/OptionsOverlay.qml +++ b/OptionsOverlay.qml @@ -143,6 +143,7 @@ Item { label: (model && model.label) ? i18n.tr(model.label) : "" iconName: (model && model.icon) ? model.icon : "" + iconSource: (model && model.iconSource) ? model.iconSource : "" selected: optionValueSelector.model.selectedIndex == index isLast: index === optionValueSelector.count - 1 diff --git a/ViewFinderOverlay.qml b/ViewFinderOverlay.qml index 29ea8a0..cb29133 100644 --- a/ViewFinderOverlay.qml +++ b/ViewFinderOverlay.qml @@ -44,6 +44,7 @@ Item { id: settings property int flashMode: Camera.FlashAuto + property bool screenFlash: false property bool gpsEnabled: false property bool hdrEnabled: false property int videoFlashMode: Camera.FlashOff @@ -389,6 +390,29 @@ Item { value: Camera.FlashOff } }, + ListModel { + id: screenFlashOptionsModel + + property string settingsProperty: "screenFlash" + property string icon: "" + property string label: "" + property bool isToggle: true + property int selectedIndex: bottomEdge.indexForValue(screenFlashOptionsModel, settings.screenFlash) + property bool available: (!camera.advanced.hasFlash && camera.position === Camera.FrontFace) + property bool visible: camera.captureMode == Camera.CaptureStillImage + property bool showInIndicators: true + + ListElement { + iconSource: "assets/screen_flash_on.png" + label: QT_TR_NOOP("On") + value: true + } + ListElement { + iconSource: "assets/screen_flash_off.png" + label: QT_TR_NOOP("Off") + value: false + } + }, ListModel { id: videoFlashOptionsModel @@ -691,6 +715,24 @@ Item { timedShootFeedback.stop(); } } + function prepareShoot() { + shootFeedback.start(); + if (camera.captureMode == Camera.CaptureStillImage && shootFeedback.shouldFlash) { + // TODO this should be using 'camera.exposure.shutterSpeed' but currently it just returns -1. + // console.log(camera.exposure.shutterSpeed * 1000); + shootTimer.interval = 150; + } else { + shootTimer.interval = 0; + } + } + + Timer { + id:shootTimer + interval: 0 + repeat: false + running: false + onTriggered: controls.shoot(); + } function shoot() { var orientation = 0; @@ -740,9 +782,7 @@ Item { camera.videoRecorder.record(); } } else { - if (!main.contentExportMode) { - shootFeedback.start(); - } + camera.photoCaptureInProgress = true; camera.imageCapture.setMetadata("Orientation", orientation); camera.imageCapture.setMetadata("Date", new Date()); @@ -885,7 +925,8 @@ Item { if (settings.selfTimerDelay > 0) { controls.timedShoot(settings.selfTimerDelay); } else { - controls.shoot(); + controls.prepareShoot(); + shootTimer.start(); } } } diff --git a/ViewFinderView.qml b/ViewFinderView.qml index 8928538..c5d6282 100644 --- a/ViewFinderView.qml +++ b/ViewFinderView.qml @@ -387,13 +387,18 @@ FocusScope { Rectangle { id: shootFeedback anchors.fill: parent - color: "black" + property bool shouldFlash : ( !camera.advanced.hasFlash + && camera.position === Camera.FrontFace + && viewFinderOverlay.settings.screenFlash ) + color: shouldFlash ? "white" : "black" visible: opacity != 0.0 opacity: 0.0 function start() { - shootFeedback.opacity = 1.0; - shootFeedbackAnimation.restart(); + if (!main.contentExportMode) { + shootFeedback.opacity = 1.0; + shootFeedbackAnimation.restart(); + } } OpacityAnimator { @@ -401,9 +406,10 @@ FocusScope { target: shootFeedback from: 1.0 to: 0.0 - duration: UbuntuAnimation.SnapDuration + duration: UbuntuAnimation.BriskDuration easing: UbuntuAnimation.StandardEasing } + } } diff --git a/assets/screen_flash.svg b/assets/screen_flash.svg new file mode 100644 index 0000000..2ec8e5b --- /dev/null +++ b/assets/screen_flash.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/screen_flash_off.png b/assets/screen_flash_off.png new file mode 100644 index 0000000..2c7fbb0 Binary files /dev/null and b/assets/screen_flash_off.png differ diff --git a/assets/screen_flash_on.png b/assets/screen_flash_on.png new file mode 100644 index 0000000..637a635 Binary files /dev/null and b/assets/screen_flash_on.png differ