Removed camera simulator backend.
It's not used on any Qt5 platform. Change-Id: Ia5a97523c84fe273a265355cc51a1cfa68701085 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
6390157fd7
commit
7d826e38e7
@@ -17,8 +17,6 @@ win32 {
|
||||
contains(config_test_wmf, yes) : SUBDIRS += wmf
|
||||
}
|
||||
|
||||
simulator: SUBDIRS += simulator
|
||||
|
||||
unix:!mac {
|
||||
contains(config_test_gstreamer, yes) {
|
||||
SUBDIRS += gstreamer
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
INCLUDEPATH += $$PWD \
|
||||
$${SOURCE_DIR}/src/multimedia
|
||||
|
||||
INCLUDEPATH += camera
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/simulatorcameraservice.h \
|
||||
$$PWD/simulatorcamerasession.h \
|
||||
$$PWD/simulatorcameracontrol.h \
|
||||
$$PWD/simulatorvideorenderercontrol.h \
|
||||
$$PWD/simulatorvideoinputdevicecontrol.h \
|
||||
$$PWD/simulatorcameraimagecapturecontrol.h \
|
||||
$$PWD/simulatorcameraexposurecontrol.h \
|
||||
$$PWD/simulatorcamerasettings.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/simulatorcameraservice.cpp \
|
||||
$$PWD/simulatorcamerasession.cpp \
|
||||
$$PWD/simulatorcameracontrol.cpp \
|
||||
$$PWD/simulatorvideorenderercontrol.cpp \
|
||||
$$PWD/simulatorvideoinputdevicecontrol.cpp \
|
||||
$$PWD/simulatorcameraimagecapturecontrol.cpp \
|
||||
$$PWD/simulatorcameraexposurecontrol.cpp \
|
||||
$$PWD/simulatorcamerasettings.cpp
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "simulatorcameracontrol.h"
|
||||
|
||||
#include <QtCore/qfile.h>
|
||||
|
||||
SimulatorCameraControl::SimulatorCameraControl(SimulatorCameraSession *session)
|
||||
:QCameraControl(session),
|
||||
m_session(session),
|
||||
mState(QCamera::UnloadedState),
|
||||
mStatus(QCamera::UnloadedStatus)
|
||||
{
|
||||
}
|
||||
|
||||
SimulatorCameraControl::~SimulatorCameraControl()
|
||||
{
|
||||
}
|
||||
|
||||
QCamera::CaptureModes SimulatorCameraControl::captureMode() const
|
||||
{
|
||||
return m_session->captureMode();
|
||||
}
|
||||
|
||||
void SimulatorCameraControl::setCaptureMode(QCamera::CaptureModes mode)
|
||||
{
|
||||
if (m_session->captureMode() != mode) {
|
||||
m_session->setCaptureMode(mode);
|
||||
emit captureModeChanged(mode);
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorCameraControl::setState(QCamera::State state)
|
||||
{
|
||||
if (mState == state) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Simulator only supports these status
|
||||
Q_ASSERT(mStatus == QCamera::UnloadedStatus || mStatus == QCamera::LoadedStatus
|
||||
|| mStatus == QCamera::ActiveStatus);
|
||||
|
||||
switch (state) {
|
||||
case QCamera::UnloadedState: // To UnloadedState - Release resources
|
||||
switch (mStatus) {
|
||||
case QCamera::LoadedStatus:
|
||||
// Unload
|
||||
break;
|
||||
case QCamera::ActiveStatus:
|
||||
// Stop and Unload
|
||||
emit stopCamera();
|
||||
break;
|
||||
default:
|
||||
// Unrecognized internal state (Status)
|
||||
return;
|
||||
}
|
||||
mStatus = QCamera::UnloadedStatus;
|
||||
emit statusChanged(mStatus);
|
||||
break;
|
||||
|
||||
case QCamera::LoadedState: // To LoadedState - Reserve resources OR Stop ViewFinder and Cancel Capture
|
||||
switch (mStatus) {
|
||||
case QCamera::UnloadedStatus:
|
||||
// Load
|
||||
mStatus = QCamera::LoadingStatus;
|
||||
emit statusChanged(mStatus);
|
||||
break;
|
||||
case QCamera::ActiveStatus:
|
||||
// Stop
|
||||
emit stopCamera();
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unregocnized internal state (Status)
|
||||
return;
|
||||
}
|
||||
mStatus = QCamera::LoadedStatus;
|
||||
emit statusChanged(mStatus);
|
||||
break;
|
||||
|
||||
case QCamera::ActiveState: // To ActiveState - (Reserve Resources and) Start ViewFinder
|
||||
switch (mStatus) {
|
||||
case QCamera::UnloadedStatus:
|
||||
// Load and Start (setting state handles starting)
|
||||
mStatus = QCamera::LoadingStatus;
|
||||
emit statusChanged(mStatus);
|
||||
mStatus = QCamera::LoadedStatus;
|
||||
emit statusChanged(mStatus);
|
||||
mStatus = QCamera::StartingStatus;
|
||||
emit statusChanged(mStatus);
|
||||
emit startCamera();
|
||||
break;
|
||||
case QCamera::LoadedStatus:
|
||||
// Start
|
||||
mStatus = QCamera::StartingStatus;
|
||||
emit statusChanged(mStatus);
|
||||
emit startCamera();
|
||||
break;
|
||||
default:
|
||||
// Unregocnized internal state (Status)
|
||||
return;
|
||||
}
|
||||
mStatus = QCamera::ActiveStatus;
|
||||
emit statusChanged(mStatus);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
mState = state;
|
||||
emit stateChanged(mState);
|
||||
}
|
||||
|
||||
QCamera::State SimulatorCameraControl::state() const
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
|
||||
bool SimulatorCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
|
||||
{
|
||||
Q_UNUSED(status);
|
||||
|
||||
switch (changeType) {
|
||||
case QCameraControl::CaptureMode:
|
||||
case QCameraControl::Viewfinder:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SimulatorCameraControl::isCaptureModeSupported(QCamera::CaptureModes mode) const
|
||||
{
|
||||
return mode == QCamera::CaptureStillImage;
|
||||
}
|
||||
|
||||
QCamera::Status SimulatorCameraControl::status() const
|
||||
{
|
||||
return mStatus;
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORCAMERACONTROL_H
|
||||
#define SIMULATORCAMERACONTROL_H
|
||||
|
||||
#include <QHash>
|
||||
#include <qcameracontrol.h>
|
||||
#include "simulatorcamerasession.h"
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
class SimulatorCameraControl : public QCameraControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimulatorCameraControl(SimulatorCameraSession *session );
|
||||
virtual ~SimulatorCameraControl();
|
||||
|
||||
bool isValid() const { return true; }
|
||||
|
||||
QCamera::State state() const;
|
||||
void setState(QCamera::State state);
|
||||
|
||||
QCamera::Status status() const;
|
||||
|
||||
QCamera::CaptureModes captureMode() const;
|
||||
void setCaptureMode(QCamera::CaptureModes mode);
|
||||
|
||||
bool isCaptureModeSupported(QCamera::CaptureModes mode) const;
|
||||
|
||||
bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const;
|
||||
|
||||
signals:
|
||||
void startCamera();
|
||||
void stopCamera();
|
||||
|
||||
private:
|
||||
void updateSupportedResolutions(const QString &device);
|
||||
|
||||
SimulatorCameraSession *m_session;
|
||||
QCamera::State mState;
|
||||
QCamera::Status mStatus;
|
||||
bool m_reloadPending;
|
||||
};
|
||||
|
||||
#endif // CAMERACONTROL_H
|
||||
@@ -1,519 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 <QtCore/qstring.h>
|
||||
|
||||
#include "simulatorcameraexposurecontrol.h"
|
||||
#include "simulatorcamerasession.h"
|
||||
|
||||
SimulatorCameraExposureControl::SimulatorCameraExposureControl(SimulatorCameraSession *session, QObject *parent) :
|
||||
QCameraExposureControl(parent),
|
||||
mExposureMode(QCameraExposure::ExposureAuto),
|
||||
mMeteringMode(QCameraExposure::MeteringAverage),
|
||||
mSpot(0.5, 0.5),
|
||||
mSession(session),
|
||||
mSettings(0)
|
||||
{
|
||||
mSettings = mSession->settings();
|
||||
|
||||
connect(mSettings, SIGNAL(apertureChanged()), this, SLOT(apertureChanged()));
|
||||
connect(mSettings, SIGNAL(apertureRangeChanged()), this, SLOT(apertureRangeChanged()));
|
||||
connect(mSettings, SIGNAL(shutterSpeedChanged()), this, SLOT(shutterSpeedChanged()));
|
||||
connect(mSettings, SIGNAL(isoSensitivityChanged()), this, SLOT(isoSensitivityChanged()));
|
||||
}
|
||||
|
||||
SimulatorCameraExposureControl::~SimulatorCameraExposureControl()
|
||||
{
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::apertureChanged()
|
||||
{
|
||||
emit exposureParameterChanged(QCameraExposureControl::Aperture);
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::apertureRangeChanged()
|
||||
{
|
||||
emit exposureParameterRangeChanged(QCameraExposureControl::Aperture);
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::shutterSpeedChanged()
|
||||
{
|
||||
emit exposureParameterChanged(QCameraExposureControl::ShutterSpeed);
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::isoSensitivityChanged()
|
||||
{
|
||||
emit exposureParameterChanged(QCameraExposureControl::ISO);
|
||||
}
|
||||
|
||||
QCameraExposure::ExposureMode SimulatorCameraExposureControl::exposureMode() const
|
||||
{
|
||||
return mExposureMode;
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::setExposureMode(QCameraExposure::ExposureMode mode)
|
||||
{
|
||||
if (isExposureModeSupported(mode))
|
||||
mExposureMode = mode;
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
|
||||
{
|
||||
switch (mode) {
|
||||
case QCameraExposure::ExposureAuto:
|
||||
case QCameraExposure::ExposureManual:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QCameraExposure::MeteringMode SimulatorCameraExposureControl::meteringMode() const
|
||||
{
|
||||
return mMeteringMode;
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::setMeteringMode(QCameraExposure::MeteringMode mode)
|
||||
{
|
||||
if (isMeteringModeSupported(mode))
|
||||
mMeteringMode = mode;
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
|
||||
{
|
||||
switch (mode) {
|
||||
case QCameraExposure::MeteringAverage:
|
||||
case QCameraExposure::MeteringSpot:
|
||||
case QCameraExposure::MeteringMatrix:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
|
||||
{
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO:
|
||||
case QCameraExposureControl::Aperture:
|
||||
case QCameraExposureControl::ShutterSpeed:
|
||||
case QCameraExposureControl::ExposureCompensation:
|
||||
case QCameraExposureControl::SpotMeteringPoint:
|
||||
return true;
|
||||
case QCameraExposureControl::FlashPower:
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant SimulatorCameraExposureControl::exposureParameter(ExposureParameter parameter) const
|
||||
{
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO:
|
||||
return QVariant(isoSensitivity());
|
||||
case QCameraExposureControl::Aperture:
|
||||
return QVariant(aperture());
|
||||
case QCameraExposureControl::ShutterSpeed:
|
||||
return QVariant(shutterSpeed());
|
||||
case QCameraExposureControl::ExposureCompensation:
|
||||
return QVariant(exposureCompensation());
|
||||
|
||||
case QCameraExposureControl::SpotMeteringPoint:
|
||||
return mSpot;
|
||||
|
||||
case QCameraExposureControl::FlashPower:
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
// Not supported
|
||||
return QVariant();
|
||||
|
||||
default:
|
||||
// Not supported
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
QCameraExposureControl::ParameterFlags SimulatorCameraExposureControl::exposureParameterFlags(ExposureParameter parameter) const
|
||||
{
|
||||
QCameraExposureControl::ParameterFlags flags;
|
||||
|
||||
/*
|
||||
* ISO, Aperture, ShutterSpeed:
|
||||
* - Automatic/Manual
|
||||
* - Read/Write
|
||||
* - Discrete range
|
||||
*
|
||||
* ExposureCompensation:
|
||||
* - Automatic/Manual
|
||||
* - Read/Write
|
||||
* - Continuous range
|
||||
*
|
||||
* FlashPower, FlashCompensation:
|
||||
* - Not supported
|
||||
*/
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO:
|
||||
case QCameraExposureControl::Aperture:
|
||||
case QCameraExposureControl::ShutterSpeed:
|
||||
flags |= QCameraExposureControl::AutomaticValue;
|
||||
break;
|
||||
case QCameraExposureControl::ExposureCompensation:
|
||||
flags |= QCameraExposureControl::AutomaticValue;
|
||||
flags |= QCameraExposureControl::ContinuousRange;
|
||||
break;
|
||||
case QCameraExposureControl::FlashPower:
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
// Do nothing - no flags
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing - no flags
|
||||
break;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
QVariantList SimulatorCameraExposureControl::supportedParameterRange(ExposureParameter parameter) const
|
||||
{
|
||||
QVariantList valueList;
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO: {
|
||||
QList<int> exposureValues = mSettings->supportedIsoSensitivities();
|
||||
for (int i = 0; i < exposureValues.count(); ++i) {
|
||||
valueList.append(QVariant(exposureValues[i]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QCameraExposureControl::Aperture: {
|
||||
QList<qreal> apertureValues = mSettings->supportedApertures();
|
||||
for (int i = 0; i < apertureValues.count(); ++i) {
|
||||
valueList.append(QVariant(apertureValues[i]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QCameraExposureControl::ShutterSpeed: {
|
||||
QList<qreal> shutterSpeedValues = mSettings->supportedShutterSpeeds();
|
||||
for (int i = 0; i < shutterSpeedValues.count(); ++i) {
|
||||
valueList.append(QVariant(shutterSpeedValues[i]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QCameraExposureControl::ExposureCompensation: {
|
||||
QList<qreal> evValues = mSettings->supportedExposureCompensationValues();
|
||||
for (int i = 0; i < evValues.count(); ++i) {
|
||||
valueList.append(QVariant(evValues[i]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QCameraExposureControl::FlashPower:
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
// Not supported
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not supported
|
||||
return QVariantList();
|
||||
}
|
||||
|
||||
return valueList;
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::setExposureParameter(ExposureParameter parameter, const QVariant& value)
|
||||
{
|
||||
bool useDefaultValue = false;
|
||||
|
||||
if (value.isNull())
|
||||
useDefaultValue = true;
|
||||
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO:
|
||||
if (useDefaultValue) {
|
||||
setAutoIsoSensitivity();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return setManualIsoSensitivity(value.toInt());
|
||||
|
||||
case QCameraExposureControl::Aperture:
|
||||
if (useDefaultValue) {
|
||||
setAutoAperture();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return setManualAperture(value.toReal());
|
||||
|
||||
case QCameraExposureControl::ShutterSpeed:
|
||||
if (useDefaultValue) {
|
||||
setAutoShutterSpeed();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return setManualShutterSpeed(value.toReal());
|
||||
|
||||
case QCameraExposureControl::ExposureCompensation:
|
||||
if (useDefaultValue) {
|
||||
setAutoExposureCompensation();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return setManualExposureCompensation(value.toReal());
|
||||
|
||||
case QCameraExposureControl::FlashPower:
|
||||
return false;
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
return false;
|
||||
|
||||
case QCameraExposureControl::SpotMeteringPoint:
|
||||
{
|
||||
static QRectF valid(0, 0, 1, 1);
|
||||
if (valid.contains(value.toPointF())) {
|
||||
mSpot = value.toPointF();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default:
|
||||
// Not supported
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QString SimulatorCameraExposureControl::extendedParameterName(ExposureParameter parameter)
|
||||
{
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO:
|
||||
return QString("ISO Sensitivity");
|
||||
case QCameraExposureControl::Aperture:
|
||||
return QString("Aperture");
|
||||
case QCameraExposureControl::ShutterSpeed:
|
||||
return QString("Shutter Speed");
|
||||
case QCameraExposureControl::ExposureCompensation:
|
||||
return QString("Exposure Compensation");
|
||||
case QCameraExposureControl::FlashPower:
|
||||
return QString("Flash Power");
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
return QString("Flash Compensation");
|
||||
case QCameraExposureControl::SpotMeteringPoint:
|
||||
return QString("Spot Metering Point");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
int SimulatorCameraExposureControl::isoSensitivity() const
|
||||
{
|
||||
return mSettings->isoSensitivity();
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isIsoSensitivitySupported(const int iso) const
|
||||
{
|
||||
return mSettings->supportedIsoSensitivities().contains(iso);
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::setManualIsoSensitivity(int iso)
|
||||
{
|
||||
if (isIsoSensitivitySupported(iso)) {
|
||||
mSettings->setManualIsoSensitivity(iso);
|
||||
return true;
|
||||
} else {
|
||||
QList<int> supportedIsoValues = mSettings->supportedIsoSensitivities();
|
||||
int minIso = supportedIsoValues.first();
|
||||
int maxIso = supportedIsoValues.last();
|
||||
|
||||
if (iso < minIso) { // Smaller than minimum
|
||||
iso = minIso;
|
||||
} else if (iso > maxIso) { // Bigger than maximum
|
||||
iso = maxIso;
|
||||
} else { // Find closest
|
||||
int indexOfClosest = 0;
|
||||
int smallestDiff = 10000000; // Sensible max diff
|
||||
for(int i = 0; i < supportedIsoValues.count(); ++i) {
|
||||
int currentDiff = qAbs(iso - supportedIsoValues[i]);
|
||||
if(currentDiff < smallestDiff) {
|
||||
smallestDiff = currentDiff;
|
||||
indexOfClosest = i;
|
||||
}
|
||||
}
|
||||
iso = supportedIsoValues[indexOfClosest];
|
||||
}
|
||||
mSettings->setManualIsoSensitivity(iso);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::setAutoIsoSensitivity()
|
||||
{
|
||||
mSettings->setAutoIsoSensitivity();
|
||||
}
|
||||
|
||||
|
||||
qreal SimulatorCameraExposureControl::aperture() const
|
||||
{
|
||||
return mSettings->aperture();
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isApertureSupported(const qreal aperture) const
|
||||
{
|
||||
return mSettings->supportedApertures().contains(aperture);
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::setManualAperture(qreal aperture)
|
||||
{
|
||||
if (isApertureSupported(aperture)) {
|
||||
mSettings->setManualAperture(aperture);
|
||||
return true;
|
||||
} else {
|
||||
QList<qreal> supportedApertureValues = mSettings->supportedApertures();
|
||||
qreal minAperture = supportedApertureValues.first();
|
||||
qreal maxAperture = supportedApertureValues.last();
|
||||
|
||||
if (aperture < minAperture) { // Smaller than minimum
|
||||
aperture = minAperture;
|
||||
} else if (aperture > maxAperture) { // Bigger than maximum
|
||||
aperture = maxAperture;
|
||||
} else { // Find closest
|
||||
int indexOfClosest = 0;
|
||||
qreal smallestDiff = 100000000; // Sensible max diff
|
||||
for(int i = 0; i < supportedApertureValues.count(); ++i) {
|
||||
qreal currentDiff = qAbs(aperture - supportedApertureValues[i]);
|
||||
if(currentDiff < smallestDiff) {
|
||||
smallestDiff = currentDiff;
|
||||
indexOfClosest = i;
|
||||
}
|
||||
}
|
||||
aperture = supportedApertureValues[indexOfClosest];
|
||||
}
|
||||
mSettings->setManualAperture(aperture);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::setAutoAperture()
|
||||
{
|
||||
mSettings->setAutoAperture();
|
||||
}
|
||||
|
||||
qreal SimulatorCameraExposureControl::shutterSpeed() const
|
||||
{
|
||||
return mSettings->shutterSpeed();
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isShutterSpeedSupported(const qreal seconds) const
|
||||
{
|
||||
return mSettings->supportedShutterSpeeds().contains(seconds);
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::setManualShutterSpeed(qreal seconds)
|
||||
{
|
||||
if (isShutterSpeedSupported(seconds)) {
|
||||
mSettings->setManualShutterSpeed(seconds);
|
||||
return true;
|
||||
} else {
|
||||
QList<qreal> supportedShutterSpeeds = mSettings->supportedShutterSpeeds();
|
||||
|
||||
qreal minShutterSpeed = supportedShutterSpeeds.first();
|
||||
qreal maxShutterSpeed = supportedShutterSpeeds.last();
|
||||
|
||||
if (seconds < minShutterSpeed) { // Smaller than minimum
|
||||
seconds = minShutterSpeed;
|
||||
} else if (seconds > maxShutterSpeed) { // Bigger than maximum
|
||||
seconds = maxShutterSpeed;
|
||||
} else { // Find closest
|
||||
int indexOfClosest = 0;
|
||||
qreal smallestDiff = 100000000; // Sensible max diff
|
||||
for(int i = 0; i < supportedShutterSpeeds.count(); ++i) {
|
||||
qreal currentDiff = qAbs(seconds - supportedShutterSpeeds[i]);
|
||||
if(currentDiff < smallestDiff) {
|
||||
smallestDiff = currentDiff;
|
||||
indexOfClosest = i;
|
||||
}
|
||||
}
|
||||
seconds = supportedShutterSpeeds[indexOfClosest];
|
||||
}
|
||||
mSettings->setManualShutterSpeed(seconds);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::setAutoShutterSpeed()
|
||||
{
|
||||
mSettings->setAutoShutterSpeed();
|
||||
}
|
||||
|
||||
qreal SimulatorCameraExposureControl::exposureCompensation() const
|
||||
{
|
||||
return mSettings->exposureCompensation();
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::isExposureCompensationSupported(const qreal ev) const
|
||||
{
|
||||
QList<qreal> supportedValues = mSettings->supportedExposureCompensationValues();
|
||||
return (ev >= supportedValues.first() && ev <= supportedValues.last());
|
||||
}
|
||||
|
||||
bool SimulatorCameraExposureControl::setManualExposureCompensation(qreal ev)
|
||||
{
|
||||
if (isExposureCompensationSupported(ev)) {
|
||||
mSettings->setExposureCompensation(ev);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimulatorCameraExposureControl::setAutoExposureCompensation()
|
||||
{
|
||||
mSettings->setAutoExposureCompensation();
|
||||
}
|
||||
|
||||
// End of file
|
||||
@@ -1,126 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORCAMERAEXPOSURECONTROL_H
|
||||
#define SIMULATORCAMERAEXPOSURECONTROL_H
|
||||
|
||||
#include <qcameraexposurecontrol.h>
|
||||
|
||||
#include "simulatorcamerasettings.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class SimulatorCameraSession;
|
||||
|
||||
/*
|
||||
* Control for exposure related camera operation.
|
||||
*/
|
||||
class SimulatorCameraExposureControl : public QCameraExposureControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
SimulatorCameraExposureControl(SimulatorCameraSession *session, QObject *parent = 0);
|
||||
~SimulatorCameraExposureControl();
|
||||
|
||||
// QCameraExposureControl
|
||||
// Exposure Mode
|
||||
QCameraExposure::ExposureMode exposureMode() const;
|
||||
void setExposureMode(QCameraExposure::ExposureMode mode);
|
||||
bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const;
|
||||
|
||||
// Metering Mode
|
||||
QCameraExposure::MeteringMode meteringMode() const;
|
||||
void setMeteringMode(QCameraExposure::MeteringMode mode);
|
||||
bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const;
|
||||
|
||||
// Exposure Parameter
|
||||
bool isParameterSupported(ExposureParameter parameter) const;
|
||||
QVariant exposureParameter(ExposureParameter parameter) const;
|
||||
QCameraExposureControl::ParameterFlags exposureParameterFlags(ExposureParameter parameter) const;
|
||||
QVariantList supportedParameterRange(ExposureParameter parameter) const;
|
||||
bool setExposureParameter(ExposureParameter parameter, const QVariant& value);
|
||||
|
||||
QString extendedParameterName(ExposureParameter parameter);
|
||||
|
||||
private Q_SLOTS: // Internal Slots
|
||||
void apertureChanged();
|
||||
void apertureRangeChanged();
|
||||
void shutterSpeedChanged();
|
||||
void isoSensitivityChanged();
|
||||
|
||||
private: // Internal - Implementing ExposureParameter
|
||||
// ISO Sensitivity
|
||||
int isoSensitivity() const;
|
||||
bool setManualIsoSensitivity(int iso);
|
||||
void setAutoIsoSensitivity();
|
||||
bool isIsoSensitivitySupported(const int iso) const;
|
||||
|
||||
// Aperture
|
||||
qreal aperture() const;
|
||||
bool setManualAperture(qreal aperture);
|
||||
void setAutoAperture();
|
||||
bool isApertureSupported(const qreal aperture) const;
|
||||
|
||||
// Shutter Speed
|
||||
qreal shutterSpeed() const;
|
||||
bool setManualShutterSpeed(qreal seconds);
|
||||
void setAutoShutterSpeed();
|
||||
bool isShutterSpeedSupported(const qreal seconds) const;
|
||||
|
||||
// Exposure Compensation
|
||||
qreal exposureCompensation() const;
|
||||
bool setManualExposureCompensation(qreal ev);
|
||||
void setAutoExposureCompensation();
|
||||
bool isExposureCompensationSupported(const qreal ev) const;
|
||||
|
||||
private: // Data
|
||||
QCameraExposure::ExposureMode mExposureMode;
|
||||
QCameraExposure::MeteringMode mMeteringMode;
|
||||
QPointF mSpot;
|
||||
SimulatorCameraSession *mSession;
|
||||
SimulatorCameraSettings *mSettings;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // SIMULATORCAMERAEXPOSURECONTROL_H
|
||||
@@ -1,120 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 <QtCore/qstring.h>
|
||||
|
||||
#include "simulatorcameraimagecapturecontrol.h"
|
||||
#include "simulatorcameraservice.h"
|
||||
#include "simulatorcamerasession.h"
|
||||
#include "simulatorcameracontrol.h"
|
||||
|
||||
SimulatorCameraImageCaptureControl::SimulatorCameraImageCaptureControl(SimulatorCameraSession *session, SimulatorCameraService *service) :
|
||||
QCameraImageCaptureControl(service),
|
||||
mReadyForCapture(true),
|
||||
m_driveMode(QCameraImageCapture::SingleImageCapture) // Default DriveMode
|
||||
{
|
||||
m_session = session;
|
||||
|
||||
m_service = service;
|
||||
m_cameraControl = qobject_cast<SimulatorCameraControl *>(m_service->requestControl(QCameraControl_iid));
|
||||
|
||||
// Chain these signals from session class
|
||||
connect(m_session, SIGNAL(imageCaptured(const int, QImage)),
|
||||
this, SIGNAL(imageCaptured(const int, QImage)));
|
||||
connect(m_session, SIGNAL(imageSaved(const int, const QString&)),
|
||||
this, SIGNAL(imageSaved(const int, const QString&)));
|
||||
connect(m_session, SIGNAL(imageExposed(int)),
|
||||
this, SIGNAL(imageExposed(int)));
|
||||
connect(m_session, SIGNAL(captureError(int, int, const QString&)),
|
||||
this, SIGNAL(error(int, int, const QString&)));
|
||||
}
|
||||
|
||||
SimulatorCameraImageCaptureControl::~SimulatorCameraImageCaptureControl()
|
||||
{
|
||||
}
|
||||
|
||||
bool SimulatorCameraImageCaptureControl::isReadyForCapture() const
|
||||
{
|
||||
if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mReadyForCapture;
|
||||
}
|
||||
|
||||
QCameraImageCapture::DriveMode SimulatorCameraImageCaptureControl::driveMode() const
|
||||
{
|
||||
return m_driveMode;
|
||||
}
|
||||
|
||||
void SimulatorCameraImageCaptureControl::setDriveMode(QCameraImageCapture::DriveMode mode)
|
||||
{
|
||||
if (mode != QCameraImageCapture::SingleImageCapture) {
|
||||
emit error(0, QCamera::NotSupportedFeatureError, tr("DriveMode not supported."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_driveMode = mode;
|
||||
}
|
||||
|
||||
int SimulatorCameraImageCaptureControl::capture(const QString &fileName)
|
||||
{
|
||||
if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage) {
|
||||
emit error(0, QCameraImageCapture::NotReadyError, tr("Incorrect CaptureMode."));
|
||||
return 0;
|
||||
}
|
||||
updateReadyForCapture(false);
|
||||
int imageId = m_session->captureImage(fileName);
|
||||
updateReadyForCapture(true);
|
||||
return imageId;
|
||||
}
|
||||
|
||||
void SimulatorCameraImageCaptureControl::cancelCapture()
|
||||
{
|
||||
}
|
||||
|
||||
void SimulatorCameraImageCaptureControl::updateReadyForCapture(bool ready)
|
||||
{
|
||||
mReadyForCapture = ready;
|
||||
emit readyForCaptureChanged(mReadyForCapture);
|
||||
}
|
||||
|
||||
// End of file
|
||||
@@ -1,87 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORCAMERAIMAGECAPTURECONTROL_H
|
||||
#define SIMULATORCAMERAIMAGECAPTURECONTROL_H
|
||||
|
||||
#include "qcameraimagecapturecontrol.h"
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
class SimulatorCameraService;
|
||||
class SimulatorCameraSession;
|
||||
class SimulatorCameraControl;
|
||||
|
||||
/*
|
||||
* Control for image capture operations.
|
||||
*/
|
||||
class SimulatorCameraImageCaptureControl : public QCameraImageCaptureControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public: // Contructors & Destrcutor
|
||||
|
||||
SimulatorCameraImageCaptureControl(SimulatorCameraSession *session, SimulatorCameraService *service);
|
||||
~SimulatorCameraImageCaptureControl();
|
||||
|
||||
public: // QCameraImageCaptureControl
|
||||
|
||||
bool isReadyForCapture() const;
|
||||
|
||||
// Drive Mode
|
||||
QCameraImageCapture::DriveMode driveMode() const;
|
||||
void setDriveMode(QCameraImageCapture::DriveMode mode);
|
||||
|
||||
// Capture
|
||||
int capture(const QString &fileName);
|
||||
void cancelCapture();
|
||||
|
||||
private:
|
||||
void updateReadyForCapture(bool ready);
|
||||
|
||||
bool mReadyForCapture;
|
||||
SimulatorCameraSession *m_session;
|
||||
SimulatorCameraService *m_service;
|
||||
SimulatorCameraControl *m_cameraControl;
|
||||
QCameraImageCapture::DriveMode m_driveMode;
|
||||
};
|
||||
|
||||
#endif // SIMULATORCAMERAIMAGECAPTURECONTROL_H
|
||||
@@ -1,161 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "simulatorcameraservice.h"
|
||||
#include "simulatorcamerasession.h"
|
||||
#include "simulatorcameracontrol.h"
|
||||
#include "simulatorcameraimagecapturecontrol.h"
|
||||
#include "simulatorcameraexposurecontrol.h"
|
||||
|
||||
#include "simulatorvideoinputdevicecontrol.h"
|
||||
#include "simulatorvideorenderercontrol.h"
|
||||
#include "../qsimulatormultimediaconnection_p.h"
|
||||
|
||||
#include <qmediaserviceprovider.h>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
QTM_USE_NAMESPACE;
|
||||
using namespace Simulator;
|
||||
|
||||
SimulatorCameraService::SimulatorCameraService(const QString &service, MultimediaConnection *multimediaConnection,
|
||||
QObject *parent):
|
||||
QMediaService(parent)
|
||||
{
|
||||
Q_UNUSED(service)
|
||||
mCaptureSession = new SimulatorCameraSession(this);
|
||||
mCameraControl = new SimulatorCameraControl(mCaptureSession);
|
||||
mVideoInputDeviceControl = new QSimulatorVideoInputDeviceControl(mCaptureSession);
|
||||
mVideoInputDeviceControl->updateDeviceList(get_qtCameraData());
|
||||
mVideoRendererControl = new SimulatorVideoRendererControl(mCaptureSession, this);
|
||||
mImageCaptureControl = new SimulatorCameraImageCaptureControl(mCaptureSession, this);
|
||||
mExposureControl = new SimulatorCameraExposureControl(mCaptureSession, this);
|
||||
|
||||
connect(multimediaConnection, SIGNAL(cameraDataChanged(QtMobility::QCameraData)),
|
||||
SLOT(updateCameraData(QtMobility::QCameraData)));
|
||||
connect(multimediaConnection, SIGNAL(cameraAdded(QString,QtMobility::QCameraData::QCameraDetails)),
|
||||
mVideoInputDeviceControl, SLOT(addDevice(QString,QtMobility::QCameraData::QCameraDetails)));
|
||||
connect(multimediaConnection, SIGNAL(cameraRemoved(QString)),
|
||||
mVideoInputDeviceControl, SLOT(removeDevice(QString)));
|
||||
connect(multimediaConnection, SIGNAL(cameraChanged(QString,QtMobility::QCameraData::QCameraDetails)),
|
||||
mVideoInputDeviceControl, SLOT(changeDevice(QString,QtMobility::QCameraData::QCameraDetails)));
|
||||
connect(multimediaConnection, SIGNAL(cameraChanged(QString,QtMobility::QCameraData::QCameraDetails)),
|
||||
SLOT(changeCamera(QString,QtMobility::QCameraData::QCameraDetails)));
|
||||
connect(mCameraControl, SIGNAL(startCamera()),
|
||||
mVideoRendererControl, SLOT(showImage()));
|
||||
connect(mCameraControl, SIGNAL(stopCamera()),
|
||||
mVideoRendererControl, SLOT(stop()));
|
||||
connect(mVideoInputDeviceControl, SIGNAL(selectedDeviceChanged(QString)),
|
||||
SLOT(updateCameraPicture(QString)));
|
||||
connect(mCaptureSession->settings(), SIGNAL(isoSensitivityChanged()), mVideoRendererControl, SLOT(showImage()));
|
||||
connect(mCaptureSession->settings(), SIGNAL(apertureChanged()), mVideoRendererControl, SLOT(showImage()));
|
||||
connect(mCaptureSession->settings(), SIGNAL(shutterSpeedChanged()), mVideoRendererControl, SLOT(showImage()));
|
||||
connect(mCaptureSession->settings(), SIGNAL(exposureCompensationChanged()), mVideoRendererControl, SLOT(showImage()));
|
||||
mCaptureSession->setImage(mVideoRendererControl->image());
|
||||
mVideoInputDeviceControl->setSelectedDevice(mVideoInputDeviceControl->defaultDevice());
|
||||
}
|
||||
|
||||
SimulatorCameraService::~SimulatorCameraService()
|
||||
{
|
||||
}
|
||||
|
||||
QMediaControl *SimulatorCameraService::requestControl(const char *name)
|
||||
{
|
||||
if (!mCaptureSession)
|
||||
return 0;
|
||||
|
||||
if (qstrcmp(name,QCameraControl_iid) == 0)
|
||||
return mCameraControl;
|
||||
|
||||
if (qstrcmp(name,QVideoDeviceControl_iid) == 0)
|
||||
return mVideoInputDeviceControl;
|
||||
|
||||
if (qstrcmp(name, QVideoRendererControl_iid) == 0)
|
||||
return mVideoRendererControl;
|
||||
|
||||
if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
|
||||
return mImageCaptureControl;
|
||||
|
||||
if (qstrcmp(name, QCameraExposureControl_iid) == 0)
|
||||
return mExposureControl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SimulatorCameraService::releaseControl(QMediaControl *control)
|
||||
{
|
||||
Q_UNUSED(control)
|
||||
}
|
||||
|
||||
void SimulatorCameraService::updateCameraData(const QtMobility::QCameraData &data)
|
||||
{
|
||||
mVideoInputDeviceControl->updateDeviceList(data);
|
||||
QString currentDevice = mVideoInputDeviceControl->deviceName(mVideoInputDeviceControl->selectedDevice());
|
||||
if (!data.cameras.contains(currentDevice))
|
||||
return;
|
||||
|
||||
updateCurrentDeviceImage(data.cameras.value(currentDevice).imagePath);
|
||||
}
|
||||
|
||||
void SimulatorCameraService::changeCamera(const QString &name, const QtMobility::QCameraData::QCameraDetails &details)
|
||||
{
|
||||
QString currentDevice = mVideoInputDeviceControl->deviceName(mVideoInputDeviceControl->selectedDevice());
|
||||
if (currentDevice != name)
|
||||
return;
|
||||
|
||||
updateCurrentDeviceImage(details.imagePath);
|
||||
}
|
||||
|
||||
void SimulatorCameraService::updateCameraPicture(const QString &name)
|
||||
{
|
||||
QtMobility::QCameraData data = QtMobility::get_qtCameraData();
|
||||
if (!data.cameras.contains(name))
|
||||
return;
|
||||
|
||||
updateCurrentDeviceImage(data.cameras.value(name).imagePath);
|
||||
}
|
||||
|
||||
void SimulatorCameraService::updateCurrentDeviceImage(const QString &imagePath)
|
||||
{
|
||||
mVideoRendererControl->setImagePath(imagePath);
|
||||
mCaptureSession->setImage(mVideoRendererControl->image());
|
||||
}
|
||||
|
||||
#include "moc_simulatorcameraservice.cpp"
|
||||
@@ -1,92 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORCAMERACAPTURESERVICE_H
|
||||
#define SIMULATORCAMERACAPTURESERVICE_H
|
||||
|
||||
#include <qmediaservice.h>
|
||||
|
||||
#include "../qsimulatormultimediaconnection_p.h"
|
||||
|
||||
QTM_BEGIN_NAMESPACE
|
||||
namespace Simulator {
|
||||
class MultimediaConnection;
|
||||
}
|
||||
QTM_END_NAMESPACE
|
||||
class SimulatorCameraSession;
|
||||
class SimulatorCameraControl;
|
||||
class SimulatorCameraImageCaptureControl;
|
||||
class SimulatorCameraExposureControl;
|
||||
class SimulatorVideoRendererControl;
|
||||
class QSimulatorVideoInputDeviceControl;
|
||||
|
||||
class SimulatorCameraService : public QMediaService
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SimulatorCameraService(const QString &service, QTM_PREPEND_NAMESPACE(Simulator::MultimediaConnection) *cameraConnection,
|
||||
QObject *parent = 0);
|
||||
virtual ~SimulatorCameraService();
|
||||
|
||||
QMediaControl *requestControl(const char *name);
|
||||
void releaseControl(QMediaControl *);
|
||||
|
||||
private slots:
|
||||
void updateCameraData(const QtMobility::QCameraData &data);
|
||||
void changeCamera(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
|
||||
void updateCameraPicture(const QString &name);
|
||||
|
||||
private:
|
||||
void updateCurrentDeviceImage(const QString &imagePath);
|
||||
SimulatorCameraSession *mCaptureSession;
|
||||
SimulatorCameraControl *mCameraControl;
|
||||
SimulatorCameraImageCaptureControl *mImageCaptureControl;
|
||||
SimulatorCameraExposureControl *mExposureControl;
|
||||
|
||||
QSimulatorVideoInputDeviceControl *mVideoInputDeviceControl;
|
||||
|
||||
QMediaControl *mVideoOutput;
|
||||
|
||||
SimulatorVideoRendererControl *mVideoRendererControl;
|
||||
};
|
||||
|
||||
#endif // CAMERACAPTURESERVICE_H
|
||||
@@ -1,147 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "simulatorcamerasession.h"
|
||||
#include "simulatorcamerasettings.h"
|
||||
#include "../qsimulatormultimediaconnection_p.h"
|
||||
#include <qmediarecorder.h>
|
||||
#include <qcameraimagecapture.h>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QtCore/qmetaobject.h>
|
||||
|
||||
#include <QtGui/qimage.h>
|
||||
|
||||
//#define CAMERA_DEBUG 1
|
||||
|
||||
SimulatorCameraSession::SimulatorCameraSession(QObject *parent)
|
||||
:QObject(parent),
|
||||
mViewfinder(0),
|
||||
mImage(0),
|
||||
mRequestId(0)
|
||||
{
|
||||
mSettings = new SimulatorCameraSettings(this);
|
||||
}
|
||||
|
||||
SimulatorCameraSession::~SimulatorCameraSession()
|
||||
{
|
||||
}
|
||||
|
||||
int SimulatorCameraSession::captureImage(const QString &fileName)
|
||||
{
|
||||
QTM_USE_NAMESPACE;
|
||||
++mRequestId;
|
||||
emit imageExposed(mRequestId);
|
||||
|
||||
QString actualFileName = fileName;
|
||||
if (actualFileName.isEmpty()) {
|
||||
actualFileName = generateFileName("img_", defaultDir(QCamera::CaptureStillImage), "jpg");
|
||||
}
|
||||
|
||||
emit imageCaptured(mRequestId, *mImage);
|
||||
|
||||
if (!mImage->save(actualFileName)) {
|
||||
emit captureError(mRequestId, QCameraImageCapture::ResourceError, "Could not save file");
|
||||
return mRequestId;
|
||||
}
|
||||
emit imageSaved(mRequestId, actualFileName);
|
||||
return mRequestId;
|
||||
}
|
||||
|
||||
void SimulatorCameraSession::setCaptureMode(QCamera::CaptureModes mode)
|
||||
{
|
||||
mCaptureMode = mode;
|
||||
}
|
||||
|
||||
QDir SimulatorCameraSession::defaultDir(QCamera::CaptureModes) const
|
||||
{
|
||||
const QString temp = QDir::tempPath();
|
||||
if (QFileInfo(temp).isWritable())
|
||||
return QDir(temp);
|
||||
|
||||
return QDir();
|
||||
}
|
||||
|
||||
QString SimulatorCameraSession::generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const
|
||||
{
|
||||
int lastClip = 0;
|
||||
foreach(QString fileName, dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext))) {
|
||||
int imgNumber = fileName.mid(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
|
||||
lastClip = qMax(lastClip, imgNumber);
|
||||
}
|
||||
|
||||
QString name = QString("%1%2.%3").arg(prefix)
|
||||
.arg(lastClip+1,
|
||||
4, //fieldWidth
|
||||
10,
|
||||
QLatin1Char('0'))
|
||||
.arg(ext);
|
||||
|
||||
return dir.absoluteFilePath(name);
|
||||
}
|
||||
|
||||
void SimulatorCameraSession::setViewfinder(QObject *viewfinder)
|
||||
{
|
||||
if (mViewfinder != viewfinder) {
|
||||
mViewfinder = viewfinder;
|
||||
emit viewfinderChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QCamera::CaptureModes SimulatorCameraSession::captureMode()
|
||||
{
|
||||
return mCaptureMode;
|
||||
}
|
||||
|
||||
void SimulatorCameraSession::setImage(const QImage *image)
|
||||
{
|
||||
mImage = image;
|
||||
}
|
||||
|
||||
QObject *SimulatorCameraSession::viewfinder() const
|
||||
{
|
||||
return mViewfinder;
|
||||
}
|
||||
|
||||
SimulatorCameraSettings *SimulatorCameraSession::settings() const
|
||||
{
|
||||
return mSettings;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORCAMERACAPTURESESSION_H
|
||||
#define SIMULATORCAMERACAPTURESESSION_H
|
||||
|
||||
#include <qmediarecordercontrol.h>
|
||||
|
||||
#include <QtCore/qurl.h>
|
||||
#include <QtCore/qdir.h>
|
||||
|
||||
#include "qcamera.h"
|
||||
|
||||
class SimulatorCameraSettings;
|
||||
|
||||
class SimulatorCameraSession : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimulatorCameraSession(QObject *parent);
|
||||
~SimulatorCameraSession();
|
||||
|
||||
QCamera::CaptureModes captureMode();
|
||||
void setCaptureMode(QCamera::CaptureModes mode);
|
||||
|
||||
QDir defaultDir(QCamera::CaptureModes mode) const;
|
||||
QString generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const;
|
||||
|
||||
void setImage(const QImage *image);
|
||||
QObject *viewfinder() const;
|
||||
void setViewfinder(QObject *viewfinder);
|
||||
|
||||
int captureImage(const QString &fileName);
|
||||
|
||||
SimulatorCameraSettings *settings() const;
|
||||
|
||||
signals:
|
||||
void stateChanged(QCamera::State state);
|
||||
void captureError(int id, int error, const QString &errorString);
|
||||
void error(int error, const QString &errorString);
|
||||
void imageExposed(int requestId);
|
||||
void imageCaptured(int requestId, const QImage &img);
|
||||
void imageSaved(int requestId, const QString &fileName);
|
||||
void viewfinderChanged();
|
||||
|
||||
private:
|
||||
QCamera::CaptureModes mCaptureMode;
|
||||
|
||||
QObject *mViewfinder;
|
||||
const QImage *mImage;
|
||||
|
||||
SimulatorCameraSettings *mSettings;
|
||||
|
||||
public:
|
||||
int mRequestId;
|
||||
};
|
||||
|
||||
#endif // SIMULATORCAMERACAPTURESESSION_H
|
||||
@@ -1,174 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "simulatorcamerasettings.h"
|
||||
|
||||
SimulatorCameraSettings::SimulatorCameraSettings(QObject *parent)
|
||||
: QObject(parent)
|
||||
, mIsoSensitivity(400)
|
||||
, mAperture(4)
|
||||
, mShutterSpeed(0.008)
|
||||
, mExposureCompensation(0)
|
||||
{
|
||||
mSupportedIsoSensitivities << 50 << 100 << 200 << 400 << 800;
|
||||
mSupportedApertures << 1.8 << 2.8 << 4 << 5.6 << 8;
|
||||
mSupportedShutterSpeeds << 0.002 << 0.004 << 0.008 << 1./60 << 1./30;
|
||||
mSupportedExposureCompensations << -2 << 2;
|
||||
}
|
||||
|
||||
SimulatorCameraSettings::~SimulatorCameraSettings()
|
||||
{
|
||||
}
|
||||
|
||||
int SimulatorCameraSettings::isoSensitivity() const
|
||||
{
|
||||
return mIsoSensitivity;
|
||||
}
|
||||
|
||||
QList<int> SimulatorCameraSettings::supportedIsoSensitivities() const
|
||||
{
|
||||
return mSupportedIsoSensitivities;
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setManualIsoSensitivity(int iso)
|
||||
{
|
||||
if (iso != mIsoSensitivity && supportedIsoSensitivities().contains(iso)) {
|
||||
mIsoSensitivity = iso;
|
||||
emit isoSensitivityChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setAutoIsoSensitivity()
|
||||
{
|
||||
setManualIsoSensitivity(defaultIsoSensitivity());
|
||||
}
|
||||
|
||||
qreal SimulatorCameraSettings::aperture() const
|
||||
{
|
||||
return mAperture;
|
||||
}
|
||||
|
||||
QList<qreal> SimulatorCameraSettings::supportedApertures() const
|
||||
{
|
||||
return mSupportedApertures;
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setManualAperture(qreal aperture)
|
||||
{
|
||||
if (aperture != mAperture && supportedApertures().contains(aperture)) {
|
||||
mAperture = aperture;
|
||||
emit apertureChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setAutoAperture()
|
||||
{
|
||||
setManualAperture(defaultAperture());
|
||||
}
|
||||
|
||||
qreal SimulatorCameraSettings::shutterSpeed() const
|
||||
{
|
||||
return mShutterSpeed;
|
||||
}
|
||||
|
||||
QList<qreal> SimulatorCameraSettings::supportedShutterSpeeds() const
|
||||
{
|
||||
return mSupportedShutterSpeeds;
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setManualShutterSpeed(qreal speed)
|
||||
{
|
||||
if (speed != mShutterSpeed && supportedShutterSpeeds().contains(speed)) {
|
||||
mShutterSpeed = speed;
|
||||
emit shutterSpeedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setAutoShutterSpeed()
|
||||
{
|
||||
setManualShutterSpeed(defaultShutterSpeed());
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setExposureCompensation(qreal ev)
|
||||
{
|
||||
if (ev != mExposureCompensation && ev >= mSupportedExposureCompensations.first()
|
||||
&& ev <= mSupportedExposureCompensations.last()) {
|
||||
mExposureCompensation = ev;
|
||||
emit exposureCompensationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
qreal SimulatorCameraSettings::exposureCompensation() const
|
||||
{
|
||||
return mExposureCompensation;
|
||||
}
|
||||
|
||||
QList<qreal> SimulatorCameraSettings::supportedExposureCompensationValues() const
|
||||
{
|
||||
return mSupportedExposureCompensations;
|
||||
}
|
||||
|
||||
void SimulatorCameraSettings::setAutoExposureCompensation()
|
||||
{
|
||||
setExposureCompensation(defaultExposureCompensation());
|
||||
}
|
||||
|
||||
int SimulatorCameraSettings::defaultIsoSensitivity() const
|
||||
{
|
||||
return 400;
|
||||
}
|
||||
|
||||
qreal SimulatorCameraSettings::defaultAperture() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
qreal SimulatorCameraSettings::defaultShutterSpeed() const
|
||||
{
|
||||
return 0.008;
|
||||
}
|
||||
|
||||
qreal SimulatorCameraSettings::defaultExposureCompensation() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// End of file
|
||||
@@ -1,110 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORCAMERASETTINGS_H
|
||||
#define SIMULATORCAMERASETTINGS_H
|
||||
|
||||
#include "qcamera.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class SimulatorCameraSettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SimulatorCameraSettings(QObject *parent);
|
||||
~SimulatorCameraSettings();
|
||||
|
||||
// ISO Sensitivity
|
||||
int isoSensitivity() const;
|
||||
int defaultIsoSensitivity() const;
|
||||
void setManualIsoSensitivity(int iso);
|
||||
void setAutoIsoSensitivity();
|
||||
QList<int> supportedIsoSensitivities() const;
|
||||
|
||||
// Aperture
|
||||
qreal aperture() const;
|
||||
qreal defaultAperture() const;
|
||||
void setManualAperture(qreal aperture);
|
||||
void setAutoAperture();
|
||||
QList<qreal> supportedApertures() const;
|
||||
|
||||
// Shutter Speed
|
||||
qreal shutterSpeed() const;
|
||||
qreal defaultShutterSpeed() const;
|
||||
void setManualShutterSpeed(qreal speed);
|
||||
void setAutoShutterSpeed();
|
||||
QList<qreal> supportedShutterSpeeds() const;
|
||||
|
||||
// ExposureCompensation
|
||||
qreal exposureCompensation() const;
|
||||
qreal defaultExposureCompensation() const;
|
||||
void setExposureCompensation(qreal ev);
|
||||
void setAutoExposureCompensation();
|
||||
QList<qreal> supportedExposureCompensationValues() const;
|
||||
|
||||
Q_SIGNALS: // Notifications
|
||||
// For QCameraExposureControl
|
||||
void flashReady(bool ready);
|
||||
void apertureChanged();
|
||||
void apertureRangeChanged();
|
||||
void shutterSpeedChanged();
|
||||
void isoSensitivityChanged();
|
||||
void exposureCompensationChanged();
|
||||
|
||||
// Errors
|
||||
void error(int, const QString&);
|
||||
|
||||
private: // Data
|
||||
int mIsoSensitivity;
|
||||
QList<int> mSupportedIsoSensitivities;
|
||||
qreal mAperture;
|
||||
QList<qreal> mSupportedApertures;
|
||||
qreal mShutterSpeed;
|
||||
QList<qreal> mSupportedShutterSpeeds;
|
||||
qreal mExposureCompensation;
|
||||
QList<qreal> mSupportedExposureCompensations;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // SIMULATORCAMERASETTINGS_H
|
||||
@@ -1,145 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "simulatorvideoinputdevicecontrol.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
using namespace QTM_NAMESPACE;
|
||||
QSimulatorVideoInputDeviceControl::QSimulatorVideoInputDeviceControl(QObject *parent)
|
||||
: QVideoDeviceControl(parent)
|
||||
, mSelectedDevice(-1)
|
||||
{
|
||||
}
|
||||
|
||||
QSimulatorVideoInputDeviceControl::~QSimulatorVideoInputDeviceControl()
|
||||
{
|
||||
}
|
||||
|
||||
int QSimulatorVideoInputDeviceControl::deviceCount() const
|
||||
{
|
||||
return mDevices.count();
|
||||
}
|
||||
|
||||
QString QSimulatorVideoInputDeviceControl::deviceName(int index) const
|
||||
{
|
||||
if (index >= mDevices.count() || index < 0)
|
||||
return QString();
|
||||
return mDevices.at(index);
|
||||
}
|
||||
|
||||
QString QSimulatorVideoInputDeviceControl::deviceDescription(int index) const
|
||||
{
|
||||
if (index >= mDevices.count() || index < 0)
|
||||
return QString();
|
||||
|
||||
return mDescriptions[index];
|
||||
}
|
||||
|
||||
int QSimulatorVideoInputDeviceControl::defaultDevice() const
|
||||
{
|
||||
if (mDevices.isEmpty())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QSimulatorVideoInputDeviceControl::selectedDevice() const
|
||||
{
|
||||
return mSelectedDevice;
|
||||
}
|
||||
|
||||
|
||||
void QSimulatorVideoInputDeviceControl::setSelectedDevice(int index)
|
||||
{
|
||||
if (index != mSelectedDevice) {
|
||||
mSelectedDevice = index;
|
||||
emit selectedDeviceChanged(index);
|
||||
emit selectedDeviceChanged(deviceName(index));
|
||||
}
|
||||
}
|
||||
|
||||
void QSimulatorVideoInputDeviceControl::updateDeviceList(const QtMobility::QCameraData &data)
|
||||
{
|
||||
mDevices.clear();
|
||||
mDescriptions.clear();
|
||||
QHashIterator<QString, QCameraData::QCameraDetails> iter(data.cameras);
|
||||
while(iter.hasNext()) {
|
||||
iter.next();
|
||||
mDevices.append(iter.key());
|
||||
mDescriptions.append(iter.value().description);
|
||||
}
|
||||
emit devicesChanged();
|
||||
}
|
||||
|
||||
void QSimulatorVideoInputDeviceControl::addDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details)
|
||||
{
|
||||
if (mDevices.contains(name))
|
||||
return;
|
||||
|
||||
mDevices.append(name);
|
||||
mDescriptions.append(details.description);
|
||||
emit devicesChanged();
|
||||
}
|
||||
|
||||
void QSimulatorVideoInputDeviceControl::removeDevice(const QString &name)
|
||||
{
|
||||
int index = mDevices.indexOf(name);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
mDevices.removeAt(index);
|
||||
mDescriptions.removeAt(index);
|
||||
if (index == mSelectedDevice)
|
||||
setSelectedDevice(defaultDevice());
|
||||
emit devicesChanged();
|
||||
}
|
||||
|
||||
void QSimulatorVideoInputDeviceControl::changeDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details)
|
||||
{
|
||||
int index = mDevices.indexOf(name);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
if (mDescriptions.at(index) != details.description)
|
||||
mDescriptions[index] = details.description;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 QSIMULATORVIDEOINPUTDEVICECONTROL_H
|
||||
#define QSIMULATORVIDEOINPUTDEVICECONTROL_H
|
||||
|
||||
#include <qvideodevicecontrol.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
#include "../qsimulatormultimediaconnection_p.h"
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
class QSimulatorVideoInputDeviceControl : public QVideoDeviceControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QSimulatorVideoInputDeviceControl(QObject *parent);
|
||||
~QSimulatorVideoInputDeviceControl();
|
||||
|
||||
int deviceCount() const;
|
||||
|
||||
QString deviceName(int index) const;
|
||||
QString deviceDescription(int index) const;
|
||||
|
||||
int defaultDevice() const;
|
||||
int selectedDevice() const;
|
||||
|
||||
void updateDeviceList(const QtMobility::QCameraData &data);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setSelectedDevice(int index);
|
||||
void addDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
|
||||
void removeDevice(const QString &name);
|
||||
void changeDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
|
||||
|
||||
private:
|
||||
int mSelectedDevice;
|
||||
QList<QString> mDevices;
|
||||
QList<QString> mDescriptions;
|
||||
};
|
||||
|
||||
#endif // QSIMULATORVIDEOINPUTDEVICECONTROL_H
|
||||
@@ -1,130 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "simulatorvideorenderercontrol.h"
|
||||
#include "simulatorcamerasettings.h"
|
||||
#include "simulatorcamerasession.h"
|
||||
#include <qabstractvideosurface.h>
|
||||
#include <qvideoframe.h>
|
||||
#include <qvideosurfaceformat.h>
|
||||
#include <QFile>
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
|
||||
SimulatorVideoRendererControl::SimulatorVideoRendererControl(SimulatorCameraSession *session, QObject *parent) :
|
||||
QVideoRendererControl(parent)
|
||||
, mSession(session)
|
||||
, mSurface(0)
|
||||
, mRunning(false)
|
||||
{
|
||||
}
|
||||
|
||||
SimulatorVideoRendererControl::~SimulatorVideoRendererControl()
|
||||
{
|
||||
}
|
||||
|
||||
QAbstractVideoSurface *SimulatorVideoRendererControl::surface() const
|
||||
{
|
||||
return mSurface;
|
||||
}
|
||||
|
||||
void SimulatorVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
|
||||
{
|
||||
mSurface = surface;
|
||||
}
|
||||
|
||||
void SimulatorVideoRendererControl::setImagePath(const QString &imagePath)
|
||||
{
|
||||
if (QFile::exists(imagePath)) {
|
||||
mImage = QImage(imagePath);
|
||||
} else {
|
||||
mImage = QImage(800, 600, QImage::Format_RGB32);
|
||||
mImage.fill(qRgb(200, 50, 50));
|
||||
QPainter painter(&mImage);
|
||||
painter.drawText(0, 0, 800, 600, Qt::AlignCenter, imagePath);
|
||||
}
|
||||
if (mRunning)
|
||||
showImage();
|
||||
}
|
||||
|
||||
void SimulatorVideoRendererControl::showImage()
|
||||
{
|
||||
if (!mSurface)
|
||||
return;
|
||||
stop();
|
||||
mShownImage = mImage;
|
||||
SimulatorCameraSettings *settings = mSession->settings();
|
||||
qreal colorDiff = .0;
|
||||
colorDiff += settings->aperture() - settings->defaultAperture();
|
||||
colorDiff += (settings->shutterSpeed() - settings->defaultShutterSpeed()) * 400;
|
||||
colorDiff += ((qreal)settings->isoSensitivity() - settings->defaultIsoSensitivity()) / 100;
|
||||
colorDiff += settings->exposureCompensation();
|
||||
int diffToApply = qAbs(colorDiff * 20);
|
||||
QPainter painter(&mShownImage);
|
||||
if (colorDiff < 0)
|
||||
painter.fillRect(mShownImage.rect(), QColor(0, 0, 0, qMin(diffToApply, 255)));
|
||||
else
|
||||
painter.fillRect(mShownImage.rect(), QColor(255, 255, 255, qMin(diffToApply, 255)));
|
||||
QVideoFrame::PixelFormat pixelFormat = QVideoFrame::pixelFormatFromImageFormat(mShownImage.format());
|
||||
if (pixelFormat == QVideoFrame::Format_Invalid) {
|
||||
mShownImage = mShownImage.convertToFormat(QImage::Format_RGB32);
|
||||
pixelFormat = QVideoFrame::Format_RGB32;
|
||||
}
|
||||
QVideoSurfaceFormat format(mShownImage.size(), pixelFormat);
|
||||
mSurface->start(format);
|
||||
mSurface->present(mShownImage);
|
||||
mRunning = true;
|
||||
}
|
||||
|
||||
void SimulatorVideoRendererControl::stop()
|
||||
{
|
||||
if (!mSurface)
|
||||
return;
|
||||
|
||||
if (mSurface->isActive())
|
||||
mSurface->stop();
|
||||
mRunning = false;
|
||||
}
|
||||
|
||||
const QImage * SimulatorVideoRendererControl::image() const
|
||||
{
|
||||
return &mShownImage;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 QSIMULATORVIDEORENDERERCONTROL_H
|
||||
#define QSIMULATORVIDEORENDERERCONTROL_H
|
||||
|
||||
#include <qvideorenderercontrol.h>
|
||||
#include <QtGui/QImage>
|
||||
|
||||
|
||||
class SimulatorCameraSession;
|
||||
/*
|
||||
* Control for QGraphicsVideoItem. Viewfinder frames are streamed to a surface
|
||||
* which is drawn to the display by the Qt Graphics Vide Framework.
|
||||
*/
|
||||
class SimulatorVideoRendererControl : public QVideoRendererControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SimulatorVideoRendererControl(SimulatorCameraSession *session, QObject *parent = 0);
|
||||
virtual ~SimulatorVideoRendererControl();
|
||||
|
||||
QAbstractVideoSurface *surface() const;
|
||||
void setSurface(QAbstractVideoSurface *surface);
|
||||
|
||||
void setImagePath(const QString &imagePath);
|
||||
const QImage *image() const;
|
||||
|
||||
public slots:
|
||||
void showImage();
|
||||
|
||||
private slots:
|
||||
void stop();
|
||||
|
||||
private:
|
||||
SimulatorCameraSession *mSession;
|
||||
QAbstractVideoSurface *mSurface;
|
||||
QImage mImage;
|
||||
QImage mShownImage;
|
||||
bool mRunning;
|
||||
};
|
||||
|
||||
#endif // QSIMULATORVIDEORENDERERCONTROL_H
|
||||
@@ -1,122 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "../qsimulatormultimediaconnection_p.h"
|
||||
#include "mobilitysimulatorglobal.h"
|
||||
#include <mobilityconnection_p.h>
|
||||
|
||||
#include <private/qsimulatordata_p.h>
|
||||
|
||||
#include <QtNetwork/QLocalSocket>
|
||||
|
||||
QTM_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QtSimulatorPrivate;
|
||||
|
||||
Q_GLOBAL_STATIC(QCameraData, qtCameraData)
|
||||
|
||||
namespace Simulator
|
||||
{
|
||||
MultimediaConnection::MultimediaConnection(MobilityConnection *mobilityCon)
|
||||
: QObject(mobilityCon)
|
||||
, mConnection(mobilityCon)
|
||||
, mInitialDataReceived(false)
|
||||
{
|
||||
qt_registerCameraTypes();
|
||||
mobilityCon->addMessageHandler(this);
|
||||
}
|
||||
|
||||
void MultimediaConnection::getInitialData()
|
||||
{
|
||||
RemoteMetacall<void>::call(mConnection->sendSocket(), NoSync, "setRequestsCameras");
|
||||
|
||||
while (!mInitialDataReceived)
|
||||
mConnection->receiveSocket()->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
void MultimediaConnection::initialCameraDataSent()
|
||||
{
|
||||
mInitialDataReceived = true;
|
||||
}
|
||||
|
||||
void MultimediaConnection::setCameraData(const QCameraData &data)
|
||||
{
|
||||
*qtCameraData() = data;
|
||||
emit cameraDataChanged(data);
|
||||
}
|
||||
|
||||
void MultimediaConnection::addCamera(const QString &name, const QCameraData::QCameraDetails &details)
|
||||
{
|
||||
if (qtCameraData()->cameras.contains(name))
|
||||
return;
|
||||
|
||||
qtCameraData()->cameras.insert(name, details);
|
||||
emit cameraAdded(name, details);
|
||||
}
|
||||
|
||||
void MultimediaConnection::removeCamera(const QString &name)
|
||||
{
|
||||
if (!qtCameraData()->cameras.contains(name))
|
||||
return;
|
||||
|
||||
qtCameraData()->cameras.remove(name);
|
||||
emit cameraRemoved(name);
|
||||
}
|
||||
|
||||
void MultimediaConnection::changeCamera(const QString &name, const QCameraData::QCameraDetails &details)
|
||||
{
|
||||
if (!qtCameraData()->cameras.contains(name))
|
||||
return;
|
||||
|
||||
qtCameraData()->cameras[name] = details;
|
||||
emit cameraChanged(name, details);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
QCameraData get_qtCameraData()
|
||||
{
|
||||
return *qtCameraData();
|
||||
}
|
||||
|
||||
#include "moc_qsimulatormultimediaconnection_p.cpp"
|
||||
|
||||
QTM_END_NAMESPACE
|
||||
@@ -1,89 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 SIMULATORMULTIMEDIACONNECTION_H
|
||||
#define SIMULATORMULTIMEDIACONNECTION_H
|
||||
|
||||
#include "qsimulatormultimediadata_p.h"
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QTM_BEGIN_NAMESPACE
|
||||
|
||||
namespace Simulator
|
||||
{
|
||||
class MobilityConnection;
|
||||
|
||||
class MultimediaConnection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MultimediaConnection (MobilityConnection *mobilityCon);
|
||||
virtual ~MultimediaConnection () {}
|
||||
|
||||
void getInitialData();
|
||||
|
||||
private slots:
|
||||
void setCameraData(const QtMobility::QCameraData &);
|
||||
void addCamera(const QString &, const QtMobility::QCameraData::QCameraDetails &);
|
||||
void removeCamera(const QString &);
|
||||
void changeCamera(const QString &, const QtMobility::QCameraData::QCameraDetails &);
|
||||
void initialCameraDataSent();
|
||||
|
||||
private:
|
||||
MobilityConnection *mConnection;
|
||||
bool mInitialDataReceived;
|
||||
|
||||
signals:
|
||||
void cameraDataChanged(const QtMobility::QCameraData &data);
|
||||
void cameraAdded(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
|
||||
void cameraRemoved(const QString &name);
|
||||
void cameraChanged(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
|
||||
};
|
||||
} // end namespace Simulator
|
||||
|
||||
QCameraData get_qtCameraData();
|
||||
|
||||
QTM_END_NAMESPACE
|
||||
QT_END_HEADER
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 "qsimulatormultimediadata_p.h"
|
||||
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
QTM_BEGIN_NAMESPACE
|
||||
|
||||
void qt_registerCameraTypes()
|
||||
{
|
||||
qRegisterMetaTypeStreamOperators<QCameraData::QCameraDetails>("QtMobility::QCameraData::QCameraDetails");
|
||||
qRegisterMetaTypeStreamOperators<QCameraData>("QtMobility::QCameraData");
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const QCameraData &s)
|
||||
{
|
||||
out << s.cameras;
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, QCameraData &s)
|
||||
{
|
||||
in >> s.cameras;
|
||||
return in;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const QCameraData::QCameraDetails &s)
|
||||
{
|
||||
out << s.description << s.imagePath;
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, QCameraData::QCameraDetails &s)
|
||||
{
|
||||
in >> s.description >> s.imagePath;
|
||||
return in;
|
||||
}
|
||||
|
||||
QTM_END_NAMESPACE
|
||||
@@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 QSIMULATORMULTIMEDIADATA_P_H
|
||||
#define QSIMULATORMULTIMEDIADATA_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qtmultimediadefs.h"
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <qcamera.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
QTM_BEGIN_NAMESPACE
|
||||
|
||||
struct QCameraData {
|
||||
struct QCameraDetails {
|
||||
QString description;
|
||||
QString imagePath;
|
||||
};
|
||||
QHash<QString, QCameraDetails> cameras;
|
||||
};
|
||||
|
||||
void qt_registerCameraTypes();
|
||||
|
||||
QTM_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QtMobility::QCameraData)
|
||||
Q_DECLARE_METATYPE(QtMobility::QCameraData::QCameraDetails)
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QMULTIMEDIADATA_SIMULATOR_P_H
|
||||
@@ -1,126 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 <QtCore/qstring.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "qsimulatorserviceplugin.h"
|
||||
#include <mobilityconnection_p.h>
|
||||
|
||||
#include "simulatorcameraservice.h"
|
||||
|
||||
#include <qmediaserviceprovider.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
QTM_USE_NAMESPACE
|
||||
|
||||
Simulator::MultimediaConnection *QSimulatorServicePlugin::mMultimediaConnection = 0;
|
||||
|
||||
QSimulatorServicePlugin::QSimulatorServicePlugin()
|
||||
{
|
||||
ensureSimulatorConnection();
|
||||
}
|
||||
|
||||
QStringList QSimulatorServicePlugin::keys() const
|
||||
{
|
||||
QStringList retList;
|
||||
retList << QLatin1String(Q_MEDIASERVICE_CAMERA);
|
||||
return retList;
|
||||
}
|
||||
|
||||
QMediaService* QSimulatorServicePlugin::create(const QString &key)
|
||||
{
|
||||
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
|
||||
return new SimulatorCameraService(key, mMultimediaConnection);
|
||||
|
||||
qWarning() << "Simulator service plugin: unsupported key:" << key;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QSimulatorServicePlugin::release(QMediaService *service)
|
||||
{
|
||||
delete service;
|
||||
}
|
||||
|
||||
QList<QByteArray> QSimulatorServicePlugin::devices(const QByteArray &service) const
|
||||
{
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
QCameraData cams = get_qtCameraData();
|
||||
QList<QByteArray> returnList;
|
||||
foreach(const QString &key, cams.cameras.keys())
|
||||
returnList.append(key.toAscii());
|
||||
return returnList;
|
||||
}
|
||||
|
||||
return QList<QByteArray>();
|
||||
}
|
||||
|
||||
QString QSimulatorServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
|
||||
{
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
QCameraData cams = get_qtCameraData();
|
||||
return cams.cameras.value(device).description;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QSimulatorServicePlugin::ensureSimulatorConnection()
|
||||
{
|
||||
using namespace QtMobility::Simulator;
|
||||
|
||||
static bool connected = false;
|
||||
if (connected)
|
||||
return;
|
||||
|
||||
connected = true;
|
||||
MobilityConnection *connection = MobilityConnection::instance();
|
||||
mMultimediaConnection = new MultimediaConnection(connection);
|
||||
mMultimediaConnection->getInitialData();
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(qtmedia_simulatorengine, QSimulatorServicePlugin);
|
||||
@@ -1,75 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** 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 QSIMULATORSERVICEPLUGIN_H
|
||||
#define QSIMULATORSERVICEPLUGIN_H
|
||||
|
||||
#include <qmediaserviceproviderplugin.h>
|
||||
#include "qsimulatormultimediaconnection_p.h"
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
class QSimulatorServicePlugin : public QMediaServiceProviderPlugin, public QMediaServiceSupportedDevicesInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
|
||||
public:
|
||||
QSimulatorServicePlugin();
|
||||
|
||||
// QMediaServiceProviderPlugin
|
||||
QStringList keys() const;
|
||||
QMediaService* create(QString const& key);
|
||||
void release(QMediaService *service);
|
||||
|
||||
// QMediaServiceSupportedDevicesInterface
|
||||
QList<QByteArray> devices(const QByteArray &service) const;
|
||||
QString deviceDescription(const QByteArray &service, const QByteArray &device);
|
||||
|
||||
private:
|
||||
static void ensureSimulatorConnection();
|
||||
static QTM_PREPEND_NAMESPACE(Simulator::MultimediaConnection) *mMultimediaConnection;
|
||||
|
||||
signals:
|
||||
void cameraDataChanged();
|
||||
};
|
||||
|
||||
#endif // QSIMULATORSERVICEPLUGIN_H
|
||||
@@ -1,28 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
TARGET = $$qtLibraryTarget(qsimulatorengine)
|
||||
PLUGIN_TYPE=mediaservice
|
||||
|
||||
include(../../../common.pri)
|
||||
INCLUDEPATH+=$${SOURCE_DIR}/src/multimedia \
|
||||
$${SOURCE_DIR}/src/multimedia/video \
|
||||
$${SOURCE_DIR}/src/multimedia/audio \
|
||||
$${SOURCE_DIR}/src/mobilitysimulator
|
||||
|
||||
CONFIG += mobility
|
||||
MOBILITY = multimedia
|
||||
|
||||
DEPENDPATH += .
|
||||
|
||||
# Input
|
||||
HEADERS += \
|
||||
qsimulatormultimediaconnection_p.h \
|
||||
qsimulatormultimediadata_p.h \
|
||||
qsimulatorserviceplugin.h
|
||||
|
||||
SOURCES += \
|
||||
qsimulatormultimediaconnection.cpp \
|
||||
qsimulatormultimediadata.cpp \
|
||||
qsimulatorserviceplugin.cpp \
|
||||
|
||||
include(camera/simulatorcamera.pri)
|
||||
Reference in New Issue
Block a user