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

@@ -42,6 +42,7 @@
#include "qdeclarativeaudio_p.h"
#include <qmediaplayercontrol.h>
#include <qmediaavailabilitycontrol.h>
QT_BEGIN_NAMESPACE
@@ -152,6 +153,11 @@ void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString)
emit errorChanged();
}
void QDeclarativeAudio::_q_availabilityChanged(QtMultimedia::AvailabilityError)
{
emit availabilityChanged(availability());
}
QDeclarativeAudio::QDeclarativeAudio(QObject *parent)
: QObject(parent)
@@ -163,6 +169,35 @@ QDeclarativeAudio::~QDeclarativeAudio()
shutdown();
}
/*!
\qmlproperty enumeration QtMultimedia5::Audio::availability
Returns the availability state of the media player.
This is one of:
\table
\header \li Value \li Description
\row \li Available
\li The media player is available to use.
\row \li Busy
\li The media player is usually available, but some other
process is utilizing the hardware necessary to play media.
\row \li Unavailable
\li There are no supported media playback facilities.
\row \li ResourceMissing
\li There is one or more resources missing, so the media player cannot
be used. It may be possible to try again at a later time.
\endtable
*/
QDeclarativeAudio::Availability QDeclarativeAudio::availability() const
{
if (!m_playerControl)
return Unavailable;
if (m_availabilityControl)
return Availability(m_availabilityControl->availability());
return Available;
}
/*!
\qmlmethod QtMultimedia5::Audio::play()