summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-24 16:58:04 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-25 06:14:54 +0100
commit45659bd9031f99bf20ce2361a9a32d5805e7946c (patch)
treea8c3033ea86f6f24f9c18f3d1cdef9db02aece47
parentebeea66e82723d9d0f91438998ae1034a94d5546 (diff)
Add a feedback control for Camera.
To control capture sounds etc. Change-Id: I4db63587be9c74f78c93081d9d46477e34f4a042 Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
-rw-r--r--src/multimedia/controls/controls.pri2
-rw-r--r--src/multimedia/controls/qcamerafeedbackcontrol.cpp183
-rw-r--r--src/multimedia/controls/qcamerafeedbackcontrol.h102
3 files changed, 287 insertions, 0 deletions
diff --git a/src/multimedia/controls/controls.pri b/src/multimedia/controls/controls.pri
index 98137dc0f..5f7bcbb3c 100644
--- a/src/multimedia/controls/controls.pri
+++ b/src/multimedia/controls/controls.pri
@@ -7,6 +7,7 @@ PUBLIC_HEADERS += \
controls/qcameracapturedestinationcontrol.h \
controls/qcameracontrol.h \
controls/qcameraexposurecontrol.h \
+ controls/qcamerafeedbackcontrol.h \
controls/qcameraflashcontrol.h \
controls/qcamerafocuscontrol.h \
controls/qcameraimagecapturecontrol.h \
@@ -36,6 +37,7 @@ SOURCES += \
controls/qcameracapturedestinationcontrol.cpp \
controls/qcameracontrol.cpp \
controls/qcameraexposurecontrol.cpp \
+ controls/qcamerafeedbackcontrol.cpp \
controls/qcameraflashcontrol.cpp \
controls/qcamerafocuscontrol.cpp \
controls/qcameraimagecapturecontrol.cpp \
diff --git a/src/multimedia/controls/qcamerafeedbackcontrol.cpp b/src/multimedia/controls/qcamerafeedbackcontrol.cpp
new file mode 100644
index 000000000..e56fd73b4
--- /dev/null
+++ b/src/multimedia/controls/qcamerafeedbackcontrol.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+#include "qcamerafeedbackcontrol.h"
+#include <private/qmediacontrol_p.h>
+
+/*!
+ \class QCameraFeedbackControl
+
+ \brief The QCameraFeedbackControl class allows controlling feedback (sounds etc) during camera operation
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \ingroup multimedia_control
+ \since 5.0
+
+ When using a camera, there are several times when some form of feedback to
+ the user is given - for example, when an image is taken, or when recording is started.
+ You can enable or disable some of this feedback, or adjust what sound might be played
+ for these actions.
+
+ In some cases it may be undesirable to play a sound effect - for example, when initiating
+ video recording the sound itself may be recorded.
+
+ \note In some countries or regions, feedback sounds or other indications (e.g. a red light) are
+ mandatory during camera operation. In these cases, you can check \c isEventFeedbackLocked to check
+ if that type of feedback can be modified. Any attempts to change a locked feedback type will be
+ ignored.
+
+ The interface name of QCameraFeedbackControl is \c com.nokia.Qt.QCameraFeedbackControl/1.0 as
+ defined in QCameraFeedbackControl_iid.
+
+ \sa QCamera
+*/
+
+/*!
+ \enum QCameraFeedbackControl::EventType
+
+ This enumeration describes certain events that occur during camera usage. You
+ can associate some form of feedback to be given when the event occurs, or check
+ whether feedback for this event is enabled or locked so that changes cannot be made.
+
+
+
+ \value ViewfinderStarted The viewfinder stream was started (even if not visible)
+ \value ViewfinderStopped The viewfinder stream was stopped
+ \value ImageCaptured An image was captured but not yet fully processed
+ \value ImageSaved An image is fully available and saved somewhere.
+ \value ImageError An error occurred while capturing an image
+ \value RecordingStarted Video recording has started
+ \value RecordingInProgress Video recording is in progress
+ \value RecordingStopped Video recording has stopped
+ \value AutoFocusInProgress The camera is trying to automatically focus
+ \value AutoFocusLocked The camera has automatically focused successfully
+ \value AutoFocusFailed The camera was unable to focus automatically
+*/
+
+/*!
+ \macro QCameraFeedbackControl_iid
+
+ \c com.nokia.Qt.QCameraFeedbackControl/1.0
+
+ Defines the interface name of the QCameraFeedbackControl class.
+
+ \relates QCameraFeedbackControl
+*/
+
+/*!
+ Constructs a camera feedback control object with \a parent.
+*/
+QCameraFeedbackControl::QCameraFeedbackControl(QObject *parent):
+ QMediaControl(*new QMediaControlPrivate, parent)
+{
+}
+
+/*!
+ Destroys the camera feedback control object.
+*/
+QCameraFeedbackControl::~QCameraFeedbackControl()
+{
+}
+
+/*!
+ \fn bool QCameraFeedbackControl::isEventFeedbackLocked(EventType event) const
+
+ Returns true if the feedback setting for \a event is locked. This may be true
+ because of legal compliance issues, or because configurability of this event's
+ feedback is not supported.
+
+ \since 5.0
+*/
+
+/*!
+ \fn bool QCameraFeedbackControl::isEventFeedbackEnabled(EventType event) const
+
+ Returns true if the feedback for \a event is enabled.
+
+ \since 5.0
+*/
+
+/*!
+ \fn bool QCameraFeedbackControl::setEventFeedbackEnabled(EventType event, bool enabled) const
+
+ Turns on feedback for the specific \a event if \a enabled is true, otherwise disables the
+ feedback. Returns true if the feedback could be modified, or false otherwise (e.g. this feedback
+ type is locked).
+
+ \since 5.0
+*/
+
+
+/*!
+ \fn void QCameraFeedbackControl::resetEventFeedback(EventType event) const
+
+ Restores the feedback setting for this \a event to its default setting.
+
+ \since 5.0
+*/
+
+/*!
+ \fn bool setEventFeedbackSound(EventType event, const QString &filePath)
+
+ When the given \a event occurs, the sound effect referenced by \a filePath
+ will be played instead of the default sound.
+
+ If this feedback type is locked, or if the supplied path is inaccessible,
+ this function will return false. In addition, some forms of feedback may
+ be non-auditory (e.g. a red light, or a vibration), and false may be
+ returned in this case.
+
+ The file referenced should be linear PCM (WAV format).
+
+ \note In the case that a valid file path to an unsupported file is given, this
+ function will return true but the feedback will use the original setting.
+
+ \since 5.0
+*/
+
+
+
+
+
+
diff --git a/src/multimedia/controls/qcamerafeedbackcontrol.h b/src/multimedia/controls/qcamerafeedbackcontrol.h
new file mode 100644
index 000000000..d22b8b80a
--- /dev/null
+++ b/src/multimedia/controls/qcamerafeedbackcontrol.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+#ifndef QCAMERAFEEDBACKCONTROL_H
+#define QCAMERAFEEDBACKCONTROL_H
+
+#include <qmediacontrol.h>
+#include <qmediaobject.h>
+
+#include <qcamera.h>
+#include <qmediaenumdebug.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class Q_MULTIMEDIA_EXPORT QCameraFeedbackControl : public QMediaControl
+{
+ Q_OBJECT
+
+public:
+ enum EventType {
+ ViewfinderStarted = 1,
+ ViewfinderStopped,
+ ImageCaptured,
+ ImageSaved,
+ ImageError,
+ RecordingStarted,
+ RecordingInProgress,
+ RecordingStopped,
+ AutoFocusInProgress,
+ AutoFocusLocked,
+ AutoFocusFailed
+ };
+
+ ~QCameraFeedbackControl();
+
+ virtual bool isEventFeedbackLocked(EventType) const = 0;
+
+ virtual bool isEventFeedbackEnabled(EventType) const = 0;
+
+ virtual bool setEventFeedbackEnabled(EventType, bool) = 0;
+ virtual void resetEventFeedback(EventType) = 0;
+
+ virtual bool setEventFeedbackSound(EventType, const QString &filePath) = 0;
+
+protected:
+ QCameraFeedbackControl(QObject* parent = 0);
+};
+
+#define QCameraFeedbackControl_iid "com.nokia.Qt.QCameraFeedbackControl/1.0"
+Q_MEDIA_DECLARE_CONTROL(QCameraFeedbackControl, QCameraFeedbackControl_iid)
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+
+#endif // QCAMERAFEEDBACKCONTROL_H