summaryrefslogtreecommitdiffstats
path: root/src/plugins/simulator/camera
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/simulator/camera')
-rw-r--r--src/plugins/simulator/camera/simulatorcamera.pri25
-rw-r--r--src/plugins/simulator/camera/simulatorcameracontrol.cpp179
-rw-r--r--src/plugins/simulator/camera/simulatorcameracontrol.h87
-rw-r--r--src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp502
-rw-r--r--src/plugins/simulator/camera/simulatorcameraexposurecontrol.h125
-rw-r--r--src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp120
-rw-r--r--src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h87
-rw-r--r--src/plugins/simulator/camera/simulatorcameraservice.cpp161
-rw-r--r--src/plugins/simulator/camera/simulatorcameraservice.h92
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasession.cpp147
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasession.h96
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasettings.cpp174
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasettings.h110
-rw-r--r--src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp152
-rw-r--r--src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h83
-rw-r--r--src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp130
-rw-r--r--src/plugins/simulator/camera/simulatorvideorenderercontrol.h82
17 files changed, 0 insertions, 2352 deletions
diff --git a/src/plugins/simulator/camera/simulatorcamera.pri b/src/plugins/simulator/camera/simulatorcamera.pri
deleted file mode 100644
index 867fc4b..0000000
--- a/src/plugins/simulator/camera/simulatorcamera.pri
+++ /dev/null
@@ -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
-
diff --git a/src/plugins/simulator/camera/simulatorcameracontrol.cpp b/src/plugins/simulator/camera/simulatorcameracontrol.cpp
deleted file mode 100644
index cf2db58..0000000
--- a/src/plugins/simulator/camera/simulatorcameracontrol.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simulatorcameracontrol.h"
-
-#include <QtCore/qfile.h>
-
-SimulatorCameraControl::SimulatorCameraControl(SimulatorCameraSession *session)
- :QCameraControl(session),
- m_session(session),
- mState(QCamera::UnloadedState),
- mStatus(QCamera::UnloadedStatus)
-{
-}
-
-SimulatorCameraControl::~SimulatorCameraControl()
-{
-}
-
-QCamera::CaptureMode SimulatorCameraControl::captureMode() const
-{
- return m_session->captureMode();
-}
-
-void SimulatorCameraControl::setCaptureMode(QCamera::CaptureMode 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::CaptureMode mode) const
-{
- return mode == QCamera::CaptureStillImage;
-}
-
-QCamera::Status SimulatorCameraControl::status() const
-{
- return mStatus;
-}
diff --git a/src/plugins/simulator/camera/simulatorcameracontrol.h b/src/plugins/simulator/camera/simulatorcameracontrol.h
deleted file mode 100644
index e2f2408..0000000
--- a/src/plugins/simulator/camera/simulatorcameracontrol.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef 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::CaptureMode captureMode() const;
- void setCaptureMode(QCamera::CaptureMode mode);
-
- bool isCaptureModeSupported(QCamera::CaptureMode 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
diff --git a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
deleted file mode 100644
index 1ee820d..0000000
--- a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
+++ /dev/null
@@ -1,502 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-
-#include "simulatorcameraexposurecontrol.h"
-#include "simulatorcamerasession.h"
-
-SimulatorCameraExposureControl::SimulatorCameraExposureControl(SimulatorCameraSession *session, QObject *parent) :
- QCameraExposureControl(parent),
- mExposureMode(QCameraExposure::ExposureAuto),
- mMeteringMode(QCameraExposure::MeteringAverage),
- 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:
- 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::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;
-
- 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");
-
- 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
diff --git a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
deleted file mode 100644
index 5e00a6d..0000000
--- a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef 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;
- SimulatorCameraSession *mSession;
- SimulatorCameraSettings *mSettings;
-};
-
-QT_END_NAMESPACE
-
-#endif // SIMULATORCAMERAEXPOSURECONTROL_H
diff --git a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp b/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp
deleted file mode 100644
index 2fe5070..0000000
--- a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <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
diff --git a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h b/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h
deleted file mode 100644
index f300c5d..0000000
--- a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef 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
diff --git a/src/plugins/simulator/camera/simulatorcameraservice.cpp b/src/plugins/simulator/camera/simulatorcameraservice.cpp
deleted file mode 100644
index 5348fa5..0000000
--- a/src/plugins/simulator/camera/simulatorcameraservice.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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"
diff --git a/src/plugins/simulator/camera/simulatorcameraservice.h b/src/plugins/simulator/camera/simulatorcameraservice.h
deleted file mode 100644
index d2ad037..0000000
--- a/src/plugins/simulator/camera/simulatorcameraservice.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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
diff --git a/src/plugins/simulator/camera/simulatorcamerasession.cpp b/src/plugins/simulator/camera/simulatorcamerasession.cpp
deleted file mode 100644
index d40582b..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasession.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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::CaptureMode mode)
-{
- mCaptureMode = mode;
-}
-
-QDir SimulatorCameraSession::defaultDir(QCamera::CaptureMode) 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::CaptureMode SimulatorCameraSession::captureMode()
-{
- return mCaptureMode;
-}
-
-void SimulatorCameraSession::setImage(const QImage *image)
-{
- mImage = image;
-}
-
-QObject *SimulatorCameraSession::viewfinder() const
-{
- return mViewfinder;
-}
-
-SimulatorCameraSettings *SimulatorCameraSession::settings() const
-{
- return mSettings;
-}
diff --git a/src/plugins/simulator/camera/simulatorcamerasession.h b/src/plugins/simulator/camera/simulatorcamerasession.h
deleted file mode 100644
index d081d0c..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasession.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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::CaptureMode captureMode();
- void setCaptureMode(QCamera::CaptureMode mode);
-
- QDir defaultDir(QCamera::CaptureMode 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::CaptureMode mCaptureMode;
-
- QObject *mViewfinder;
- const QImage *mImage;
-
- SimulatorCameraSettings *mSettings;
-
-public:
- int mRequestId;
-};
-
-#endif // SIMULATORCAMERACAPTURESESSION_H
diff --git a/src/plugins/simulator/camera/simulatorcamerasettings.cpp b/src/plugins/simulator/camera/simulatorcamerasettings.cpp
deleted file mode 100644
index 592aa84..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasettings.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "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
diff --git a/src/plugins/simulator/camera/simulatorcamerasettings.h b/src/plugins/simulator/camera/simulatorcamerasettings.h
deleted file mode 100644
index 30aa44e..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasettings.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef 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
diff --git a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp b/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp
deleted file mode 100644
index 95c4e2d..0000000
--- a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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 <QtWidgets/QIcon>
-#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];
-}
-
-QIcon QSimulatorVideoInputDeviceControl::deviceIcon(int index) const
-{
- Q_UNUSED(index);
- return QIcon();
-}
-
-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;
-}
diff --git a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h b/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h
deleted file mode 100644
index 2d3ddd0..0000000
--- a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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;
- QIcon deviceIcon(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
diff --git a/src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp b/src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp
deleted file mode 100644
index 422d4b8..0000000
--- a/src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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;
-}
diff --git a/src/plugins/simulator/camera/simulatorvideorenderercontrol.h b/src/plugins/simulator/camera/simulatorvideorenderercontrol.h
deleted file mode 100644
index ba14e1e..0000000
--- a/src/plugins/simulator/camera/simulatorvideorenderercontrol.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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