diff options
Diffstat (limited to 'examples/multimedia/declarative-camera/PhotoCaptureControls.qml')
-rw-r--r-- | examples/multimedia/declarative-camera/PhotoCaptureControls.qml | 200 |
1 files changed, 83 insertions, 117 deletions
diff --git a/examples/multimedia/declarative-camera/PhotoCaptureControls.qml b/examples/multimedia/declarative-camera/PhotoCaptureControls.qml index 0f2745665..f4ecee37b 100644 --- a/examples/multimedia/declarative-camera/PhotoCaptureControls.qml +++ b/examples/multimedia/declarative-camera/PhotoCaptureControls.qml @@ -1,52 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick import QtMultimedia @@ -71,19 +24,19 @@ FocusScope { GridLayout { id: buttonsColumn - anchors.margins: buttonsmargin + anchors.margins: captureControls.buttonsmargin flow: captureControls.state === "MobilePortrait" ? GridLayout.LeftToRight : GridLayout.TopToBottom CameraButton { text: "Capture" - implicitWidth: buttonsWidth - visible: captureSession.imageCapture.readyForCapture - onClicked: captureSession.imageCapture.captureToFile("") + implicitWidth: captureControls.buttonsWidth + visible: captureControls.captureSession.imageCapture.readyForCapture + onClicked: captureControls.captureSession.imageCapture.captureToFile("") } CameraPropertyButton { id : wbModesButton - implicitWidth: buttonsWidth + implicitWidth: captureControls.buttonsWidth state: captureControls.state value: Camera.WhiteBalanceAuto model: ListModel { @@ -117,12 +70,12 @@ FocusScope { } Item { - implicitWidth: buttonsWidth - height: 70 + implicitWidth: captureControls.buttonsWidth + implicitHeight: 70 CameraButton { text: "View" anchors.fill: parent - onClicked:state = captureControls.previewSelected() + onClicked: captureControls.previewSelected() visible: captureControls.previewAvailable } } @@ -130,25 +83,25 @@ FocusScope { GridLayout { id: bottomColumn - anchors.margins: buttonsmargin + anchors.margins: captureControls.buttonsmargin flow: captureControls.state === "MobilePortrait" ? GridLayout.LeftToRight : GridLayout.TopToBottom CameraListButton { - implicitWidth: buttonsWidth + implicitWidth: captureControls.buttonsWidth state: captureControls.state - onValueChanged: captureSession.camera.cameraDevice = value + onValueChanged: captureControls.captureSession.camera.cameraDevice = value } CameraButton { text: "Switch to Video" - implicitWidth: buttonsWidth + implicitWidth: captureControls.buttonsWidth onClicked: captureControls.videoModeSelected() } CameraButton { id: quitButton - implicitWidth: buttonsWidth + implicitWidth: captureControls.buttonsWidth text: "Quit" onClicked: Qt.quit() } @@ -156,107 +109,120 @@ FocusScope { } ZoomControl { + id: zoomControl x : 0 - y : captureControls.state === "MobilePortrait" ? -buttonPaneShadow.height : 0 + y : captureControls.state === "MobilePortrait" ? -buttonPaneShadow.height/2 : 0 width : 100 - height: parent.height + height: parent.height - (flashControl.visible * flashControl.height) - currentZoom: camera.zoomFactor - maximumZoom: camera.maximumZoomFactor - onZoomTo: camera.setDigitalZoom(value) + currentZoom: captureControls.captureSession.camera.zoomFactor + maximumZoom: captureControls.captureSession.camera.maximumZoomFactor + onZoomTo: (target) => captureControls.captureSession.camera.zoomFactor = target + } + + FlashControl { + id: flashControl + x : 10 + y : captureControls.state === "MobilePortrait" ? + parent.height - (buttonPaneShadow.height + height) : parent.height - height + + cameraDevice: captureControls.captureSession.camera } states: [ State { name: "MobilePortrait" PropertyChanges { - target: buttonPaneShadow - width: parent.width - height: captureControls.buttonsPanelPortraitHeight - } - PropertyChanges { - target: buttonsColumn - height: captureControls.buttonsPanelPortraitHeight / 2 - buttonsmargin - } - PropertyChanges { - target: bottomColumn - height: captureControls.buttonsPanelPortraitHeight / 2 - buttonsmargin + buttonPaneShadow.width: parent.width + buttonPaneShadow.height: captureControls.buttonsPanelPortraitHeight + buttonsColumn.height: captureControls.buttonsPanelPortraitHeight / 2 - buttonsmargin + bottomColumn.height: captureControls.buttonsPanelPortraitHeight / 2 - buttonsmargin } AnchorChanges { target: buttonPaneShadow - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.bottom: captureControls.bottom + anchors.left: captureControls.left + anchors.right: captureControls.right + // qmllint enable incompatible-type } AnchorChanges { target: buttonsColumn - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top + // qmllint disable incompatible-type + anchors.left: buttonPaneShadow.left + anchors.right: buttonPaneShadow.right + anchors.top: buttonPaneShadow.top + // qmllint enable incompatible-type } AnchorChanges { target: bottomColumn - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.bottom: buttonPaneShadow.bottom + anchors.left: buttonPaneShadow.left + anchors.right: buttonPaneShadow.right + // qmllint enable incompatible-type } }, State { name: "MobileLandscape" PropertyChanges { - target: buttonPaneShadow - width: buttonsPanelWidth - height: parent.height - } - PropertyChanges { - target: buttonsColumn - height: parent.height - width: buttonPaneShadow.width / 2 - } - PropertyChanges { - target: bottomColumn - height: parent.height - width: buttonPaneShadow.width / 2 + buttonPaneShadow.width: buttonsPanelWidth + buttonPaneShadow.height: parent.height + buttonsColumn.height: parent.height + buttonsColumn.width: buttonPaneShadow.width / 2 + bottomColumn.height: parent.height + bottomColumn.width: buttonPaneShadow.width / 2 } AnchorChanges { target: buttonPaneShadow - anchors.top: parent.top - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.top: captureControls.top + anchors.right: captureControls.right + // qmllint enable incompatible-type } AnchorChanges { target: buttonsColumn - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left + // qmllint disable incompatible-type + anchors.top: buttonPaneShadow.top + anchors.bottom: buttonPaneShadow.bottom + anchors.left: buttonPaneShadow.left + // qmllint enable incompatible-type } AnchorChanges { target: bottomColumn - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.top: buttonPaneShadow.top + anchors.bottom: buttonPaneShadow.bottom + anchors.right: buttonPaneShadow.right + // qmllint enable incompatible-type } }, State { name: "Other" PropertyChanges { - target: buttonPaneShadow - width: bottomColumn.width + 16 - height: parent.height + buttonPaneShadow.width: bottomColumn.width + 16 + buttonPaneShadow.height: parent.height } AnchorChanges { target: buttonPaneShadow - anchors.top: parent.top - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.top: captureControls.top + anchors.right: captureControls.right + // qmllint enable incompatible-type } AnchorChanges { target: buttonsColumn - anchors.top: parent.top - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.top: buttonPaneShadow.top + anchors.right: buttonPaneShadow.right + // qmllint enable incompatible-type } AnchorChanges { target: bottomColumn - anchors.bottom: parent.bottom - anchors.right: parent.right + // qmllint disable incompatible-type + anchors.bottom: buttonPaneShadow.bottom + anchors.right: buttonPaneShadow.right + // qmllint enable incompatible-type } } ] |