From ca01d5f9f5e960337a044be6e00de58fd4fbdb05 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 24 Jan 2014 13:22:02 +0100 Subject: Make basicsuite demos run stand-alone This change will make the demos run standalone when built in Qt Creator. - Rename example directories to lowercase/non-whitespace to avoid build & deployment problems - Add title.txt files so titles remain displayed correctly in the launcher - Add a common shared source files used for the standalone apps, and .pro-files for each example - Remove .qmlproject files (not needed) - Adjust documentation to match the new directory structure Change-Id: Ib24e461952da3b2c88aab0363249115ea44ee0f2 Reviewed-by: Eirik Aavitsland --- basicsuite/camera/CameraControlButton.qml | 94 +++++++++ basicsuite/camera/CameraSetting.qml | 68 +++++++ basicsuite/camera/CaptureControl.qml | 80 ++++++++ basicsuite/camera/CapturePreview.qml | 85 +++++++++ basicsuite/camera/Controls.qml | 199 +++++++++++++++++++ basicsuite/camera/FocusControl.qml | 151 +++++++++++++++ basicsuite/camera/Picker.qml | 129 +++++++++++++ basicsuite/camera/README | 2 + basicsuite/camera/RecordingTime.qml | 110 +++++++++++ basicsuite/camera/Slider.qml | 133 +++++++++++++ basicsuite/camera/ZoomControl.qml | 80 ++++++++ basicsuite/camera/app.pro | 12 ++ basicsuite/camera/camera.pro | 7 + basicsuite/camera/camerautils/camerautils.cpp | 229 ++++++++++++++++++++++ basicsuite/camera/camerautils/camerautils.h | 127 +++++++++++++ basicsuite/camera/camerautils/camerautils.pro | 19 ++ basicsuite/camera/camerautils/plugin.cpp | 60 ++++++ basicsuite/camera/camerautils/qmldir | 2 + basicsuite/camera/description.txt | 5 + basicsuite/camera/exclude.txt | 1 + basicsuite/camera/main.qml | 263 ++++++++++++++++++++++++++ basicsuite/camera/preview_l.jpg | Bin 0 -> 33458 bytes basicsuite/camera/title.txt | 1 + 23 files changed, 1857 insertions(+) create mode 100644 basicsuite/camera/CameraControlButton.qml create mode 100644 basicsuite/camera/CameraSetting.qml create mode 100644 basicsuite/camera/CaptureControl.qml create mode 100644 basicsuite/camera/CapturePreview.qml create mode 100644 basicsuite/camera/Controls.qml create mode 100644 basicsuite/camera/FocusControl.qml create mode 100644 basicsuite/camera/Picker.qml create mode 100644 basicsuite/camera/README create mode 100644 basicsuite/camera/RecordingTime.qml create mode 100644 basicsuite/camera/Slider.qml create mode 100644 basicsuite/camera/ZoomControl.qml create mode 100644 basicsuite/camera/app.pro create mode 100644 basicsuite/camera/camera.pro create mode 100644 basicsuite/camera/camerautils/camerautils.cpp create mode 100644 basicsuite/camera/camerautils/camerautils.h create mode 100644 basicsuite/camera/camerautils/camerautils.pro create mode 100644 basicsuite/camera/camerautils/plugin.cpp create mode 100644 basicsuite/camera/camerautils/qmldir create mode 100644 basicsuite/camera/description.txt create mode 100644 basicsuite/camera/exclude.txt create mode 100644 basicsuite/camera/main.qml create mode 100644 basicsuite/camera/preview_l.jpg create mode 100644 basicsuite/camera/title.txt (limited to 'basicsuite/camera') diff --git a/basicsuite/camera/CameraControlButton.qml b/basicsuite/camera/CameraControlButton.qml new file mode 100644 index 0000000..a740be7 --- /dev/null +++ b/basicsuite/camera/CameraControlButton.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +MouseArea { + id: buttonRoot + property alias title: titleTxt.text + property alias subtitle: valueTxt.text + property bool toggled: false + + width: 78 * root.contentScale + height: 78 * root.contentScale + opacity: pressed ? 0.3 : 1.0 + rotation: root.contentRotation + Behavior on rotation { NumberAnimation { } } + + Rectangle { + anchors.fill: parent + color: toggled ? "#8898c66c" : "#77333333" + radius: 5 * root.contentScale + } + + Column { + id: expModeControls + spacing: 2 * root.contentScale + anchors.centerIn: parent + + Text { + id: titleTxt + anchors.horizontalCenter: expModeControls.horizontalCenter + font.pixelSize: 22 * root.contentScale + font.letterSpacing: -1 + color: "white" + font.bold: true + } + + Text { + id: valueTxt + anchors.horizontalCenter: expModeControls.horizontalCenter + height: 22 * root.contentScale + verticalAlignment: Text.AlignVCenter + color: "white" + + Connections { + target: root + onContentScaleChanged: valueTxt.font.pixelSize = Math.round(18 * root.contentScale) + } + + onTextChanged: font.pixelSize = Math.round(18 * root.contentScale) + onPaintedWidthChanged: { + if (paintedWidth > buttonRoot.width - (8 * root.contentScale)) + font.pixelSize -= Math.round(2 * root.contentScale); + } + } + } +} diff --git a/basicsuite/camera/CameraSetting.qml b/basicsuite/camera/CameraSetting.qml new file mode 100644 index 0000000..0912c38 --- /dev/null +++ b/basicsuite/camera/CameraSetting.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +Item { + width: button.width + height: button.height + visible: enabled && picker.count > 1 + + property alias title: button.title + property alias selectedValue: picker.value + property alias currentIndex: picker.currentIndex + property alias model: picker.model + property alias count: picker.count + + CameraControlButton { + id: button + anchors.centerIn: parent + + subtitle: picker.name + toggled: picker.visible + + onClicked: picker.visible = true + } + + Picker { + id: picker + } + +} diff --git a/basicsuite/camera/CaptureControl.qml b/basicsuite/camera/CaptureControl.qml new file mode 100644 index 0000000..7d09151 --- /dev/null +++ b/basicsuite/camera/CaptureControl.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtMultimedia 5.0 + +Rectangle { + id: controlRoot + + signal clicked + + property bool videoMode: camera.captureMode === Camera.CaptureVideo + + width: 180 * root.contentScale + height: width + radius: width / 2 + color: mouser.pressed ? (controlRoot.videoMode ? "#77fa334f" : "#7798c66c") : "#77333333" + visible: enabled + + Rectangle { + id: center + anchors.centerIn: parent + width: parent.width * 0.45 + height: width + radius: width / 2 + opacity: mouser.pressed ? 0.7 : 1 + color: controlRoot.videoMode ? "#fa334f" : "#98c66c" + } + + Rectangle { + anchors.centerIn: parent + color: "white" + visible: camera.videoRecorder.recorderStatus === CameraRecorder.RecordingStatus + width: center.width * 0.3 + height: width + } + + MouseArea { + id: mouser + anchors.fill: parent + onClicked: controlRoot.clicked() + } +} diff --git a/basicsuite/camera/CapturePreview.qml b/basicsuite/camera/CapturePreview.qml new file mode 100644 index 0000000..64c5f79 --- /dev/null +++ b/basicsuite/camera/CapturePreview.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + id: root + anchors.fill: parent + color: "black" + opacity: 0 + enabled: opacity !== 0 + + property string previewSrc: "" + + onOpacityChanged: { + if (opacity === 1 && previewSrc !== "") { + previewImage.source = previewSrc; + previewSrc = ""; + } + } + + Behavior on opacity { NumberAnimation { duration: 100 } } + + function show() { + previewImage.source = ""; + opacity = 1; + } + + function setPreview(preview) { + if (root.opacity === 1) + previewImage.source = preview; + else + root.previewSrc = preview; + } + + Image { + id: previewImage + anchors.fill: parent + fillMode: Image.PreserveAspectFit + } + + MouseArea { + anchors.fill: parent + onClicked: { + root.opacity = 0; + } + } +} diff --git a/basicsuite/camera/Controls.qml b/basicsuite/camera/Controls.qml new file mode 100644 index 0000000..bd0db07 --- /dev/null +++ b/basicsuite/camera/Controls.qml @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtMultimedia 5.0 + +Item { + id: controlsRoot + anchors.fill: parent + +// property alias cameraMode: cameraModeControl.selectedValue + + property alias requestedZoom: zoomControl.requestedZoom + property alias actualZoom: zoomControl.actualZoom + property alias maximumZoom: zoomControl.maximumZoom + + property alias flashMode: flashControl.selectedValue + property alias focusMode: focusModeControl.selectedValue + property alias exposureMode: expModeControl.selectedValue + property alias exposureCompensation: expCompControl.selectedValue + property alias whiteBalanceMode: wbControl.selectedValue + property alias resolution: resControl.selectedValue + + property bool captureReady: false + + signal capture + signal searchAndLock + + FocusControl { + id: focusControl + anchors.fill: parent + onSearchAndLock: controlsRoot.searchAndLock() + enabled: camera.captureMode === Camera.CaptureStillImage + } + + ZoomControl { + id: zoomControl + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 50 + } + +// CameraSetting { +// id: cameraModeControl +// anchors.right: parent.right +// anchors.rightMargin: 20 +// anchors.bottom: parent.bottom +// anchors.bottomMargin: 20 +// title: "MODE" +// model: ListModel { +// ListElement { +// name: "Picture" +// value: Camera.CaptureStillImage +// } +// ListElement { +// name: "Video" +// value: Camera.CaptureVideo +// } +// } +// onCountChanged: currentIndex = 0 +// enabled: controlsRoot.captureReady +// } + + RecordingTime { + anchors.right: parent.right + anchors.rightMargin: 40 + anchors.bottom: parent.bottom + anchors.bottomMargin: 60 * root.contentScale + visible: camera.videoRecorder.recorderStatus === CameraRecorder.RecordingStatus + } + + Row { + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.top: parent.top + anchors.topMargin: 20 + height: 84 + spacing: 20 + + CameraSetting { + id: flashControl + title: "FLASH" + model: cameraUtils.supportedFlashModes + } + + CameraSetting { + id: focusModeControl + title: "FOCUS" + model: cameraUtils.supportedFocusModes + enabled: camera.captureMode === Camera.CaptureStillImage + } + + CameraSetting { + id: expModeControl + title: "SCENE" + model: cameraUtils.supportedSceneModes + } + + CameraSetting { + id: expCompControl + title: "EV" + model: ListModel { + ListElement { + name: "+2" + value: 2 + } + ListElement { + name: "+1" + value: 1 + } + ListElement { + name: "0" + value: 0 + } + ListElement { + name: "-1" + value: -1 + } + ListElement { + name: "-2" + value: -2 + } + } + } + + CameraSetting { + id: wbControl + title: "WB" + model: cameraUtils.supportedWhiteBalanceModes + } + + CameraSetting { + id: resControl + title: "SIZE" + model: cameraUtils.supportedCaptureResolutions +// onCountChanged: currentIndex = 1 + + Component.onCompleted: currentIndex = 1 + + Connections { + target: camera + onCaptureModeChanged: { + if (camera.captureMode === Camera.CaptureStillImage) { + resControl.model = cameraUtils.supportedCaptureResolutions; + } else { + resControl.model = cameraUtils.supportedVideoResolutions; + } + } + } + } + } + + CaptureControl { + id: captureControl + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: -30 + enabled: controlsRoot.captureReady || camera.videoRecorder.recorderStatus === CameraRecorder.RecordingStatus + + onClicked: controlsRoot.capture() + } +} diff --git a/basicsuite/camera/FocusControl.qml b/basicsuite/camera/FocusControl.qml new file mode 100644 index 0000000..5245cfe --- /dev/null +++ b/basicsuite/camera/FocusControl.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtMultimedia 5.0 + +MouseArea { + id: focusRoot + + signal searchAndLock + + onClicked: { + camera.focus.focusPointMode = Camera.FocusPointCustom + camera.focus.customFocusPoint = viewfinder.mapPointToSourceNormalized(Qt.point(mouse.x, mouse.y)) + focusRoot.searchAndLock() + } + + Item { + id: zones + anchors.fill: parent + + property color focusAreaColor + property real focusAreaScale: 1 + + Repeater { + model: camera.focus.focusZones + + Rectangle { + border { + width: Math.round(2 * root.contentScale) + color: zones.focusAreaColor + } + radius: 8 * root.contentScale + color: "transparent" + scale: zones.focusAreaScale + + // Map from the relative, normalized frame coordinates + property rect mappedRect: viewfinder.mapNormalizedRectToItem(area); + + Connections { + target: viewfinder + onContentRectChanged: { + mappedRect = viewfinder.mapNormalizedRectToItem(area); + } + } + + x: mappedRect.x - (width - mappedRect.width) / 2 + y: mappedRect.y - (height - mappedRect.height) / 2 + width: Math.round(120 * root.contentScale) + height: width + + Rectangle { + anchors.fill: parent + anchors.margins: -1.5 + color: "transparent" + border.width: 1 + border.color: "black" + radius: parent.radius + 2 + } + + Rectangle { + anchors.fill: parent + anchors.margins: 1 + parent.border.width / 2 + 0.5 + color: "transparent" + border.width: 1 + border.color: "black" + radius: parent.radius - 3 + } + } + } + + states: [ + State { + name: "unlocked"; when: camera.lockStatus === Camera.Unlocked + PropertyChanges { target: zones; opacity: 0; focusAreaColor: "red" } + }, + State { + name: "searching"; when: camera.lockStatus === Camera.Searching + PropertyChanges { target: zones; opacity: 1; focusAreaColor: "white" } + }, + State { + name: "locked"; when: camera.lockStatus === Camera.Locked + PropertyChanges { target: zones; opacity: 0; focusAreaColor: "green" } + } + ] + + transitions: [ + Transition { + to: "searching" + NumberAnimation { properties: "opacity"; duration: 60 } + SequentialAnimation { + NumberAnimation { + target: zones; property: "focusAreaScale"; from: 1; to: 1.3; duration: 150 + } + PauseAnimation { duration: 20 } + NumberAnimation { + target: zones; property: "focusAreaScale"; easing.period: 1; easing.amplitude: 1.4 + easing.type: Easing.OutElastic; from: 1.3; to: 1 + duration: 450 + } + } + }, + Transition { + from: "searching" + SequentialAnimation { + PauseAnimation { duration: 1500 } + NumberAnimation { properties: "opacity"; duration: 60 } + } + } + + ] + } + +} diff --git a/basicsuite/camera/Picker.qml b/basicsuite/camera/Picker.qml new file mode 100644 index 0000000..9cbf27f --- /dev/null +++ b/basicsuite/camera/Picker.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +MouseArea { + id: pickerRoot + + parent: root + anchors.fill: parent + + onClicked: visible = false + visible: false + + property alias contentWidth: back.width + property real contentHeight: 350 * root.contentScale + property alias model: list.model + property variant value: null + property string name: "" + property alias currentIndex: list.currentIndex + property alias count: list.count + + onValueChanged: { + for (var i = 0; i < list.count; ++i) { + var data = list.model[i]; + if (data === undefined) + data = list.model.get(i); + if (data.value === pickerRoot.value) { + list.currentIndex = i; + return; + } + } + list.currentIndex = -1; + } + + Rectangle { + id: back + color: "#77333333" + width: 200 * root.contentScale + height: Math.min(pickerRoot.contentHeight, list.contentHeight + list.anchors.margins * 2) + anchors.centerIn: parent + property int itemHeight: 25 * root.contentScale + rotation: root.contentRotation + Behavior on rotation { NumberAnimation { } } + + ListView { + id: list + anchors.fill: parent + clip: true + anchors.margins: 14 * root.contentScale + + currentIndex: -1 + + onCurrentIndexChanged: { + if (list.currentIndex >= 0) { + var data = list.model[list.currentIndex]; + if (data === undefined) + data = list.model.get(list.currentIndex); + pickerRoot.value = data.value; + pickerRoot.name = data.name; + } else { + pickerRoot.value = null + pickerRoot.name = "" + } + } + + delegate: Item { + height: 40 * root.contentScale + width: parent.width + Rectangle { + anchors.fill: parent + border.color: index == list.currentIndex ? "#44ffffff" : "transparent" + color: index == list.currentIndex ? "#22ffffff" : "transparent" + radius: 3 * root.contentScale + Text { + color: "white" + text: (typeof modelData === 'undefined' ? name : modelData.name) + anchors.centerIn: parent + font.pixelSize: Math.round(20 * root.contentScale) + } + MouseArea { + anchors.fill: parent + onClicked: { + list.currentIndex = index; + } + } + } + } + } + } +} + diff --git a/basicsuite/camera/README b/basicsuite/camera/README new file mode 100644 index 0000000..e249fae --- /dev/null +++ b/basicsuite/camera/README @@ -0,0 +1,2 @@ +You need to compile and intall the included qml plugin for this demo to work. + diff --git a/basicsuite/camera/RecordingTime.qml b/basicsuite/camera/RecordingTime.qml new file mode 100644 index 0000000..2156b74 --- /dev/null +++ b/basicsuite/camera/RecordingTime.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + id: recRoot + width: row.width + 14 * root.contentScale + height: circle.height + 14 * root.contentScale + color: "#77333333" + radius: 5 * root.contentScale + rotation: root.contentRotation + Behavior on rotation { NumberAnimation { } } + + Row { + id: row + anchors.centerIn: parent + spacing: 10 * root.contentScale + + Item { + anchors.verticalCenter: timeText.verticalCenter + width: 18 * root.contentScale + height: width + + Rectangle { + id: circle + width: parent.width + height: parent.height + radius: width / 2 + color: "#fa334f" + + SequentialAnimation { + loops: Animation.Infinite + running: recRoot.visible + PropertyAction { target: circle; property: "visible"; value: true } + PauseAnimation { duration: 1000 } + PropertyAction { target: circle; property: "visible"; value: false } + PauseAnimation { duration: 1000 } + } + } + } + + Text { + id: timeText + color: "white" + font.pixelSize: 24 * root.contentScale + text: formatTime(camera.videoRecorder.duration) + } + } + + function formatTime(time) { + time = time / 1000 + var hours = Math.floor(time / 3600); + time = time - hours * 3600; + var minutes = Math.floor(time / 60); + var seconds = Math.floor(time - minutes * 60); + + if (hours > 0) + return formatTimeBlock(hours) + ":" + formatTimeBlock(minutes) + ":" + formatTimeBlock(seconds); + else + return formatTimeBlock(minutes) + ":" + formatTimeBlock(seconds); + + } + + function formatTimeBlock(time) { + if (time === 0) + return "00" + if (time < 10) + return "0" + time; + else + return time.toString(); + } +} diff --git a/basicsuite/camera/Slider.qml b/basicsuite/camera/Slider.qml new file mode 100644 index 0000000..a9d3c10 --- /dev/null +++ b/basicsuite/camera/Slider.qml @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +Item { + id: slider + + height: handleBack.height + // value is read/write. + property real value: 0 + property real maximum: 1 + property real minimum: 0 + property int xMax: width - handle.width + onXMaxChanged: updatePos() + onMinimumChanged: updatePos() + onValueChanged: if (!pressed) updatePos() + property bool mutable: true + property alias pressed : backgroundMouse.pressed + + signal valueChangedByHandle(int newValue) + + function updatePos() { + if (maximum > minimum) { + var pos = 0 + (value - minimum) * slider.xMax / (maximum - minimum); + pos = Math.min(pos, width - handle.width - 0); + pos = Math.max(pos, 0); + handle.x = pos; + } else { + handle.x = 0; + } + } + + Rectangle { + id: background + width: slider.width + anchors.verticalCenter: slider.verticalCenter + height: 4 * root.contentScale + color: "#666666" + + MouseArea { + id: backgroundMouse + anchors.fill: parent + anchors.topMargin: -24 * root.contentScale + anchors.bottomMargin: -24 * root.contentScale + enabled: slider.mutable + drag.target: handle + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: slider.xMax + onPressedChanged: { + value = Math.max(minimum, Math.min(maximum, (maximum - minimum) * (mouseX - handle.width/2) / slider.xMax + minimum)); + valueChangedByHandle(value); + updatePos(); + } + onPositionChanged: { + value = Math.max(minimum, Math.min(maximum, (maximum - minimum) * (mouseX - handle.width/2) / slider.xMax + minimum)); + valueChangedByHandle(value); + } + } + } + + Rectangle { + id: progress + height: 8 * root.contentScale + anchors.verticalCenter: background.verticalCenter + anchors.left: background.left + anchors.right: handle.right + anchors.rightMargin: handle.width / 2 + visible: slider.enabled + color: "#98c66c" + } + + Rectangle { + id: handleBack + width: 40 * root.contentScale + height: width + radius: width / 2 + color: "#8898c66c" + antialiasing: true + anchors.centerIn: handle + visible: handle.visible + } + + Rectangle { + id: handle + width: 14 * root.contentScale + height: width + radius: width / 2 + antialiasing: true + color: "#98c66c" + anchors.verticalCenter: background.verticalCenter + visible: slider.enabled + } +} + diff --git a/basicsuite/camera/ZoomControl.qml b/basicsuite/camera/ZoomControl.qml new file mode 100644 index 0000000..15f2875 --- /dev/null +++ b/basicsuite/camera/ZoomControl.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 + +Column { + width: 400 * root.contentScale + spacing: 20 * root.contentScale + visible: maximumZoom > 1 + + property alias maximumZoom: zoomSlider.maximum + property alias requestedZoom: zoomSlider.value + property real actualZoom: 1 + + Rectangle { + anchors.horizontalCenter: zoomSlider.horizontalCenter + width: zoomText.width + 10 * root.contentScale + height: zoomText.height + 10 * root.contentScale + color: "#77333333" + radius: 5 * root.contentScale + rotation: root.contentRotation + Behavior on rotation { NumberAnimation { } } + + Text { + id: zoomText + anchors.centerIn: parent + font.pixelSize: Math.round(24 * root.contentScale) + color: "white" + font.bold: true + text: (Math.round(actualZoom * 100) / 100) + "x" + } + } + + Slider { + id: zoomSlider + width: parent.width + rotation: root.contentRotation === -90 ? 180 : (root.contentRotation === 90 ? 0 : root.contentRotation) + + minimum: 1 + maximum: 1 + value: 1 + } +} diff --git a/basicsuite/camera/app.pro b/basicsuite/camera/app.pro new file mode 100644 index 0000000..70633a5 --- /dev/null +++ b/basicsuite/camera/app.pro @@ -0,0 +1,12 @@ +TARGET = camera + +include(../shared/shared.pri) + +content.files = \ + *.qml \ + *.png +content.path = $$DESTPATH + +OTHER_FILES += $${content.files} + +INSTALLS += target content diff --git a/basicsuite/camera/camera.pro b/basicsuite/camera/camera.pro new file mode 100644 index 0000000..7d9c9f1 --- /dev/null +++ b/basicsuite/camera/camera.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs +CONFIG += ordered + +SUBDIRS += \ + camerautils \ + app.pro + diff --git a/basicsuite/camera/camerautils/camerautils.cpp b/basicsuite/camera/camerautils/camerautils.cpp new file mode 100644 index 0000000..f6b6672 --- /dev/null +++ b/basicsuite/camera/camerautils/camerautils.cpp @@ -0,0 +1,229 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +#include "camerautils.h" + +#include +#include +#include +#include +#include +#include + +static QList g_commonResolutions; +static QList g_commonVideoResolutions; +static QList g_whiteBalanceModes; +static QList g_sceneModes; +static QList g_flashModes; +static QList g_focusModes; + +QDebug operator<<(QDebug dbg, const CameraSettingsValue &r) { + dbg.nospace() << "CameraSettingsValue(" << r.name() << ", " << r.value() << ')'; + return dbg.space(); +} + +CameraUtils::CameraUtils(QObject *parent) + : QObject(parent) + , m_camera(0) +{ + if (g_commonResolutions.isEmpty()) { + g_commonResolutions << new CameraSettingsValue(QStringLiteral("QVGA"), QSize(320, 240)) + << new CameraSettingsValue(QStringLiteral("0.3M"), QSize(640, 480)) + << new CameraSettingsValue(QStringLiteral("0.8M"), QSize(1024, 768)) + << new CameraSettingsValue(QStringLiteral("1.2M"), QSize(1280, 960)) + << new CameraSettingsValue(QStringLiteral("2M"), QSize(1600, 1200)) + << new CameraSettingsValue(QStringLiteral("5M"), QSize(2560, 1920)) + << new CameraSettingsValue(QStringLiteral("8M"), QSize(3264, 2448)); + + g_commonVideoResolutions << new CameraSettingsValue(QStringLiteral("1080p (16:9)"), QSize(1920, 1080)) + << new CameraSettingsValue(QStringLiteral("1080p (16:9)"), QSize(1920, 1088)) + << new CameraSettingsValue(QStringLiteral("1080p (4:3)"), QSize(1440, 1080)) + << new CameraSettingsValue(QStringLiteral("1080p (4:3)"), QSize(1440, 1088)) + << new CameraSettingsValue(QStringLiteral("720p (16:9)"), QSize(1280, 720)) + << new CameraSettingsValue(QStringLiteral("720p (4:3)"), QSize(960, 720)) + << new CameraSettingsValue(QStringLiteral("480p (16:9)"), QSize(720, 480)) + << new CameraSettingsValue(QStringLiteral("480p (4:3)"), QSize(640, 480)) + << new CameraSettingsValue(QStringLiteral("QVGA"), QSize(320, 240)); + + g_whiteBalanceModes << new CameraSettingsValue(QStringLiteral("Auto"), QCameraImageProcessing::WhiteBalanceAuto) + << new CameraSettingsValue(QStringLiteral("Manual"), QCameraImageProcessing::WhiteBalanceManual) + << new CameraSettingsValue(QStringLiteral("Sunlight"), QCameraImageProcessing::WhiteBalanceSunlight) + << new CameraSettingsValue(QStringLiteral("Cloudy"), QCameraImageProcessing::WhiteBalanceCloudy) + << new CameraSettingsValue(QStringLiteral("Shade"), QCameraImageProcessing::WhiteBalanceShade) + << new CameraSettingsValue(QStringLiteral("Tungsten"), QCameraImageProcessing::WhiteBalanceTungsten) + << new CameraSettingsValue(QStringLiteral("Fluorescent"), QCameraImageProcessing::WhiteBalanceFluorescent) + << new CameraSettingsValue(QStringLiteral("Flash"), QCameraImageProcessing::WhiteBalanceFlash) + << new CameraSettingsValue(QStringLiteral("Sunset"), QCameraImageProcessing::WhiteBalanceSunset); + + g_sceneModes << new CameraSettingsValue(QStringLiteral("Auto"), QCameraExposure::ExposureAuto) + << new CameraSettingsValue(QStringLiteral("Manual"), QCameraExposure::ExposureManual) + << new CameraSettingsValue(QStringLiteral("Portrait"), QCameraExposure::ExposurePortrait) + << new CameraSettingsValue(QStringLiteral("Night"), QCameraExposure::ExposureNight) + << new CameraSettingsValue(QStringLiteral("Backlight"), QCameraExposure::ExposureBacklight) + << new CameraSettingsValue(QStringLiteral("Spotlight"), QCameraExposure::ExposureSpotlight) + << new CameraSettingsValue(QStringLiteral("Sports"), QCameraExposure::ExposureSports) + << new CameraSettingsValue(QStringLiteral("Snow"), QCameraExposure::ExposureSnow) + << new CameraSettingsValue(QStringLiteral("Beach"), QCameraExposure::ExposureBeach) + << new CameraSettingsValue(QStringLiteral("Large Aperture"), QCameraExposure::ExposureLargeAperture) + << new CameraSettingsValue(QStringLiteral("Small Aperture"), QCameraExposure::ExposureSmallAperture); + + g_flashModes << new CameraSettingsValue(QStringLiteral("Auto"), QCameraExposure::FlashAuto) + << new CameraSettingsValue(QStringLiteral("Off"), QCameraExposure::FlashOff) + << new CameraSettingsValue(QStringLiteral("On"), QCameraExposure::FlashOn) + << new CameraSettingsValue(QStringLiteral("Red-Eye"), QCameraExposure::FlashRedEyeReduction) + << new CameraSettingsValue(QStringLiteral("Torch"), QCameraExposure::FlashVideoLight); + + g_focusModes << new CameraSettingsValue(QStringLiteral("Auto"), QCameraFocus::AutoFocus) + << new CameraSettingsValue(QStringLiteral("Continuous"), QCameraFocus::ContinuousFocus) + << new CameraSettingsValue(QStringLiteral("Hyperfocal"), QCameraFocus::HyperfocalFocus) + << new CameraSettingsValue(QStringLiteral("Infinity"), QCameraFocus::InfinityFocus) + << new CameraSettingsValue(QStringLiteral("Macro"), QCameraFocus::MacroFocus) + << new CameraSettingsValue(QStringLiteral("Off"), QCameraFocus::ManualFocus); + } + +} + +CameraUtils::~CameraUtils() +{ +} + +void CameraUtils::init() +{ + m_camera = new QCamera; + connect(m_camera, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(onCameraStatusChanged())); + connect(m_camera, SIGNAL(error(QCamera::Error)), this, SLOT(onError())); + m_camera->load(); +} + +void CameraUtils::setCamera(QObject *obj) +{ + QObject *mediaObject = qvariant_cast(obj->property("mediaObject")); + if (!mediaObject) + return; + + m_camera = qobject_cast(mediaObject); + if (!m_camera) + return; + + if (m_camera->status() >= QCamera::LoadedStatus) + onCameraStatusChanged(); + else + connect(m_camera, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(onCameraStatusChanged())); +} + +void CameraUtils::onError() +{ + if (m_camera && m_camera->status() == QCamera::UnavailableStatus) { + delete m_camera; + m_camera = 0; + + emit done(); + } +} + +void CameraUtils::onCameraStatusChanged() +{ + if (!m_camera || m_camera->status() < QCamera::LoadedStatus) + return; + + disconnect(m_camera, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(onCameraStatusChanged())); + + QCameraImageCapture *imageCapture = new QCameraImageCapture(m_camera); + QCameraImageProcessing *imageProc = m_camera->imageProcessing(); + QCameraExposure *exposure = m_camera->exposure(); + QCameraFocus *focus = m_camera->focus(); + QMediaRecorder rec(m_camera); + + // Supported image resolutions + QList resolutions = imageCapture->supportedResolutions(); + for (int i = resolutions.size() - 1; i >= 0; --i) { + QSize reso = resolutions.at(i); + int mp = reso.width() * reso.height(); + CameraSettingsValue *r = new CameraSettingsValue(QString::number(mp / double(1000000), 'f', 1) + QLatin1String("M"), reso); + m_supportedResolutions.append(r); + } + + // Supported video resolutions + QList suppRes = rec.supportedResolutions(); + for (int i = 0; i < g_commonVideoResolutions.size(); ++i) { + CameraSettingsValue *r = g_commonVideoResolutions.at(i); + if (suppRes.contains(r->value().toSize())) + m_supportedVideoResolutions.append(r); + } + + + // Supported white balance modes + for (int i = 0; i < g_whiteBalanceModes.size(); ++i) { + CameraSettingsValue *m = g_whiteBalanceModes.at(i); + if (imageProc->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode(m->value().toInt()))) + m_supportedWhiteBalanceModes.append(m); + } + + // Supported scene modes + for (int i = 0; i < g_sceneModes.size(); ++i) { + CameraSettingsValue *sm = g_sceneModes.at(i); + if (exposure->isExposureModeSupported(QCameraExposure::ExposureMode(sm->value().toInt()))) + m_supportedSceneModes.append(sm); + } + + // Supported flash modes + for (int i = 0; i < g_flashModes.size(); ++i) { + CameraSettingsValue *sm = g_flashModes.at(i); + if (exposure->isFlashModeSupported(QCameraExposure::FlashModes(sm->value().toInt()))) + m_supportedFlashModes.append(sm); + } + + // Supported focus modes + for (int i = 0; i < g_focusModes.size(); ++i) { + CameraSettingsValue *sm = g_focusModes.at(i); + if (focus->isFocusModeSupported(QCameraFocus::FocusModes(sm->value().toInt()))) + m_supportedFocusModes.append(sm); + } + + delete imageCapture; + + emit supportedCaptureResolutionsChanged(); + emit supportedVideoResolutionsChanged(); + emit supportedWhiteBalanceModesChanged(); + emit supportedSceneModesChanged(); + emit supportedFlashModesChanged(); +} + + diff --git a/basicsuite/camera/camerautils/camerautils.h b/basicsuite/camera/camerautils/camerautils.h new file mode 100644 index 0000000..1f61c7c --- /dev/null +++ b/basicsuite/camera/camerautils/camerautils.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +#ifndef CAMERAUTILS_H +#define CAMERAUTILS_H + +#include +#include + +class QCamera; + +class CameraSettingsValue : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) + +public: + CameraSettingsValue(const QString &n, const QVariant &v) + : QObject() + , m_name(n) + , m_value(v) + { } + + QString name() const { return m_name; } + void setName(const QString &n) { m_name = n; emit nameChanged(); } + + QVariant value() const { return m_value; } + void setValue(const QVariant &v) { m_value = v; emit valueChanged(); } + +Q_SIGNALS: + void nameChanged(); + void valueChanged(); + +private: + QString m_name; + QVariant m_value; +}; + +QDebug operator<<(QDebug, const CameraSettingsValue &); + +class CameraUtils : public QObject +{ + Q_OBJECT + Q_PROPERTY(QList supportedCaptureResolutions READ supportedCaptureResolutions NOTIFY supportedCaptureResolutionsChanged) + Q_PROPERTY(QList supportedWhiteBalanceModes READ supportedWhiteBalanceModes NOTIFY supportedWhiteBalanceModesChanged) + Q_PROPERTY(QList supportedSceneModes READ supportedSceneModes NOTIFY supportedSceneModesChanged) + Q_PROPERTY(QList supportedFlashModes READ supportedFlashModes NOTIFY supportedFlashModesChanged) + Q_PROPERTY(QList supportedFocusModes READ supportedFocusModes NOTIFY supportedFocusModesChanged) + Q_PROPERTY(QList supportedVideoResolutions READ supportedVideoResolutions NOTIFY supportedVideoResolutionsChanged) +public: + explicit CameraUtils(QObject *parent = 0); + ~CameraUtils(); + + Q_INVOKABLE void init(); + Q_INVOKABLE void setCamera(QObject *cam); + + QList supportedCaptureResolutions() const { return m_supportedResolutions; } + QList supportedVideoResolutions() const { return m_supportedVideoResolutions; } + QList supportedWhiteBalanceModes() const { return m_supportedWhiteBalanceModes; } + QList supportedSceneModes() const { return m_supportedSceneModes; } + QList supportedFlashModes() const { return m_supportedFlashModes; } + QList supportedFocusModes() const { return m_supportedFocusModes; } + +Q_SIGNALS: + void supportedCaptureResolutionsChanged(); + void supportedWhiteBalanceModesChanged(); + void supportedSceneModesChanged(); + void supportedFlashModesChanged(); + void supportedFocusModesChanged(); + void supportedVideoResolutionsChanged(); + + void done(); + +private Q_SLOTS: + void onCameraStatusChanged(); + void onError(); + +private: + QCamera *m_camera; + + QList m_supportedResolutions; + QList m_supportedVideoResolutions; + QList m_supportedWhiteBalanceModes; + QList m_supportedSceneModes; + QList m_supportedFlashModes; + QList m_supportedFocusModes; +}; + +#endif // CAMERAUTILS_H diff --git a/basicsuite/camera/camerautils/camerautils.pro b/basicsuite/camera/camerautils/camerautils.pro new file mode 100644 index 0000000..938a0a9 --- /dev/null +++ b/basicsuite/camera/camerautils/camerautils.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib +CONFIG += plugin +QT += qml multimedia + +TARGET = camerautilsplugin + +SOURCES += plugin.cpp \ + camerautils.cpp + +HEADERS += camerautils.h + +pluginfiles.files += \ + qmldir \ + +target.path += $$[QT_INSTALL_QML]/CameraUtils +pluginfiles.path += $$[QT_INSTALL_QML]/CameraUtils + +INSTALLS += target pluginfiles + diff --git a/basicsuite/camera/camerautils/plugin.cpp b/basicsuite/camera/camerautils/plugin.cpp new file mode 100644 index 0000000..2a8c3ea --- /dev/null +++ b/basicsuite/camera/camerautils/plugin.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ + +#include +#include +#include + +#include "camerautils.h" + +class QExampleQmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri) + { + qmlRegisterType(uri, 1, 0, "CameraUtils"); + } +}; + + +#include "plugin.moc" diff --git a/basicsuite/camera/camerautils/qmldir b/basicsuite/camera/camerautils/qmldir new file mode 100644 index 0000000..a5ab412 --- /dev/null +++ b/basicsuite/camera/camerautils/qmldir @@ -0,0 +1,2 @@ +module CameraUtils +plugin camerautilsplugin diff --git a/basicsuite/camera/description.txt b/basicsuite/camera/description.txt new file mode 100644 index 0000000..71c3c44 --- /dev/null +++ b/basicsuite/camera/description.txt @@ -0,0 +1,5 @@ +This example demonstrates the use of the camera features of Qt Multimedia with Qt Quick. + +Demo can be used to take pictures. Files are saved inside the /data/images/ folder and can be viewed with the "Photo Gallery" application. + +Camera parameters such as flash mode, scene mode or white balance can be changed. The availability of parameters depends on what the camera driver provides. diff --git a/basicsuite/camera/exclude.txt b/basicsuite/camera/exclude.txt new file mode 100644 index 0000000..5716448 --- /dev/null +++ b/basicsuite/camera/exclude.txt @@ -0,0 +1 @@ +android-beagleboard:linux-iMX6:linux-raspberrypi: diff --git a/basicsuite/camera/main.qml b/basicsuite/camera/main.qml new file mode 100644 index 0000000..b7437de --- /dev/null +++ b/basicsuite/camera/main.qml @@ -0,0 +1,263 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtMultimedia 5.0 +//import QtSensors 5.0 +import CameraUtils 1.0 + +Rectangle { + id: root + color: "black" + + property real contentScale: root.width / 1280 + property int contentRotation: 0 + + Text { + anchors.centerIn: parent + color: "white" + font.pixelSize: 30 + text: "Camera service is not available..." + visible: camera.cameraStatus === Camera.UnavailableStatus + } + + CameraUtils { + id: cameraUtils + } + + Camera { + id: camera + property bool updateFocusPointMode: true + property bool captureWhenLocked: false + + Component.onCompleted: cameraUtils.setCamera(camera) + + digitalZoom: controls.requestedZoom + captureMode: Camera.CaptureStillImage + + onCaptureModeChanged: { + if (camera.captureMode === Camera.CaptureVideo) { + controls.focusMode = Camera.FocusContinuous; + camera.unlock(); + } else { + controls.focusMode = Camera.FocusAuto; + } + } + + onLockStatusChanged: { + if (camera.lockStatus === Camera.Locked && captureWhenLocked) { + camera.imageCapture.captureToLocation("/data/images/"); + captureWhenLocked = false; + } + } + + focus { + onFocusModeChanged: { + camera.unlock(); + if (camera.updateFocusPointMode) + camera.focus.focusPointMode = Camera.FocusPointAuto + } + onCustomFocusPointChanged: { + if (camera.focus.focusPointMode === Camera.FocusPointCustom + && camera.focus.focusMode !== Camera.FocusAuto + && camera.focus.focusMode !== Camera.FocusMacro) { + camera.updateFocusPointMode = false; + camera.focus.focusMode = Camera.FocusAuto + controls.focusMode = Camera.FocusAuto + camera.updateFocusPointMode = true; + } + } + } + + onCameraStatusChanged: { + if (cameraStatus === Camera.ActiveStatus) { + controls.exposureMode = camera.exposure.exposureMode + controls.exposureCompensation = camera.exposure.exposureCompensation + controls.whiteBalanceMode = camera.imageProcessing.whiteBalanceMode + controls.flashMode = Camera.FlashAuto + if (camera.captureMode === Camera.CaptureStillImage) + controls.focusMode = camera.focus.focusMode + else + camera.focus.focusMode = Camera.FocusContinuous + } + } + + imageCapture { + onImageExposed: capturePreview.show() + onImageCaptured: { + camera.unlock(); + capturePreview.setPreview(preview); + } + onCaptureFailed: print(requestId + " " + message) + } + + videoRecorder { + // mediaContainer: "mp4" + // audioCodec: "aac" + // audioSampleRate: 48000 + // audioBitRate: 192000 + // audioChannels: 2 + // videoCodec: "h264" + // resolution: Qt.size(960, 720) + onResolutionChanged: { + if (camera.videoRecorder.resolution == Qt.size(1920, 1080)) + camera.videoRecorder.videoBitRate = 20000000; + else if (camera.videoRecorderresolution == Qt.size(1280, 720)) + camera.videoRecorder.videoBitRate = 10000000; + else + camera.videoRecorder.videoBitRate = 5000000; + } + } + + } + + VideoOutput { + id: viewfinder + source: camera + anchors.fill: parent + fillMode: VideoOutput.PreserveAspectFit + } + + // OrientationSensor { + // active: true + // onReadingChanged: { + // if (reading.orientation === OrientationReading.TopUp) + // root.contentRotation = -90; + // else if (reading.orientation === OrientationReading.RightUp) + // root.contentRotation = 0; + // else if (reading.orientation === OrientationReading.LeftUp) + // root.contentRotation = 180; + // else if (reading.orientation === OrientationReading.TopDown) + // root.contentRotation = 90; + // } + // } + + // RotationSensor { + // active: (camera.cameraStatus === Camera.ActiveStatus) + // dataRate: 20 + // property real lastxvalue: 0 + // property real lastyvalue: 0 + // property real lastzvalue: 0 + + // onActiveChanged: { + // lastxvalue = 0 + // lastyvalue = 0 + // lastzvalue = 0 + // } + + // onReadingChanged: { + // if (lastxvalue != 0 && camera.focus.focusMode === Camera.FocusContinuous && camera.lockStatus === Camera.Locked && camera.imageCapture.ready) { + // if (Math.abs(reading.x - lastxvalue) > 3 || Math.abs(reading.y - lastyvalue) > 3 || Math.abs(reading.z - lastzvalue) > 3) + // camera.unlock(); + // } + // lastxvalue = reading.x; + // lastyvalue = reading.y; + // lastzvalue = reading.z; + // } + // } + + Controls { + id: controls + visible: camera.cameraStatus === Camera.ActiveStatus + + actualZoom: camera.digitalZoom + maximumZoom: camera.maximumDigitalZoom + + //onCameraModeChanged: camera.captureMode = controls.cameraMode + + onFlashModeChanged: if (visible) camera.flash.mode = controls.flashMode + onFocusModeChanged: if (visible) camera.focus.focusMode = controls.focusMode + onExposureModeChanged: if (visible) camera.exposure.exposureMode = controls.exposureMode + onExposureCompensationChanged: if (visible) camera.exposure.exposureCompensation = controls.exposureCompensation + onWhiteBalanceModeChanged: if (visible) camera.imageProcessing.whiteBalanceMode = controls.whiteBalanceMode + onResolutionChanged: { + if (controls.resolution != null) { + if (camera.captureMode === Camera.CaptureStillImage) + camera.imageCapture.resolution = controls.resolution; + else + camera.videoRecorder.resolution = controls.resolution; + } + } + + onSearchAndLock: { + camera.searchAndLock(); + } + + captureReady: camera.imageCapture.ready + onCapture: { + if (camera.captureMode === Camera.CaptureVideo) { + if (camera.videoRecorder.recorderState === CameraRecorder.RecordingState) { + camera.videoRecorder.stop(); + } else { + camera.videoRecorder.record(); + } + } else { + if ((camera.focus.focusMode === Camera.FocusAuto || camera.focus.focusMode === Camera.FocusMacro) + && camera.focus.focusPointMode === Camera.FocusPointAuto + && camera.lockStatus === Camera.Unlocked) { + camera.captureWhenLocked = true; + camera.searchAndLock(); + } else { + camera.imageCapture.captureToLocation("/data/images/"); + } + } + } + } + + // CameraControlButton { + // anchors.left: parent.left + // anchors.leftMargin: 30 + // anchors.bottom: parent.bottom + // anchors.bottomMargin: 20 + // title: camera.cameraStatus === Camera.ActiveStatus ? "Stop" : "Start" + + // onClicked: { + // if (camera.cameraStatus === Camera.ActiveStatus) + // camera.cameraState = Camera.UnloadedState + // else + // camera.start(); + // } + // } + + CapturePreview { + id: capturePreview + } + +} diff --git a/basicsuite/camera/preview_l.jpg b/basicsuite/camera/preview_l.jpg new file mode 100644 index 0000000..3f15310 Binary files /dev/null and b/basicsuite/camera/preview_l.jpg differ diff --git a/basicsuite/camera/title.txt b/basicsuite/camera/title.txt new file mode 100644 index 0000000..10a226d --- /dev/null +++ b/basicsuite/camera/title.txt @@ -0,0 +1 @@ +Camera -- cgit v1.2.3 From b2957ef0efbf55872d36762705b62822cc828cf3 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 29 Jan 2014 11:20:03 +0100 Subject: Enable virtual keyboard when building demos stand-alone Add a shared QML file that defines an InputPanel and loads the main QML for each demo. Also, - Do not define QT_IM_MODULE (set already in the system) - Improved exclude file parsing to match b2qt-launcher Change-Id: Ibdd0371a57878ef7bc585aa67fcd148377f54bc6 Reviewed-by: Eirik Aavitsland --- basicsuite/camera/app.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'basicsuite/camera') diff --git a/basicsuite/camera/app.pro b/basicsuite/camera/app.pro index 70633a5..b588a0d 100644 --- a/basicsuite/camera/app.pro +++ b/basicsuite/camera/app.pro @@ -1,6 +1,7 @@ TARGET = camera include(../shared/shared.pri) +b2qtdemo_deploy_defaults() content.files = \ *.qml \ -- cgit v1.2.3 From f21ed3e486d813ff56571330e5ccfae2421a420f Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 12 Feb 2014 11:32:22 +0100 Subject: Limit camera & mediaplayer demos to working devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I81d3f3a7e142eb0f5f0fef251de7daa9a3f7a7a9 Reviewed-by: Topi Reiniƶ --- basicsuite/camera/exclude.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'basicsuite/camera') diff --git a/basicsuite/camera/exclude.txt b/basicsuite/camera/exclude.txt index 5716448..b481e58 100644 --- a/basicsuite/camera/exclude.txt +++ b/basicsuite/camera/exclude.txt @@ -1 +1,8 @@ -android-beagleboard:linux-iMX6:linux-raspberrypi: +android-beaglebone +android-iMX6 +android-emulator +linux-beagleboard +linux-beaglebone +linux-iMX6 +linux-raspberrypi +linux-emulator -- cgit v1.2.3 From 9fc7566c002dfd378f3dd0b94b349319e27959c0 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 12 Feb 2014 13:44:10 +0100 Subject: Update copyright year MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I55381dedffc4d86bc25b0c3f6ef18230d70272ee Reviewed-by: Topi Reiniƶ --- basicsuite/camera/CameraControlButton.qml | 2 +- basicsuite/camera/CameraSetting.qml | 2 +- basicsuite/camera/CaptureControl.qml | 2 +- basicsuite/camera/CapturePreview.qml | 2 +- basicsuite/camera/Controls.qml | 2 +- basicsuite/camera/FocusControl.qml | 2 +- basicsuite/camera/Picker.qml | 2 +- basicsuite/camera/RecordingTime.qml | 2 +- basicsuite/camera/Slider.qml | 2 +- basicsuite/camera/ZoomControl.qml | 2 +- basicsuite/camera/camerautils/camerautils.cpp | 2 +- basicsuite/camera/camerautils/camerautils.h | 2 +- basicsuite/camera/camerautils/plugin.cpp | 2 +- basicsuite/camera/main.qml | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) (limited to 'basicsuite/camera') diff --git a/basicsuite/camera/CameraControlButton.qml b/basicsuite/camera/CameraControlButton.qml index a740be7..f0dc438 100644 --- a/basicsuite/camera/CameraControlButton.qml +++ b/basicsuite/camera/CameraControlButton.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/CameraSetting.qml b/basicsuite/camera/CameraSetting.qml index 0912c38..bf8fb6b 100644 --- a/basicsuite/camera/CameraSetting.qml +++ b/basicsuite/camera/CameraSetting.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/CaptureControl.qml b/basicsuite/camera/CaptureControl.qml index 7d09151..5a14e4e 100644 --- a/basicsuite/camera/CaptureControl.qml +++ b/basicsuite/camera/CaptureControl.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/CapturePreview.qml b/basicsuite/camera/CapturePreview.qml index 64c5f79..db01ca4 100644 --- a/basicsuite/camera/CapturePreview.qml +++ b/basicsuite/camera/CapturePreview.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/Controls.qml b/basicsuite/camera/Controls.qml index bd0db07..cc1e1ad 100644 --- a/basicsuite/camera/Controls.qml +++ b/basicsuite/camera/Controls.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/FocusControl.qml b/basicsuite/camera/FocusControl.qml index 5245cfe..83fd2fe 100644 --- a/basicsuite/camera/FocusControl.qml +++ b/basicsuite/camera/FocusControl.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/Picker.qml b/basicsuite/camera/Picker.qml index 9cbf27f..e29d70f 100644 --- a/basicsuite/camera/Picker.qml +++ b/basicsuite/camera/Picker.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/RecordingTime.qml b/basicsuite/camera/RecordingTime.qml index 2156b74..941f76a 100644 --- a/basicsuite/camera/RecordingTime.qml +++ b/basicsuite/camera/RecordingTime.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/Slider.qml b/basicsuite/camera/Slider.qml index a9d3c10..18853ad 100644 --- a/basicsuite/camera/Slider.qml +++ b/basicsuite/camera/Slider.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/ZoomControl.qml b/basicsuite/camera/ZoomControl.qml index 15f2875..0c1cbdd 100644 --- a/basicsuite/camera/ZoomControl.qml +++ b/basicsuite/camera/ZoomControl.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/camerautils/camerautils.cpp b/basicsuite/camera/camerautils/camerautils.cpp index f6b6672..9e890d5 100644 --- a/basicsuite/camera/camerautils/camerautils.cpp +++ b/basicsuite/camera/camerautils/camerautils.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/camerautils/camerautils.h b/basicsuite/camera/camerautils/camerautils.h index 1f61c7c..67c5b0d 100644 --- a/basicsuite/camera/camerautils/camerautils.h +++ b/basicsuite/camera/camerautils/camerautils.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** diff --git a/basicsuite/camera/camerautils/plugin.cpp b/basicsuite/camera/camerautils/plugin.cpp index 2a8c3ea..5e74e71 100644 --- a/basicsuite/camera/camerautils/plugin.cpp +++ b/basicsuite/camera/camerautils/plugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Toolkit. diff --git a/basicsuite/camera/main.qml b/basicsuite/camera/main.qml index b7437de..a0cf449 100644 --- a/basicsuite/camera/main.qml +++ b/basicsuite/camera/main.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: For any questions to Digia, please use the contact form at ** http://qt.digia.com/ ** -- cgit v1.2.3 From 0325d7b4156098ef064f04208905712c5bf0174e Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 20 Feb 2014 13:49:55 +0100 Subject: Fix deployment of QML import plugins when building in Qt Creator Task-number: QTEE-419 Task-number: QTEE-420 Change-Id: Iaa57cf0b4060f1dfb3fad3e81bc4c4d070cc6820 Reviewed-by: Eirik Aavitsland Reviewed-by: Kalle Viironen --- basicsuite/camera/camerautils/camerautils.pro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'basicsuite/camera') diff --git a/basicsuite/camera/camerautils/camerautils.pro b/basicsuite/camera/camerautils/camerautils.pro index 938a0a9..7e5864e 100644 --- a/basicsuite/camera/camerautils/camerautils.pro +++ b/basicsuite/camera/camerautils/camerautils.pro @@ -12,8 +12,9 @@ HEADERS += camerautils.h pluginfiles.files += \ qmldir \ -target.path += $$[QT_INSTALL_QML]/CameraUtils -pluginfiles.path += $$[QT_INSTALL_QML]/CameraUtils +B2QT_DEPLOYPATH = /data/user/qt/qmlplugins/CameraUtils +target.path += $$B2QT_DEPLOYPATH +pluginfiles.path += $$B2QT_DEPLOYPATH INSTALLS += target pluginfiles -- cgit v1.2.3