Fixed QML Camera errors reporting

Added missing connection to QCamera::error() signal
Added Camera.errorCode property

Change-Id: Ie0dd71d760b4b5b79b2aefaba97bc383ef2a9750
Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-05-14 11:54:55 +10:00
committed by Qt by Nokia
parent 112820ef46
commit 08d45baac2
2 changed files with 27 additions and 8 deletions

View File

@@ -57,9 +57,9 @@
QT_BEGIN_NAMESPACE
void QDeclarativeCamera::_q_error(int errorCode, const QString &errorString)
void QDeclarativeCamera::_q_error(QCamera::Error errorCode)
{
emit error(Error(errorCode), errorString);
emit error(Error(errorCode), errorString());
emit errorChanged();
}
@@ -186,6 +186,7 @@ QDeclarativeCamera::QDeclarativeCamera(QObject *parent) :
connect(m_camera, SIGNAL(captureModeChanged(QCamera::CaptureModes)), this, SIGNAL(captureModeChanged()));
connect(m_camera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)), this, SIGNAL(lockStatusChanged()));
connect(m_camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(_q_updateState(QCamera::State)));
connect(m_camera, SIGNAL(error(QCamera::Error)), this, SLOT(_q_error(QCamera::Error)));
// Note we map availabilityError->availability
connect(m_camera, SIGNAL(availabilityErrorChanged(QtMultimedia::AvailabilityError)), this, SLOT(_q_availabilityChanged(QtMultimedia::AvailabilityError)));
@@ -216,7 +217,7 @@ void QDeclarativeCamera::componentComplete()
Returns any camera error.
\sa QDeclarativeCameraError::Error
*/
QDeclarativeCamera::Error QDeclarativeCamera::error() const
QDeclarativeCamera::Error QDeclarativeCamera::errorCode() const
{
return QDeclarativeCamera::Error(m_camera->error());
}
@@ -513,9 +514,26 @@ void QDeclarativeCamera::setDigitalZoom(qreal value)
*/
/*!
\qmlsignal QtMultimedia5::Camera::onError(error, errorString)
\qmlproperty enumeration QtMultimedia5::Camera::errorCode
This handler is called when an error occurs. The enumeration value \a error is one of the
Error state of the camera.
\sa QtMultimedia5::Camera::onError
*/
/*!
\qmlproperty string QtMultimedia5::Camera::errorString
A string describing a camera's error state.
\sa QtMultimedia5::Camera::onError
*/
/*!
\qmlsignal QtMultimedia5::Camera::onError(errorCode, errorString)
This handler is called when an error occurs. The enumeration value \a errorCode is one of the
values defined below, and a descriptive string value is available in \a errorString.
\table

View File

@@ -82,6 +82,7 @@ class QDeclarativeCamera : public QObject, public QQmlParserStatus
Q_PROPERTY(CaptureMode captureMode READ captureMode WRITE setCaptureMode NOTIFY captureModeChanged)
Q_PROPERTY(State cameraState READ cameraState WRITE setCameraState NOTIFY cameraStateChanged)
Q_PROPERTY(LockStatus lockStatus READ lockStatus NOTIFY lockStatusChanged)
Q_PROPERTY(Error errorCode READ errorCode NOTIFY errorChanged)
Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged)
@@ -220,7 +221,7 @@ public:
CaptureMode captureMode() const;
State cameraState() const;
Error error() const;
Error errorCode() const;
QString errorString() const;
LockStatus lockStatus() const;
@@ -249,7 +250,7 @@ public Q_SLOTS:
Q_SIGNALS:
void errorChanged();
void error(QDeclarativeCamera::Error error, const QString &errorString);
void error(QDeclarativeCamera::Error errorCode, const QString &errorString);
void captureModeChanged();
void cameraStateChanged(QDeclarativeCamera::State);
@@ -267,7 +268,7 @@ Q_SIGNALS:
private Q_SLOTS:
void _q_updateState(QCamera::State);
void _q_error(int, const QString &);
void _q_error(QCamera::Error);
void _q_availabilityChanged(QtMultimedia::AvailabilityError);
protected: