Moved declarative-camera example in the right directory.

This example was in the multimediawidgets directory but doesn't depend on
or use the QtMultimediaWidgets module. Moved to 'examples/multimedia'
instead.

Change-Id: Ic2fcc6576e95664e0002531ee378a4366daa56c1
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
Yoann Lopes
2013-07-19 12:47:55 +02:00
committed by The Qt Project
parent 44913bb75d
commit a91809bf0f
31 changed files with 2 additions and 7 deletions

View File

@@ -1,71 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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
}
}

View File

@@ -1,106 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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"
}
}
}

View File

@@ -1,122 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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
}
}

View File

@@ -1,62 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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"
}
}

View File

@@ -1,159 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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)
}
}

View File

@@ -1,62 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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();
}
}
}

View File

@@ -1,132 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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)
}
}

View File

@@ -1,72 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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();
}
}
}

View File

@@ -1,118 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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 }
}
]
}
}

View File

@@ -1,11 +0,0 @@
TEMPLATE=app
TARGET=declarative-camera
QT += quick qml multimedia
SOURCES += qmlcamera.cpp
RESOURCES += declarative-camera.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/multimediawidgets/declarative-camera
INSTALLS += target

View File

@@ -1,151 +0,0 @@
/****************************************************************************
**
** 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$
**
****************************************************************************/
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"
}
}

View File

@@ -1,18 +0,0 @@
/* 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" ]
}

View File

@@ -1,26 +0,0 @@
<RCC>
<qresource prefix="/">
<file>PhotoPreview.qml</file>
<file>ZoomControl.qml</file>
<file>VideoCaptureControls.qml</file>
<file>VideoPreview.qml</file>
<file>FocusButton.qml</file>
<file>PhotoCaptureControls.qml</file>
<file>declarative-camera.qml</file>
<file>CameraPropertyPopup.qml</file>
<file>CameraPropertyButton.qml</file>
<file>CameraButton.qml</file>
<file>images/camera_auto_mode.png</file>
<file>images/camera_camera_setting.png</file>
<file>images/camera_flash_auto.png</file>
<file>images/camera_flash_fill.png</file>
<file>images/camera_flash_off.png</file>
<file>images/camera_flash_redeye.png</file>
<file>images/camera_white_balance_cloudy.png</file>
<file>images/camera_white_balance_flourescent.png</file>
<file>images/camera_white_balance_incandescent.png</file>
<file>images/camera_white_balance_sunny.png</file>
<file>images/toolbutton.png</file>
<file>images/toolbutton.sci</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,68 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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 multimedia_examples
\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()}
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,5 +0,0 @@
border.left: 15
border.top: 4
border.bottom: 4
border.right: 15
source: toolbutton.png

View File

@@ -1,57 +0,0 @@
/****************************************************************************
**
** 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 <QGuiApplication>
#include <QQuickView>
#include <QQmlEngine>
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("qrc:///declarative-camera.qml"));
view.resize(800, 480);
view.show();
return app.exec();
}

View File

@@ -9,8 +9,3 @@ qtHaveModule(widgets) {
player \
customvideosurface
}
qtHaveModule(gui):qtHaveModule(qml) {
disabled:SUBDIRS += declarative-camera
}