Expose availability from the backend to C++ and QML.

The availabilityError property was static based on the service, but it
can change at run time, so add the plumbing to allow the backend to
report it itself.

Also make sure that both QML and C++ expose the availability.

The radio tuner and data controls previously had properties (but no
signals) for availability - these have been removed.

Change-Id: I9240cf93e2a51b14cd38642f9312ae3c75f05361
Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
Michael Goddard
2012-03-02 00:21:04 +10:00
committed by Qt by Nokia
parent d1b6bf5fac
commit 2a8463711c
41 changed files with 763 additions and 154 deletions

View File

@@ -68,6 +68,11 @@ void QDeclarativeCamera::_q_updateState(QCamera::State state)
emit cameraStateChanged(QDeclarativeCamera::State(state));
}
void QDeclarativeCamera::_q_availabilityChanged(QtMultimedia::AvailabilityError error)
{
emit availabilityChanged(Availability(error));
}
/*!
\qmlclass Camera QDeclarativeCamera
\brief The Camera element allows you to access viewfinder frames, and take photos and movies.
@@ -176,6 +181,9 @@ QDeclarativeCamera::QDeclarativeCamera(QObject *parent) :
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)));
// Note we map availabilityError->availability
connect(m_camera, SIGNAL(availabilityErrorChanged(QtMultimedia::AvailabilityError)), this, SLOT(_q_availabilityChanged(QtMultimedia::AvailabilityError)));
connect(m_camera->focus(), SIGNAL(opticalZoomChanged(qreal)), this, SIGNAL(opticalZoomChanged(qreal)));
connect(m_camera->focus(), SIGNAL(digitalZoomChanged(qreal)), this, SIGNAL(digitalZoomChanged(qreal)));
connect(m_camera->focus(), SIGNAL(maximumOpticalZoomChanged(qreal)), this, SIGNAL(maximumOpticalZoomChanged(qreal)));
@@ -217,6 +225,35 @@ QString QDeclarativeCamera::errorString() const
return m_camera->errorString();
}
/*!
\qmlproperty enumeration QtMultimedia5::Camera::availability
Returns the availability state of the camera.
This is one of:
\table
\header \li Value \li Description
\row \li Available
\li The camera is available to use
\row \li Busy
\li The camera is usually available to use, but is currently busy.
This can happen when some other process needs to use the camera
hardware.
\row \li Unavailable
\li The camera is not available to use (there may be no camera
hardware)
\row \li ResourceMissing
\li There is one or more resources missing, so the camera cannot
be used. It may be possible to try again at a later time.
\endtable
*/
QDeclarativeCamera::Availability QDeclarativeCamera::availability() const
{
return Availability(m_camera->availabilityError());
}
/*!
\qmlproperty enumeration QtMultimedia5::Camera::captureMode