Initial copy of QtMultimediaKit.
Comes from original repo, with SHA1: 2c82d5611655e5967f5c5095af50c0991c4378b2
71
examples/declarative-camera/CameraButton.qml
Normal file
@@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
107
examples/declarative-camera/CameraPropertyButton.qml
Normal file
@@ -0,0 +1,107 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
import QtMultimediaKit 1.1
|
||||
|
||||
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 }
|
||||
PropertyChanges { target: camera; focus: true }
|
||||
},
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
122
examples/declarative-camera/CameraPropertyPopup.qml
Normal file
@@ -0,0 +1,122 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
237
examples/declarative-camera/CaptureControls.qml
Normal file
@@ -0,0 +1,237 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
import QtMultimediaKit 1.1
|
||||
|
||||
FocusScope {
|
||||
property Camera camera
|
||||
property bool previewAvailable : false
|
||||
|
||||
property alias whiteBalance : wbModesButton.value
|
||||
property alias flashMode : flashModesButton.value
|
||||
property alias exposureCompensation : exposureCompensationButton.value
|
||||
|
||||
property int buttonsPanelWidth: buttonPaneShadow.width
|
||||
|
||||
signal previewSelected
|
||||
id : captureControls
|
||||
|
||||
Rectangle {
|
||||
id: buttonPaneShadow
|
||||
width: buttonPanningPane.width + 16
|
||||
height: parent.height
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
color: Qt.rgba(0.08, 0.08, 0.08, 1)
|
||||
|
||||
Flickable {
|
||||
id: buttonPanningPane
|
||||
anchors {
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
margins: 8
|
||||
}
|
||||
width: buttonsColumn.width
|
||||
|
||||
contentWidth: buttonsColumn.width
|
||||
contentHeight: buttonsColumn.height
|
||||
|
||||
Column {
|
||||
id: buttonsColumn
|
||||
spacing: 8
|
||||
|
||||
FocusButton {
|
||||
camera: captureControls.camera
|
||||
}
|
||||
|
||||
CameraButton {
|
||||
text: "Capture"
|
||||
onClicked: camera.captureImage()
|
||||
}
|
||||
|
||||
CameraPropertyButton {
|
||||
id : flashModesButton
|
||||
value: Camera.FlashOff
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
icon: "images/camera_flash_auto.png"
|
||||
value: Camera.FlashAuto
|
||||
text: "Auto"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_flash_off.png"
|
||||
value: Camera.FlashOff
|
||||
text: "Off"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_flash_fill.png"
|
||||
value: Camera.FlashOn
|
||||
text: "On"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_flash_redeye.png"
|
||||
value: Camera.FlashRedEyeReduction
|
||||
text: "Red Eye Reduction"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CameraPropertyButton {
|
||||
id : wbModesButton
|
||||
value: Camera.WhiteBalanceAuto
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
icon: "images/camera_auto_mode.png"
|
||||
value: Camera.WhiteBalanceAuto
|
||||
text: "Auto"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_white_balance_sunny.png"
|
||||
value: Camera.WhiteBalanceSunlight
|
||||
text: "Sunlight"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_white_balance_cloudy.png"
|
||||
value: Camera.WhiteBalanceCloudy
|
||||
text: "Cloudy"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_white_balance_incandescent.png"
|
||||
value: Camera.WhiteBalanceIncandescent
|
||||
text: "Incandescent"
|
||||
}
|
||||
ListElement {
|
||||
icon: "images/camera_white_balance_flourescent.png"
|
||||
value: Camera.WhiteBalanceFluorescent
|
||||
text: "Fluorescent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExposureCompensationButton {
|
||||
id : exposureCompensationButton
|
||||
}
|
||||
|
||||
CameraButton {
|
||||
text: "View"
|
||||
onClicked: captureControls.previewSelected()
|
||||
visible: captureControls.previewAvailable
|
||||
}
|
||||
|
||||
CameraButton {
|
||||
id: quitButton
|
||||
text: "Quit"
|
||||
onClicked: Qt.quit()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
id: exposureDetails
|
||||
anchors.bottom : parent.bottom
|
||||
anchors.left : parent.left
|
||||
anchors.bottomMargin: 16
|
||||
anchors.leftMargin: 16
|
||||
height: childrenRect.height
|
||||
width: childrenRect.width
|
||||
|
||||
visible : camera.lockStatus == Camera.Locked
|
||||
|
||||
Rectangle {
|
||||
opacity: 0.4
|
||||
color: "black"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing : 16
|
||||
|
||||
Text {
|
||||
text: "Av: "+camera.aperture.toFixed(1)
|
||||
font.pixelSize: 18
|
||||
color: "white"
|
||||
visible: camera.aperture > 0
|
||||
}
|
||||
|
||||
Text {
|
||||
font.pixelSize: 18
|
||||
color: "white"
|
||||
visible: camera.shutterSpped > 0
|
||||
text: "Tv: "+printableExposureTime(camera.shutterSpeed)
|
||||
|
||||
function printableExposureTime(t) {
|
||||
if (t > 3.9)
|
||||
return "Tv: "+t.toFixed() + "\"";
|
||||
|
||||
if (t > 0.24 )
|
||||
return "Tv: "+t.toFixed(1) + "\"";
|
||||
|
||||
if (t > 0)
|
||||
return "Tv: 1/"+(1/t).toFixed();
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "ISO: "+camera.iso.toFixed()
|
||||
font.pixelSize: 18
|
||||
color: "white"
|
||||
visible: camera.iso > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZoomControl {
|
||||
x : 0
|
||||
y : 0
|
||||
width : 100
|
||||
height: parent.height
|
||||
|
||||
currentZoom: camera.digitalZoom
|
||||
maximumZoom: Math.min(4.0, camera.maximumDigitalZoom)
|
||||
onZoomTo: camera.setDigitalZoom(value)
|
||||
}
|
||||
}
|
||||
85
examples/declarative-camera/ExposureCompensationButton.qml
Normal file
@@ -0,0 +1,85 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
|
||||
Item {
|
||||
id: exposureCompensation
|
||||
property real value : flickableList.items[flickableList.index]
|
||||
signal clicked
|
||||
|
||||
width : 144
|
||||
height: 70
|
||||
|
||||
BorderImage {
|
||||
id: buttonImage
|
||||
source: "images/toolbutton.sci"
|
||||
width: exposureCompensation.width; height: exposureCompensation.height
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Ev:"
|
||||
x: 8
|
||||
y: 8
|
||||
font.pixelSize: 18
|
||||
color: "white"
|
||||
}
|
||||
|
||||
FlickableList {
|
||||
anchors.fill: buttonImage
|
||||
id: flickableList
|
||||
items: ["-2", "-1.5", "-1", "-0.5", "0", "+0.5", "+1", "+1.5", "+2"]
|
||||
index: 4
|
||||
|
||||
onClicked: exposureCompensation.clicked()
|
||||
|
||||
delegate: Text {
|
||||
font.pixelSize: 22
|
||||
color: "white"
|
||||
styleColor: "black"
|
||||
width: flickableList.width
|
||||
height: flickableList.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: flickableList.items[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
128
examples/declarative-camera/FlickableList.qml
Normal file
@@ -0,0 +1,128 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
|
||||
Item {
|
||||
id: flickableList
|
||||
clip: true
|
||||
|
||||
signal clicked
|
||||
|
||||
property alias delegate : repeater.delegate
|
||||
|
||||
property variant items: []
|
||||
property int index: 0
|
||||
property int itemWidth : flickableList.width
|
||||
|
||||
function scrollTo(id) {
|
||||
var x = id*flickableList.itemWidth
|
||||
if (flickArea.contentX != x) {
|
||||
centeringAnimation.stop();
|
||||
flickArea.newX = id*flickableList.itemWidth
|
||||
centeringAnimation.start();
|
||||
}
|
||||
}
|
||||
|
||||
onIndexChanged: scrollTo(index)
|
||||
onWidthChanged: scrollTo(index)
|
||||
|
||||
Flickable {
|
||||
id: flickArea
|
||||
property int newX: 0
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
var x = mapToItem(flickableList, mouseX, mouseY).x
|
||||
|
||||
if (x < flickableList.width/3) {
|
||||
if (flickableList.index > 0)
|
||||
flickableList.scrollTo(flickableList.index-1);
|
||||
} else if (x > flickableList.width*2/3) {
|
||||
if (flickableList.index < flickableList.items.length-1)
|
||||
flickableList.scrollTo(flickableList.index+1);
|
||||
} else {
|
||||
flickableList.clicked()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
PropertyAnimation {
|
||||
id: centeringAnimation
|
||||
target: flickArea
|
||||
properties: "contentX"
|
||||
easing.type: Easing.OutQuad
|
||||
from: flickArea.contentX
|
||||
to: flickArea.newX
|
||||
|
||||
onCompleted: {
|
||||
flickableList.index = flickArea.newX / flickableList.itemWidth
|
||||
}
|
||||
}
|
||||
|
||||
onMovementStarted: {
|
||||
centeringAnimation.stop();
|
||||
}
|
||||
|
||||
onMovementEnded: {
|
||||
var modulo = flickArea.contentX % flickableList.itemWidth;
|
||||
var offset = flickableList.itemWidth / 2;
|
||||
flickArea.newX = modulo < offset ? flickArea.contentX - modulo : flickArea.contentX + (flickableList.itemWidth - modulo);
|
||||
centeringAnimation.start();
|
||||
}
|
||||
|
||||
|
||||
width: flickableList.width
|
||||
height: flickableList.height
|
||||
contentWidth: items.width
|
||||
contentHeight: items.height
|
||||
flickDeceleration: 4000
|
||||
|
||||
Row {
|
||||
id: items
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: flickableList.items.length
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
62
examples/declarative-camera/FocusButton.qml
Normal file
@@ -0,0 +1,62 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
import QtMultimediaKit 1.1
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
62
examples/declarative-camera/PhotoPreview.qml
Normal file
@@ -0,0 +1,62 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
import QtMultimediaKit 1.1
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
118
examples/declarative-camera/ZoomControl.qml
Normal file
@@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
import QtMultimediaKit 1.1
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
onMousePositionChanged: {
|
||||
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 }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 "camerakeyevent_symbian.h"
|
||||
|
||||
#include <QtGui/QWidget> // WId
|
||||
#include <eikon.hrh> // EKeyCamera
|
||||
#include <coecntrl.h> // CCoeControl (WId)
|
||||
#include <w32std.h> // RWindowbase, RWindowGroup, RWsSession
|
||||
|
||||
QSymbianCameraKeyListener::QSymbianCameraKeyListener(QWidget *widget):
|
||||
QObject(widget),
|
||||
m_widget(widget)
|
||||
{
|
||||
if (!m_widget)
|
||||
return;
|
||||
|
||||
// Get view's native Symbian window
|
||||
WId windowId = 0;
|
||||
if (m_widget->internalWinId())
|
||||
windowId = m_widget->internalWinId();
|
||||
else if (m_widget->parentWidget() && m_widget->effectiveWinId())
|
||||
windowId = m_widget->effectiveWinId();
|
||||
RWindowBase *window = windowId ? static_cast<RWindowBase*>(windowId->DrawableWindow()) : 0;
|
||||
|
||||
// Get hold of the window group
|
||||
TInt wGroupId = window ? window->WindowGroupId() : 0;
|
||||
if (!wGroupId)
|
||||
return;
|
||||
RWsSession &wsSession = CCoeEnv::Static()->WsSession();
|
||||
TUint wGroupHandle = wsSession.GetWindowGroupHandle(wGroupId);
|
||||
if (wGroupHandle) {
|
||||
RWindowGroup wGroup(wsSession);
|
||||
wGroup.Construct(wGroupHandle);
|
||||
if (wGroup.CaptureKey(EKeyCamera, 0, 0, 100) < 0)
|
||||
qWarning("Unable to register for camera capture key events, SwEvent capability may be missing");
|
||||
}
|
||||
}
|
||||
|
||||
QSymbianCameraKeyListener::~QSymbianCameraKeyListener()
|
||||
{
|
||||
if (!m_widget)
|
||||
return;
|
||||
|
||||
// Get view's native Symbian window
|
||||
WId windowId = 0;
|
||||
if (m_widget->internalWinId())
|
||||
windowId = m_widget->internalWinId();
|
||||
else if (m_widget->parentWidget() && m_widget->effectiveWinId())
|
||||
windowId = m_widget->effectiveWinId();
|
||||
RWindowBase *window = windowId ? static_cast<RWindowBase*>(windowId->DrawableWindow()) : 0;
|
||||
|
||||
// Get hold of the window group
|
||||
TInt wGroupId = window ? window->WindowGroupId() : 0;
|
||||
if (!wGroupId)
|
||||
return;
|
||||
RWsSession &wsSession = CCoeEnv::Static()->WsSession();
|
||||
TUint wGroupHandle = wsSession.GetWindowGroupHandle(wGroupId);
|
||||
if (wGroupHandle) {
|
||||
RWindowGroup wGroup(wsSession);
|
||||
wGroup.Construct(wGroupHandle);
|
||||
wGroup.CancelCaptureKey(EKeyCamera);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
#ifndef CAMERAKEYEVENT_SYMBIAN_H
|
||||
#define CAMERAKEYEVENT_SYMBIAN_H
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* This header can be used to register application on Symbian platforms
|
||||
* for the Camera capture button key events. Application can avoid native
|
||||
* camera application from starting by not forwarding the key event.
|
||||
*
|
||||
* Usage:
|
||||
* Application needs to include this header and include the needed Symbian
|
||||
* libraries. Optionally application can include camerakeyevent_symbian.pri
|
||||
* file. Application can register and unregister for the Camera capture
|
||||
* key events by creating/destructing the QSymbianCameraKeyListener helper
|
||||
* object. The widget needs to be shown before it registers for the
|
||||
* Camera key event.
|
||||
*
|
||||
* Libraries needed:
|
||||
* User needs to define following in the .pro file (or optionally include
|
||||
* the camerakeyevent_symbian.pri):
|
||||
* LIBS += -lcone -lws32
|
||||
*
|
||||
* Symbian Capabilities needed:
|
||||
* To use this header user needs to have SwEvent capability (included in
|
||||
* the camerakeyevent_symbian.pri):
|
||||
* TARGET.CAPABILITY += SwEvent
|
||||
*/
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_FORWARD_DECLARE_CLASS(QWidget)
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
class QSymbianCameraKeyListener : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QSymbianCameraKeyListener(QWidget *parent = 0);
|
||||
~QSymbianCameraKeyListener();
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
};
|
||||
|
||||
#endif // CAMERAKEYEVENT_SYMBIAN_H
|
||||
@@ -0,0 +1,7 @@
|
||||
message("camerakeyevent_symbian: Including Symbian camera capture key event register methods")
|
||||
|
||||
HEADERS += $$PWD/camerakeyevent_symbian.h
|
||||
SOURCES += $$PWD/camerakeyevent_symbian.cpp
|
||||
INCLUDEPATH += $$PWD
|
||||
LIBS *= -lcone -lws32
|
||||
TARGET.CAPABILITY *= SwEvent
|
||||
31
examples/declarative-camera/declarative-camera.pro
Normal file
@@ -0,0 +1,31 @@
|
||||
include (../mobility_examples.pri)
|
||||
|
||||
TEMPLATE=app
|
||||
|
||||
QT += declarative network
|
||||
|
||||
!maemo5 {
|
||||
contains(QT_CONFIG, opengl) {
|
||||
QT += opengl
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
#required by Qt SDK to resolve Mobility libraries
|
||||
CONFIG+=mobility
|
||||
MOBILITY+=multimedia
|
||||
}
|
||||
|
||||
SOURCES += $$PWD/qmlcamera.cpp
|
||||
!mac:TARGET = qml_camera
|
||||
else:TARGET = QmlCamera
|
||||
|
||||
RESOURCES += declarative-camera.qrc
|
||||
|
||||
symbian {
|
||||
include(camerakeyevent_symbian/camerakeyevent_symbian.pri)
|
||||
load(data_caging_paths)
|
||||
TARGET.CAPABILITY += UserEnvironment NetworkServices Location ReadUserData WriteUserData
|
||||
TARGET.EPOCHEAPSIZE = 0x20000 0x3000000
|
||||
}
|
||||
|
||||
116
examples/declarative-camera/declarative-camera.qml
Normal file
@@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 Qt 4.7
|
||||
import QtMultimediaKit 1.1
|
||||
|
||||
Rectangle {
|
||||
id : cameraUI
|
||||
color: "black"
|
||||
state: "PhotoCapture"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "PhotoCapture"
|
||||
StateChangeScript {
|
||||
script: {
|
||||
camera.visible = true
|
||||
camera.focus = true
|
||||
stillControls.visible = true
|
||||
photoPreview.visible = false
|
||||
}
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "PhotoPreview"
|
||||
StateChangeScript {
|
||||
script: {
|
||||
camera.visible = false
|
||||
stillControls.visible = false
|
||||
photoPreview.visible = true
|
||||
photoPreview.focus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
PhotoPreview {
|
||||
id : photoPreview
|
||||
anchors.fill : parent
|
||||
onClosed: cameraUI.state = "PhotoCapture"
|
||||
focus: visible
|
||||
|
||||
Keys.onPressed : {
|
||||
//return to capture mode if the shutter button is touched
|
||||
if (event.key == Qt.Key_CameraFocus && !event.isAutoRepeat) {
|
||||
cameraUI.state = "PhotoCapture"
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Camera {
|
||||
id: camera
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width - stillControls.buttonsPanelWidth
|
||||
height: parent.height
|
||||
focus: visible //to receive focus and capture key events
|
||||
//captureResolution : "640x480"
|
||||
|
||||
flashMode: stillControls.flashMode
|
||||
whiteBalanceMode: stillControls.whiteBalance
|
||||
exposureCompensation: stillControls.exposureCompensation
|
||||
|
||||
onImageCaptured : {
|
||||
photoPreview.source = preview
|
||||
stillControls.previewAvailable = true
|
||||
cameraUI.state = "PhotoPreview"
|
||||
}
|
||||
}
|
||||
|
||||
CaptureControls {
|
||||
id: stillControls
|
||||
anchors.fill: parent
|
||||
camera: camera
|
||||
onPreviewSelected: cameraUI.state = "PhotoPreview"
|
||||
}
|
||||
|
||||
}
|
||||
18
examples/declarative-camera/declarative-camera.qmlproject
Normal file
@@ -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" ]
|
||||
}
|
||||
28
examples/declarative-camera/declarative-camera.qrc
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0">
|
||||
|
||||
<qresource prefix="/">
|
||||
<file>declarative-camera.qml</file>
|
||||
<file>CameraButton.qml</file>
|
||||
<file>CameraPropertyPopup.qml</file>
|
||||
<file>CameraPropertyButton.qml</file>
|
||||
<file>CaptureControls.qml</file>
|
||||
<file>ExposureCompensationButton.qml</file>
|
||||
<file>FlickableList.qml</file>
|
||||
<file>FocusButton.qml</file>
|
||||
<file>PhotoPreview.qml</file>
|
||||
<file>ZoomControl.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>
|
||||
BIN
examples/declarative-camera/images/camera_auto_mode.png
Normal file
|
After Width: | Height: | Size: 778 B |
BIN
examples/declarative-camera/images/camera_camera_setting.png
Normal file
|
After Width: | Height: | Size: 717 B |
BIN
examples/declarative-camera/images/camera_flash_auto.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
examples/declarative-camera/images/camera_flash_fill.png
Normal file
|
After Width: | Height: | Size: 610 B |
BIN
examples/declarative-camera/images/camera_flash_off.png
Normal file
|
After Width: | Height: | Size: 717 B |
BIN
examples/declarative-camera/images/camera_flash_redeye.png
Normal file
|
After Width: | Height: | Size: 945 B |
|
After Width: | Height: | Size: 625 B |
|
After Width: | Height: | Size: 554 B |
|
After Width: | Height: | Size: 600 B |
|
After Width: | Height: | Size: 587 B |
BIN
examples/declarative-camera/images/toolbutton.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
5
examples/declarative-camera/images/toolbutton.sci
Normal file
@@ -0,0 +1,5 @@
|
||||
border.left: 15
|
||||
border.top: 4
|
||||
border.bottom: 4
|
||||
border.right: 15
|
||||
source: toolbutton.png
|
||||
95
examples/declarative-camera/qmlcamera.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Mobility Components.
|
||||
**
|
||||
** $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 Nokia Corporation 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 <QtGui/QApplication>
|
||||
#include <QtGui/QDesktopWidget>
|
||||
#include <QtDeclarative/QDeclarativeView>
|
||||
#include <QtDeclarative/QDeclarativeEngine>
|
||||
|
||||
#if !defined(QT_NO_OPENGL)
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_SYMBIAN
|
||||
#include "camerakeyevent_symbian.h"
|
||||
#endif // Q_OS_SYMBIAN
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
#if defined (Q_WS_X11) || defined (Q_WS_MAC) || defined (Q_OS_SYMBIAN)
|
||||
//### default to using raster graphics backend for now
|
||||
bool gsSpecified = false;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
QString arg = argv[i];
|
||||
if (arg == "-graphicssystem") {
|
||||
gsSpecified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gsSpecified)
|
||||
QApplication::setGraphicsSystem("raster");
|
||||
#endif
|
||||
|
||||
QApplication application(argc, argv);
|
||||
const QString mainQmlApp = QLatin1String("qrc:/declarative-camera.qml");
|
||||
QDeclarativeView view;
|
||||
#if !defined(QT_NO_OPENGL) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_S60)
|
||||
view.setViewport(new QGLWidget);
|
||||
#endif
|
||||
view.setSource(QUrl(mainQmlApp));
|
||||
view.setResizeMode(QDeclarativeView::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()));
|
||||
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
|
||||
view.setGeometry(application.desktop()->screenGeometry());
|
||||
view.showFullScreen();
|
||||
#ifdef Q_OS_SYMBIAN
|
||||
new QSymbianCameraKeyListener(&view);
|
||||
#endif // Q_OS_SYMBIAN
|
||||
#else
|
||||
view.setGeometry(QRect(100, 100, 800, 480));
|
||||
view.show();
|
||||
#endif
|
||||
return application.exec();
|
||||
}
|
||||
|
||||