From 6b4994c265889db2058b7d5850b51ddfc5478754 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 5 Dec 2012 13:03:09 +0100 Subject: centralize and fixup example sources install targets This follows suit with aeb036e in qtbase. Change-Id: Ie8580d0a1f38ab9858b0e44c9f99bdc552a1752a Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- .../declarative-camera/CameraButton.qml | 71 +++++++++ .../declarative-camera/CameraPropertyButton.qml | 106 ++++++++++++++ .../declarative-camera/CameraPropertyPopup.qml | 122 ++++++++++++++++ .../declarative-camera/FocusButton.qml | 62 ++++++++ .../declarative-camera/PhotoCaptureControls.qml | 159 +++++++++++++++++++++ .../declarative-camera/PhotoPreview.qml | 62 ++++++++ .../declarative-camera/VideoCaptureControls.qml | 132 +++++++++++++++++ .../declarative-camera/VideoPreview.qml | 72 ++++++++++ .../declarative-camera/ZoomControl.qml | 118 +++++++++++++++ .../declarative-camera/declarative-camera.pro | 10 ++ .../declarative-camera/declarative-camera.qml | 151 +++++++++++++++++++ .../declarative-camera.qmlproject | 18 +++ .../declarative-camera/doc/images/qml-camera.png | Bin 0 -> 28409 bytes .../doc/src/declarative-camera.qdoc | 69 +++++++++ .../declarative-camera/images/camera_auto_mode.png | Bin 0 -> 778 bytes .../images/camera_camera_setting.png | Bin 0 -> 717 bytes .../images/camera_flash_auto.png | Bin 0 -> 1119 bytes .../images/camera_flash_fill.png | Bin 0 -> 610 bytes .../declarative-camera/images/camera_flash_off.png | Bin 0 -> 717 bytes .../images/camera_flash_redeye.png | Bin 0 -> 945 bytes .../images/camera_white_balance_cloudy.png | Bin 0 -> 625 bytes .../images/camera_white_balance_flourescent.png | Bin 0 -> 554 bytes .../images/camera_white_balance_incandescent.png | Bin 0 -> 600 bytes .../images/camera_white_balance_sunny.png | Bin 0 -> 587 bytes .../declarative-camera/images/toolbutton.png | Bin 0 -> 2550 bytes .../declarative-camera/images/toolbutton.sci | 5 + .../declarative-camera/qmlcamera.cpp | 58 ++++++++ 27 files changed, 1215 insertions(+) create mode 100644 examples/multimediawidgets/declarative-camera/CameraButton.qml create mode 100644 examples/multimediawidgets/declarative-camera/CameraPropertyButton.qml create mode 100644 examples/multimediawidgets/declarative-camera/CameraPropertyPopup.qml create mode 100644 examples/multimediawidgets/declarative-camera/FocusButton.qml create mode 100644 examples/multimediawidgets/declarative-camera/PhotoCaptureControls.qml create mode 100644 examples/multimediawidgets/declarative-camera/PhotoPreview.qml create mode 100644 examples/multimediawidgets/declarative-camera/VideoCaptureControls.qml create mode 100644 examples/multimediawidgets/declarative-camera/VideoPreview.qml create mode 100644 examples/multimediawidgets/declarative-camera/ZoomControl.qml create mode 100644 examples/multimediawidgets/declarative-camera/declarative-camera.pro create mode 100644 examples/multimediawidgets/declarative-camera/declarative-camera.qml create mode 100644 examples/multimediawidgets/declarative-camera/declarative-camera.qmlproject create mode 100644 examples/multimediawidgets/declarative-camera/doc/images/qml-camera.png create mode 100644 examples/multimediawidgets/declarative-camera/doc/src/declarative-camera.qdoc create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_auto_mode.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_camera_setting.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_flash_auto.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_flash_fill.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_flash_off.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_flash_redeye.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_white_balance_cloudy.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_white_balance_flourescent.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_white_balance_incandescent.png create mode 100644 examples/multimediawidgets/declarative-camera/images/camera_white_balance_sunny.png create mode 100644 examples/multimediawidgets/declarative-camera/images/toolbutton.png create mode 100644 examples/multimediawidgets/declarative-camera/images/toolbutton.sci create mode 100644 examples/multimediawidgets/declarative-camera/qmlcamera.cpp (limited to 'examples/multimediawidgets/declarative-camera') diff --git a/examples/multimediawidgets/declarative-camera/CameraButton.qml b/examples/multimediawidgets/declarative-camera/CameraButton.qml new file mode 100644 index 000000000..b4e399a49 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/CameraButton.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: button + + signal clicked + + property string text + property color color: "white" + + width : 144 + height: 70 + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: button.width; height: button.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { button.clicked(); } + } + Text { + id: btnText + color: button.color + anchors.centerIn: buttonImage; font.bold: true + text: button.text; style: Text.Raised; styleColor: "black" + font.pixelSize: 14 + } +} diff --git a/examples/multimediawidgets/declarative-camera/CameraPropertyButton.qml b/examples/multimediawidgets/declarative-camera/CameraPropertyButton.qml new file mode 100644 index 000000000..75df17c8d --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/CameraPropertyButton.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +Item { + id: propertyButton + property alias value : popup.currentValue + property alias model : popup.model + + width : 144 + height: 70 + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: propertyButton.width; height: propertyButton.height + } + + CameraButton { + anchors.fill: parent + Image { + anchors.centerIn: parent + source: popup.currentItem.icon + } + + onClicked: popup.toggle() + } + + CameraPropertyPopup { + id: popup + anchors.right: parent.left + anchors.rightMargin: 16 + anchors.top: parent.top + state: "invisible" + visible: opacity > 0 + + currentValue: propertyButton.value + + states: [ + State { + name: "invisible" + PropertyChanges { target: popup; opacity: 0 } + }, + + State { + name: "visible" + PropertyChanges { target: popup; opacity: 1.0 } + } + ] + + transitions: Transition { + NumberAnimation { properties: "opacity"; duration: 100 } + } + + function toggle() { + if (state == "visible") + state = "invisible"; + else + state = "visible"; + } + + onSelected: { + popup.state = "invisible" + } + } +} + diff --git a/examples/multimediawidgets/declarative-camera/CameraPropertyPopup.qml b/examples/multimediawidgets/declarative-camera/CameraPropertyPopup.qml new file mode 100644 index 000000000..ae78b7f6a --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/CameraPropertyPopup.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: propertyPopup + + property alias model : view.model + property variant currentValue + property variant currentItem : model.get(view.currentIndex) + + property int itemWidth : 100 + property int itemHeight : 70 + property int columns : 2 + + width: columns*itemWidth + view.anchors.margins*2 + height: Math.ceil(model.count/columns)*itemHeight + view.anchors.margins*2 + 25 + + radius: 5 + border.color: "#000000" + border.width: 2 + smooth: true + color: "#5e5e5e" + + signal selected + + function indexForValue(value) { + for (var i = 0; i < view.count; i++) { + if (model.get(i).value == value) { + return i; + } + } + + return 0; + } + + GridView { + id: view + anchors.fill: parent + anchors.margins: 5 + cellWidth: propertyPopup.itemWidth + cellHeight: propertyPopup.itemHeight + snapMode: ListView.SnapOneItem + highlightFollowsCurrentItem: true + highlight: Rectangle { color: "gray"; radius: 5 } + currentIndex: indexForValue(propertyPopup.currentValue) + + onCurrentIndexChanged: { + propertyPopup.currentValue = model.get(view.currentIndex).value + } + + delegate: Item { + width: propertyPopup.itemWidth + height: 70 + + Image { + anchors.centerIn: parent + source: icon + } + MouseArea { + anchors.fill: parent + onClicked: { + propertyPopup.currentValue = value + propertyPopup.selected(value) + } + } + } + } + + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 8 + anchors.left: parent.left + anchors.leftMargin: 16 + + color: "#ffffff" + font.bold: true + style: Text.Raised; + styleColor: "black" + font.pixelSize: 14 + + text: view.model.get(view.currentIndex).text + } +} diff --git a/examples/multimediawidgets/declarative-camera/FocusButton.qml b/examples/multimediawidgets/declarative-camera/FocusButton.qml new file mode 100644 index 000000000..7f588826b --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/FocusButton.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +CameraButton { + property Camera camera + + onClicked: { + if (camera.lockStatus == Camera.Unlocked) + camera.searchAndLock(); + else + camera.unlock(); + } + + text: { + if (camera.lockStatus == Camera.Unlocked) + "Focus"; + else if (camera.lockStatus == Camera.Searching) + "Focusing" + else + "Unlock" + } +} diff --git a/examples/multimediawidgets/declarative-camera/PhotoCaptureControls.qml b/examples/multimediawidgets/declarative-camera/PhotoCaptureControls.qml new file mode 100644 index 000000000..ccd14a084 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/PhotoCaptureControls.qml @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +FocusScope { + property Camera camera + property bool previewAvailable : false + + property int buttonsPanelWidth: buttonPaneShadow.width + + signal previewSelected + signal videoModeSelected + id : captureControls + + Rectangle { + id: buttonPaneShadow + width: buttonsColumn.width + 16 + height: parent.height + anchors.top: parent.top + anchors.right: parent.right + color: Qt.rgba(0.08, 0.08, 0.08, 1) + + Column { + anchors { + right: parent.right + top: parent.top + margins: 8 + } + + id: buttonsColumn + spacing: 8 + + FocusButton { + camera: captureControls.camera + visible: camera.cameraStatus == Camera.ActiveStatus && camera.focus.isFocusModeSupported(Camera.FocusAuto) + } + + CameraButton { + text: "Capture" + visible: camera.imageCapture.ready + onClicked: camera.imageCapture.capture() + } + + CameraPropertyButton { + id : wbModesButton + value: CameraImageProcessing.WhiteBalanceAuto + model: ListModel { + ListElement { + icon: "images/camera_auto_mode.png" + value: CameraImageProcessing.WhiteBalanceAuto + text: "Auto" + } + ListElement { + icon: "images/camera_white_balance_sunny.png" + value: CameraImageProcessing.WhiteBalanceSunlight + text: "Sunlight" + } + ListElement { + icon: "images/camera_white_balance_cloudy.png" + value: CameraImageProcessing.WhiteBalanceCloudy + text: "Cloudy" + } + ListElement { + icon: "images/camera_white_balance_incandescent.png" + value: CameraImageProcessing.WhiteBalanceTungsten + text: "Tungsten" + } + ListElement { + icon: "images/camera_white_balance_flourescent.png" + value: CameraImageProcessing.WhiteBalanceFluorescent + text: "Fluorescent" + } + } + } + + CameraButton { + text: "View" + onClicked: captureControls.previewSelected() + visible: captureControls.previewAvailable + } + } + + Column { + anchors { + bottom: parent.bottom + right: parent.right + margins: 8 + } + + id: bottomColumn + spacing: 8 + + CameraButton { + text: "Switch to Video" + onClicked: captureControls.videoModeSelected() + } + + + CameraButton { + id: quitButton + text: "Quit" + onClicked: Qt.quit() + } + } + + + } + + + ZoomControl { + x : 0 + y : 0 + width : 100 + height: parent.height + + currentZoom: camera.digitalZoom + maximumZoom: Math.min(4.0, camera.maximumDigitalZoom) + onZoomTo: camera.setDigitalZoom(value) + } +} diff --git a/examples/multimediawidgets/declarative-camera/PhotoPreview.qml b/examples/multimediawidgets/declarative-camera/PhotoPreview.qml new file mode 100644 index 000000000..f392d3b9f --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/PhotoPreview.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +Item { + property alias source : preview.source + signal closed + + Image { + id: preview + anchors.fill : parent + fillMode: Image.PreserveAspectFit + smooth: true + } + + MouseArea { + anchors.fill: parent + onClicked: { + parent.closed(); + } + } +} + diff --git a/examples/multimediawidgets/declarative-camera/VideoCaptureControls.qml b/examples/multimediawidgets/declarative-camera/VideoCaptureControls.qml new file mode 100644 index 000000000..c40365e47 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/VideoCaptureControls.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +FocusScope { + property Camera camera + property bool previewAvailable : false + + property int buttonsPanelWidth: buttonPaneShadow.width + + signal previewSelected + signal photoModeSelected + id : captureControls + + Rectangle { + id: buttonPaneShadow + width: buttonsColumn.width + 16 + height: parent.height + anchors.top: parent.top + anchors.right: parent.right + color: Qt.rgba(0.08, 0.08, 0.08, 1) + + Column { + anchors { + right: parent.right + top: parent.top + margins: 8 + } + + id: buttonsColumn + spacing: 8 + + FocusButton { + camera: captureControls.camera + visible: camera.cameraStatus == Camera.ActiveStatus && camera.focus.isFocusModeSupported(Camera.FocusAuto) + } + + CameraButton { + text: "Record" + visible: camera.videoRecorder.recorderStatus == CameraRecorder.LoadedStatus + onClicked: camera.videoRecorder.record() + } + + CameraButton { + id: stopButton + text: "Stop" + visible: camera.videoRecorder.recorderStatus == CameraRecorder.RecordingStatus + onClicked: camera.videoRecorder.stop() + } + + CameraButton { + text: "View" + onClicked: captureControls.previewSelected() + //don't show View button during recording + visible: camera.videoRecorder.actualLocation && !stopButton.visible + } + } + + Column { + anchors { + bottom: parent.bottom + right: parent.right + margins: 8 + } + + id: bottomColumn + spacing: 8 + + CameraButton { + text: "Switch to Photo" + onClicked: captureControls.photoModeSelected() + } + + CameraButton { + id: quitButton + text: "Quit" + onClicked: Qt.quit() + } + } + } + + + ZoomControl { + x : 0 + y : 0 + width : 100 + height: parent.height + + currentZoom: camera.digitalZoom + maximumZoom: Math.min(4.0, camera.maximumDigitalZoom) + onZoomTo: camera.setDigitalZoom(value) + } +} diff --git a/examples/multimediawidgets/declarative-camera/VideoPreview.qml b/examples/multimediawidgets/declarative-camera/VideoPreview.qml new file mode 100644 index 000000000..dc9eb0b55 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/VideoPreview.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +Item { + id: videoPreview + property alias source : player.source + signal closed + + MediaPlayer { + id: player + autoPlay: true + + //switch back to viewfinder after playback finished + onStatusChanged: { + if (status == MediaPlayer.EndOfMedia) + videoPreview.closed(); + } + } + + VideoOutput { + source: player + anchors.fill : parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + videoPreview.closed(); + } + } +} + diff --git a/examples/multimediawidgets/declarative-camera/ZoomControl.qml b/examples/multimediawidgets/declarative-camera/ZoomControl.qml new file mode 100644 index 000000000..a4847baa6 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/ZoomControl.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +Item { + id : zoomControl + property real currentZoom : 1 + property real maximumZoom : 1 + signal zoomTo(real value) + + MouseArea { + id : mouseArea + anchors.fill: parent + + property real initialZoom : 0 + property real initialPos : 0 + + onPressed: { + initialPos = mouseY + initialZoom = zoomControl.currentZoom + } + + onPositionChanged: { + if (pressed) { + var target = initialZoom * Math.pow(2, (initialPos-mouseY)/zoomControl.height); + target = Math.max(1, Math.min(target, zoomControl.maximumZoom)) + zoomControl.zoomTo(target) + } + } + } + + Item { + id : bar + x : 16 + y : parent.height/4 + width : 24 + height : parent.height/2 + opacity : 0 + + Rectangle { + anchors.fill: parent + + smooth: true + radius: 8 + border.color: "black" + border.width: 2 + color: "white" + opacity: 0.3 + } + + Rectangle { + x : 0 + y : parent.height * (1.0 - (zoomControl.currentZoom-1.0) / (zoomControl.maximumZoom-1.0)) + width: parent.width + height: parent.height - y + smooth: true + radius: 8 + color: "black" + opacity: 0.5 + } + + states: State { + name: "ShowBar" + when: mouseArea.pressed || zoomControl.currentZoom > 1.0 + PropertyChanges { target: bar; opacity: 1 } + } + + transitions: [ + Transition { + to : "ShowBar" + NumberAnimation { properties: "opacity"; duration: 100 } + }, + Transition { + from : "ShowBar" + NumberAnimation { properties: "opacity"; duration: 500 } + } + ] + } +} diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.pro b/examples/multimediawidgets/declarative-camera/declarative-camera.pro new file mode 100644 index 000000000..c52a1d1e6 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/declarative-camera.pro @@ -0,0 +1,10 @@ +TEMPLATE=app +TARGET=declarative-camera + +QT += quick qml multimedia + +SOURCES += qmlcamera.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/multimediawidgets/declarative-camera +INSTALLS += target + diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.qml b/examples/multimediawidgets/declarative-camera/declarative-camera.qml new file mode 100644 index 000000000..7f0f21900 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/declarative-camera.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtMultimedia 5.0 + +Rectangle { + id : cameraUI + + width: 800 + height: 480 + + color: "black" + state: "PhotoCapture" + + states: [ + State { + name: "PhotoCapture" + StateChangeScript { + script: { + camera.captureMode = Camera.CaptureStillImage + camera.start() + } + } + }, + State { + name: "PhotoPreview" + }, + State { + name: "VideoCapture" + StateChangeScript { + script: { + camera.captureMode = Camera.CaptureVideo + camera.start() + } + } + }, + State { + name: "VideoPreview" + StateChangeScript { + script: { + camera.stop() + } + } + } + ] + + Camera { + id: camera + captureMode: Camera.CaptureStillImage + + imageCapture { + onImageCaptured: { + photoPreview.source = preview + stillControls.previewAvailable = true + cameraUI.state = "PhotoPreview" + } + } + + videoRecorder { + resolution: "640x480" + frameRate: 15 + } + } + + PhotoPreview { + id : photoPreview + anchors.fill : parent + onClosed: cameraUI.state = "PhotoCapture" + visible: cameraUI.state == "PhotoPreview" + focus: visible + } + + VideoPreview { + id : videoPreview + anchors.fill : parent + onClosed: cameraUI.state = "VideoCapture" + visible: cameraUI.state == "VideoPreview" + focus: visible + + //don't load recorded video if preview is invisible + source: visible ? camera.videoRecorder.actualLocation : "" + } + + VideoOutput { + id: viewfinder + visible: cameraUI.state == "PhotoCapture" || cameraUI.state == "VideoCapture" + + x: 0 + y: 0 + width: parent.width - stillControls.buttonsPanelWidth + height: parent.height + + source: camera + } + + PhotoCaptureControls { + id: stillControls + anchors.fill: parent + camera: camera + visible: cameraUI.state == "PhotoCapture" + onPreviewSelected: cameraUI.state = "PhotoPreview" + onVideoModeSelected: cameraUI.state = "VideoCapture" + } + + VideoCaptureControls { + id: videoControls + anchors.fill: parent + camera: camera + visible: cameraUI.state == "VideoCapture" + onPreviewSelected: cameraUI.state = "VideoPreview" + onPhotoModeSelected: cameraUI.state = "PhotoCapture" + } +} diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.qmlproject b/examples/multimediawidgets/declarative-camera/declarative-camera.qmlproject new file mode 100644 index 000000000..53f5ecb8d --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/declarative-camera.qmlproject @@ -0,0 +1,18 @@ +/* File generated by QtCreator */ + +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ "../exampleplugin" ] +} diff --git a/examples/multimediawidgets/declarative-camera/doc/images/qml-camera.png b/examples/multimediawidgets/declarative-camera/doc/images/qml-camera.png new file mode 100644 index 000000000..0cd61f0a0 Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/doc/images/qml-camera.png differ diff --git a/examples/multimediawidgets/declarative-camera/doc/src/declarative-camera.qdoc b/examples/multimediawidgets/declarative-camera/doc/src/declarative-camera.qdoc new file mode 100644 index 000000000..37f35ea26 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/doc/src/declarative-camera.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\example declarative-camera +\title QML Camera Example +\ingroup camera_examples_qml + +\brief The Camera Example shows how to use the API to capture a still image +or video. + +\image qml-camera.png + +This example demonstrates how to use the Qt Multimedia QML API to access +camera functions. It shows how to change settings and to capture images. + +Most of the QML code supports the user interface for this application with the +camera types being mostly found in \e {declarative-camera.qml} and +\e {CaptureControls.qml}. + +In \e {declarative-camera.qml} the \l Camera is initialized with an id +of \e {camera}, a photo preview is setup, states are implemented for image +preview or capture and \l CaptureControls is initialized. The initial +\e state is \e PhotoCapture. \l CameraCapture includes a handler, \e onImageCaptured, +for the \l {imageCaptured} signal. The handler sets up the application to process +the preview including a change in the user interface state. The \l PhotoPreview +becomes visible with any key press being picked up by the handler +in PhotoPreview and returning the state to \e PhotoCapture. + +\e CaptureControls, which is implemented in \e {CaptureControls.qml}, +generates a column on the right hand side of the screen which includes control +buttons for \e focus (not initially visible), \e {capture}, \e {flash modes}, +\e {white balance}, \e {exposure compensation}, and if a preview is +available a \e {preview} button. The last button exits from the application. + +When the Capture button is pressed the \e onClicked handler calls +\l {Camera::captureImage()}{captureImage()} + + + + + + + +*/ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_auto_mode.png b/examples/multimediawidgets/declarative-camera/images/camera_auto_mode.png new file mode 100644 index 000000000..f168296cf Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_auto_mode.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_camera_setting.png b/examples/multimediawidgets/declarative-camera/images/camera_camera_setting.png new file mode 100644 index 000000000..7b993eee9 Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_camera_setting.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_auto.png b/examples/multimediawidgets/declarative-camera/images/camera_flash_auto.png new file mode 100644 index 000000000..fb5cc40ec Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_flash_auto.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_fill.png b/examples/multimediawidgets/declarative-camera/images/camera_flash_fill.png new file mode 100644 index 000000000..7bc5949ac Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_flash_fill.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_off.png b/examples/multimediawidgets/declarative-camera/images/camera_flash_off.png new file mode 100644 index 000000000..3c5db10cc Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_flash_off.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_redeye.png b/examples/multimediawidgets/declarative-camera/images/camera_flash_redeye.png new file mode 100644 index 000000000..534a087df Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_flash_redeye.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_cloudy.png b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_cloudy.png new file mode 100644 index 000000000..243b699e7 Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_cloudy.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_flourescent.png b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_flourescent.png new file mode 100644 index 000000000..032efe1d1 Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_flourescent.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_incandescent.png b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_incandescent.png new file mode 100644 index 000000000..98f906741 Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_incandescent.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_sunny.png b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_sunny.png new file mode 100644 index 000000000..d7d5c9a36 Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/camera_white_balance_sunny.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/toolbutton.png b/examples/multimediawidgets/declarative-camera/images/toolbutton.png new file mode 100644 index 000000000..11310013e Binary files /dev/null and b/examples/multimediawidgets/declarative-camera/images/toolbutton.png differ diff --git a/examples/multimediawidgets/declarative-camera/images/toolbutton.sci b/examples/multimediawidgets/declarative-camera/images/toolbutton.sci new file mode 100644 index 000000000..9e4f96530 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/examples/multimediawidgets/declarative-camera/qmlcamera.cpp b/examples/multimediawidgets/declarative-camera/qmlcamera.cpp new file mode 100644 index 000000000..0d8dbc462 --- /dev/null +++ b/examples/multimediawidgets/declarative-camera/qmlcamera.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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 + +int main(int argc, char* argv[]) +{ + QGuiApplication app(argc,argv); + QQuickView view; + view.setResizeMode(QQuickView::SizeRootObjectToView); + // Qt.quit() called in embedded .qml by default only emits + // quit() signal, so do this (optionally use Qt.exit()). + QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); + view.setSource(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + + QLatin1String("/declarative-camera.qml"))); + view.resize(800, 480); + view.show(); + return app.exec(); +} -- cgit v1.2.3