summaryrefslogtreecommitdiffstats
path: root/src/imports/multimedia/qdeclarativecamera.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/multimedia/qdeclarativecamera.cpp')
-rw-r--r--src/imports/multimedia/qdeclarativecamera.cpp119
1 files changed, 103 insertions, 16 deletions
diff --git a/src/imports/multimedia/qdeclarativecamera.cpp b/src/imports/multimedia/qdeclarativecamera.cpp
index c911c5e02..aac873b8e 100644
--- a/src/imports/multimedia/qdeclarativecamera.cpp
+++ b/src/imports/multimedia/qdeclarativecamera.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** 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.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -989,20 +989,34 @@ QDeclarativeMediaMetaData *QDeclarativeCamera::metaData()
}
/*!
+ \qmlpropertygroup QtMultimedia::Camera::viewfinder
\qmlproperty size QtMultimedia::Camera::viewfinder.resolution
+ \qmlproperty real QtMultimedia::Camera::viewfinder.minimumFrameRate
+ \qmlproperty real QtMultimedia::Camera::viewfinder.maximumFrameRate
- This property holds the resolution of the camera viewfinder. If no
- resolution is given the backend will use a default value.
+ These properties hold the viewfinder settings.
- \since 5.4
-*/
+ \c viewfinder.resolution holds the resolution of the camera viewfinder. If no
+ resolution is given or if it is empty, the backend uses a default value.
-/*!
- \qmlproperty real QtMultimedia::Camera::viewfinder.minimumFrameRate
- \qmlproperty real QtMultimedia::Camera::viewfinder.maximumFrameRate
+ \c viewfinder.minimumFrameRate holds the minimum frame rate for the viewfinder in
+ frames per second. If no value is given or if set to \c 0, the backend uses a default value.
+
+ \c viewfinder.maximumFrameRate holds the maximum frame rate for the viewfinder in
+ frames per second. If no value is given or if set to \c 0, the backend uses a default value.
+
+ If \c viewfinder.minimumFrameRate is equal to \c viewfinder.maximumFrameRate, the frame rate is
+ fixed. If not, the actual frame rate fluctuates between the two values.
- These properties hold the limits of the preferred frame rate for the
- viewfinder in frames per second.
+ Changing the viewfinder settings while the camera is in the \c Camera.ActiveState state may
+ cause the camera to be restarted.
+
+ If the camera is used to capture videos or images, the viewfinder settings might be
+ ignored if they conflict with the capture settings. You can check the actual viewfinder settings
+ once the camera is in the \c Camera.ActiveStatus status.
+
+ Supported values can be retrieved with supportedViewfinderResolutions() and
+ supportedViewfinderFrameRateRanges().
\since 5.4
*/
@@ -1015,6 +1029,79 @@ QDeclarativeCameraViewfinder *QDeclarativeCamera::viewfinder()
return m_viewfinder;
}
+/*!
+ \qmlmethod list<size> QtMultimedia::Camera::supportedViewfinderResolutions(real minimumFrameRate = undefined, real maximumFrameRate = undefined)
+
+ Returns a list of supported viewfinder resolutions.
+
+ If both optional parameters \a minimumFrameRate and \a maximumFrameRate are specified, the
+ returned list is reduced to resolutions supported for the given frame rate range.
+
+ The camera must be loaded before calling this function, otherwise the returned list
+ is empty.
+
+ \sa {QtMultimedia::Camera::viewfinder}{viewfinder}
+
+ \since 5.5
+*/
+QJSValue QDeclarativeCamera::supportedViewfinderResolutions(qreal minimumFrameRate, qreal maximumFrameRate)
+{
+ QQmlEngine *engine = qmlEngine(this);
+
+ QCameraViewfinderSettings settings;
+ settings.setMinimumFrameRate(minimumFrameRate);
+ settings.setMaximumFrameRate(maximumFrameRate);
+ QList<QSize> resolutions = m_camera->supportedViewfinderResolutions(settings);
+
+ QJSValue supportedResolutions = engine->newArray(resolutions.count());
+ int i = 0;
+ Q_FOREACH (const QSize &resolution, resolutions) {
+ QJSValue size = engine->newObject();
+ size.setProperty(QStringLiteral("width"), resolution.width());
+ size.setProperty(QStringLiteral("height"), resolution.height());
+ supportedResolutions.setProperty(i++, size);
+ }
+
+ return supportedResolutions;
+}
+
+/*!
+ \qmlmethod list<object> QtMultimedia::Camera::supportedViewfinderFrameRateRanges(size resolution = undefined)
+
+ Returns a list of supported viewfinder frame rate ranges.
+
+ Each range object in the list has the \c minimumFrameRate and \c maximumFrameRate properties.
+
+ If the optional parameter \a resolution is specified, the returned list is reduced to frame rate
+ ranges supported for the given \a resolution.
+
+ The camera must be loaded before calling this function, otherwise the returned list
+ is empty.
+
+ \sa {QtMultimedia::Camera::viewfinder}{viewfinder}
+
+ \since 5.5
+*/
+QJSValue QDeclarativeCamera::supportedViewfinderFrameRateRanges(const QSize &resolution)
+{
+ QQmlEngine *engine = qmlEngine(this);
+
+ QCameraViewfinderSettings settings;
+ settings.setResolution(resolution);
+ QList<QCamera::FrameRateRange> frameRateRanges = m_camera->supportedViewfinderFrameRateRanges(settings);
+
+ QJSValue supportedFrameRateRanges = engine->newArray(frameRateRanges.count());
+ int i = 0;
+ Q_FOREACH (const QCamera::FrameRateRange &frameRateRange, frameRateRanges) {
+ QJSValue range = engine->newObject();
+ range.setProperty(QStringLiteral("minimumFrameRate"), frameRateRange.first);
+ range.setProperty(QStringLiteral("maximumFrameRate"), frameRateRange.second);
+ supportedFrameRateRanges.setProperty(i++, range);
+ }
+
+ return supportedFrameRateRanges;
+}
+
QT_END_NAMESPACE
#include "moc_qdeclarativecamera_p.cpp"