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:
committed by
Qt by Nokia
parent
d1b6bf5fac
commit
2a8463711c
@@ -192,6 +192,28 @@ Item {
|
||||
*/
|
||||
property alias errorString: player.errorString
|
||||
|
||||
/*!
|
||||
\qmlproperty enumeration Video::availability
|
||||
|
||||
Returns the availability state of the video element.
|
||||
|
||||
This is one of:
|
||||
\table
|
||||
\header \li Value \li Description
|
||||
\row \li MediaPlayer.Available
|
||||
\li The video player is available to use.
|
||||
\row \li MediaPlayer.Busy
|
||||
\li The video player is usually available, but some other
|
||||
process is utilizing the hardware necessary to play media.
|
||||
\row \li MediaPlayer.Unavailable
|
||||
\li There are no supported video playback facilities.
|
||||
\row \li MediaPlayer.ResourceMissing
|
||||
\li There is one or more resources missing, so the video player cannot
|
||||
be used. It may be possible to try again at a later time.
|
||||
\endtable
|
||||
*/
|
||||
property alias availability: player.availability
|
||||
|
||||
/*!
|
||||
\qmlproperty bool Video::hasAudio
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -87,10 +87,12 @@ class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public Q
|
||||
Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
|
||||
Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT)
|
||||
Q_PROPERTY(QObject *mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false)
|
||||
Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged)
|
||||
Q_ENUMS(Status)
|
||||
Q_ENUMS(Error)
|
||||
Q_ENUMS(Loop)
|
||||
Q_ENUMS(PlaybackState)
|
||||
Q_ENUMS(Availability)
|
||||
Q_INTERFACES(QDeclarativeParserStatus)
|
||||
public:
|
||||
enum Status
|
||||
@@ -128,6 +130,13 @@ public:
|
||||
StoppedState = QMediaPlayer::StoppedState
|
||||
};
|
||||
|
||||
enum Availability {
|
||||
Available = QtMultimedia::NoError,
|
||||
Busy = QtMultimedia::BusyError,
|
||||
Unavailable = QtMultimedia::ServiceMissingError,
|
||||
ResourceMissing = QtMultimedia::ResourceError
|
||||
};
|
||||
|
||||
QDeclarativeAudio(QObject *parent = 0);
|
||||
~QDeclarativeAudio();
|
||||
|
||||
@@ -143,6 +152,8 @@ public:
|
||||
|
||||
QObject *mediaObject() { return m_mediaObject; }
|
||||
|
||||
Availability availability() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void play();
|
||||
void pause();
|
||||
@@ -175,6 +186,8 @@ Q_SIGNALS:
|
||||
void seekableChanged();
|
||||
void playbackRateChanged();
|
||||
|
||||
void availabilityChanged(Availability availability);
|
||||
|
||||
void errorChanged();
|
||||
void error(QDeclarativeAudio::Error error, const QString &errorString);
|
||||
|
||||
@@ -182,6 +195,7 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void _q_error(int, const QString &);
|
||||
void _q_availabilityChanged(QtMultimedia::AvailabilityError);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QDeclarativeAudio)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ class QDeclarativeCamera : public QObject, public QDeclarativeParserStatus
|
||||
Q_PROPERTY(LockStatus lockStatus READ lockStatus NOTIFY lockStatusChanged)
|
||||
Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
|
||||
|
||||
Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged)
|
||||
|
||||
Q_PROPERTY(qreal opticalZoom READ opticalZoom WRITE setOpticalZoom NOTIFY opticalZoomChanged)
|
||||
Q_PROPERTY(qreal maximumOpticalZoom READ maximumOpticalZoom NOTIFY maximumOpticalZoomChanged)
|
||||
Q_PROPERTY(qreal digitalZoom READ digitalZoom WRITE setDigitalZoom NOTIFY digitalZoomChanged)
|
||||
@@ -109,6 +111,8 @@ class QDeclarativeCamera : public QObject, public QDeclarativeParserStatus
|
||||
Q_ENUMS(FocusMode)
|
||||
Q_ENUMS(FocusPointMode)
|
||||
Q_ENUMS(FocusAreaStatus)
|
||||
Q_ENUMS(Availability)
|
||||
|
||||
public:
|
||||
enum CaptureMode {
|
||||
CaptureStillImage = QCamera::CaptureStillImage,
|
||||
@@ -193,6 +197,12 @@ public:
|
||||
FocusAreaFocused = QCameraFocusZone::Focused
|
||||
};
|
||||
|
||||
enum Availability {
|
||||
Available = QtMultimedia::NoError,
|
||||
Busy = QtMultimedia::BusyError,
|
||||
Unavailable = QtMultimedia::ServiceMissingError,
|
||||
ResourceMissing = QtMultimedia::ResourceError
|
||||
};
|
||||
|
||||
QDeclarativeCamera(QObject *parent = 0);
|
||||
~QDeclarativeCamera();
|
||||
@@ -220,6 +230,8 @@ public:
|
||||
qreal opticalZoom() const;
|
||||
qreal digitalZoom() const;
|
||||
|
||||
Availability availability() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCaptureMode(CaptureMode mode);
|
||||
|
||||
@@ -250,9 +262,12 @@ Q_SIGNALS:
|
||||
|
||||
void mediaObjectChanged();
|
||||
|
||||
void availabilityChanged(Availability availability);
|
||||
|
||||
private Q_SLOTS:
|
||||
void _q_updateState(QCamera::State);
|
||||
void _q_error(int, const QString &);
|
||||
void _q_availabilityChanged(QtMultimedia::AvailabilityError);
|
||||
|
||||
protected:
|
||||
void classBegin();
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <qmediaservice.h>
|
||||
#include <private/qmediaserviceprovider_p.h>
|
||||
#include <qmetadatareadercontrol.h>
|
||||
#include <qmediaavailabilitycontrol.h>
|
||||
|
||||
#include "qdeclarativemediametadata_p.h"
|
||||
|
||||
@@ -98,6 +99,22 @@ public:
|
||||
void stop() {}
|
||||
};
|
||||
|
||||
class QDeclarativeMediaBaseAvailabilityControl : public QMediaAvailabilityControl
|
||||
{
|
||||
public:
|
||||
QDeclarativeMediaBaseAvailabilityControl(bool available)
|
||||
: m_available(available)
|
||||
{
|
||||
}
|
||||
|
||||
QtMultimedia::AvailabilityError availability() const
|
||||
{
|
||||
return m_available ? QtMultimedia::NoError : QtMultimedia::ServiceMissingError;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_available;
|
||||
};
|
||||
|
||||
class QDeclarativeMediaBaseMetaDataControl : public QMetaDataReaderControl
|
||||
{
|
||||
@@ -211,6 +228,7 @@ QDeclarativeMediaBase::QDeclarativeMediaBase()
|
||||
, m_mediaProvider(0)
|
||||
, m_metaDataControl(0)
|
||||
, m_animation(0)
|
||||
, m_availabilityControl(0)
|
||||
, m_playbackState(QMediaPlayer::StoppedState)
|
||||
, m_status(QMediaPlayer::NoMedia)
|
||||
, m_error(QMediaPlayer::ServiceMissingError)
|
||||
@@ -245,9 +263,12 @@ void QDeclarativeMediaBase::setObject(QObject *object, const QByteArray &type)
|
||||
m_metaDataControl = qobject_cast<QMetaDataReaderControl *>(
|
||||
m_mediaService->requestControl(QMetaDataReaderControl_iid));
|
||||
m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService);
|
||||
m_availabilityControl = m_mediaService->requestControl<QMediaAvailabilityControl*>();
|
||||
}
|
||||
}
|
||||
|
||||
bool realPlayer = m_playerControl;
|
||||
|
||||
if (m_playerControl) {
|
||||
QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)),
|
||||
object, SLOT(_q_statusChanged()));
|
||||
@@ -281,6 +302,12 @@ void QDeclarativeMediaBase::setObject(QObject *object, const QByteArray &type)
|
||||
if (!m_metaDataControl)
|
||||
m_metaDataControl = new QDeclarativeMediaBaseMetaDataControl(object);
|
||||
|
||||
if (!m_availabilityControl)
|
||||
m_availabilityControl = new QDeclarativeMediaBaseAvailabilityControl(realPlayer);
|
||||
|
||||
QObject::connect(m_availabilityControl, SIGNAL(availabilityChanged(QtMultimedia::AvailabilityError)),
|
||||
object, SLOT(_q_availabilityChanged(QtMultimedia::AvailabilityError)));
|
||||
|
||||
m_metaData.reset(new QDeclarativeMediaMetaData(m_metaDataControl));
|
||||
|
||||
QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()),
|
||||
|
||||
@@ -67,6 +67,7 @@ class QMediaServiceProvider;
|
||||
class QMetaDataReaderControl;
|
||||
class QDeclarativeMediaBaseAnimation;
|
||||
class QDeclarativeMediaMetaData;
|
||||
class QMediaAvailabilityControl;
|
||||
|
||||
class QDeclarativeMediaBase
|
||||
{
|
||||
@@ -174,6 +175,8 @@ protected:
|
||||
QDeclarativeMediaBaseAnimation *m_animation;
|
||||
QScopedPointer<QDeclarativeMediaMetaData> m_metaData;
|
||||
|
||||
QMediaAvailabilityControl *m_availabilityControl;
|
||||
|
||||
QMediaPlayer::State m_playbackState;
|
||||
QMediaPlayer::MediaStatus m_status;
|
||||
QMediaPlayer::Error m_error;
|
||||
|
||||
@@ -112,6 +112,9 @@ QDeclarativeRadio::QDeclarativeRadio(QObject *parent) :
|
||||
connect(m_radioTuner, SIGNAL(stationFound(int, QString)), this, SIGNAL(stationFound(int, QString)));
|
||||
connect(m_radioTuner, SIGNAL(antennaConnectedChanged(bool)), this, SIGNAL(antennaConnectedChanged(bool)));
|
||||
|
||||
// Note we map availabilityError->availability
|
||||
connect(m_radioTuner, SIGNAL(availabilityErrorChanged(QtMultimedia::AvailabilityError)), this, SLOT(_q_availabilityChanged(QtMultimedia::AvailabilityError)));
|
||||
|
||||
connect(m_radioTuner, SIGNAL(error(QRadioTuner::Error)), this, SLOT(_q_error(QRadioTuner::Error)));
|
||||
}
|
||||
|
||||
@@ -306,13 +309,33 @@ bool QDeclarativeRadio::isAntennaConnected() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlmethod bool QtMultimedia5::Radio::isAvailable()
|
||||
\qmlproperty enumeration QtMultimedia5::Radio::availability
|
||||
|
||||
Returns whether the radio is ready to use.
|
||||
Returns the availability state of the radio.
|
||||
|
||||
This is one of:
|
||||
|
||||
\table
|
||||
\header \li Value \li Description
|
||||
\row \li Available
|
||||
\li The radio is available to use
|
||||
\row \li Busy
|
||||
\li The radio is usually available to use, but is currently busy.
|
||||
This can happen when some other process needs to use the audio
|
||||
hardware.
|
||||
\row \li Unavailable
|
||||
\li The radio is not available to use (there may be no radio
|
||||
hardware)
|
||||
\row \li ResourceMissing
|
||||
\li There is one or more resources missing, so the radio cannot
|
||||
be used. It may be possible to try again at a later time. This
|
||||
can occur if there is no antenna connected - see the \l antennaConnected
|
||||
property as well.
|
||||
\endtable
|
||||
*/
|
||||
bool QDeclarativeRadio::isAvailable() const
|
||||
QDeclarativeRadio::Availability QDeclarativeRadio::availability() const
|
||||
{
|
||||
return m_radioTuner->isAvailable();
|
||||
return Availability(m_radioTuner->availabilityError());
|
||||
}
|
||||
|
||||
void QDeclarativeRadio::setBand(QDeclarativeRadio::Band band)
|
||||
@@ -462,7 +485,7 @@ void QDeclarativeRadio::tuneUp()
|
||||
/*!
|
||||
\qmlmethod QtMultimedia5::Radio::start()
|
||||
|
||||
Starts the radio. If the radio is available, as determined by the \l isAvailable method,
|
||||
Starts the radio. If the radio is available, as determined by the \l availability property,
|
||||
this will result in the \l state becoming \c ActiveState.
|
||||
*/
|
||||
void QDeclarativeRadio::start()
|
||||
@@ -496,6 +519,11 @@ void QDeclarativeRadio::_q_error(QRadioTuner::Error errorCode)
|
||||
emit errorChanged();
|
||||
}
|
||||
|
||||
void QDeclarativeRadio::_q_availabilityChanged(QtMultimedia::AvailabilityError error)
|
||||
{
|
||||
emit availabilityChanged(Availability(error));
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlsignal QtMultimedia5::Radio::stationFound(int frequency, string stationId)
|
||||
|
||||
|
||||
@@ -76,11 +76,13 @@ class QDeclarativeRadio : public QObject
|
||||
Q_PROPERTY(int minimumFrequency READ minimumFrequency NOTIFY bandChanged)
|
||||
Q_PROPERTY(int maximumFrequency READ maximumFrequency NOTIFY bandChanged)
|
||||
Q_PROPERTY(bool antennaConnected READ isAntennaConnected NOTIFY antennaConnectedChanged)
|
||||
Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged)
|
||||
Q_ENUMS(State)
|
||||
Q_ENUMS(Band)
|
||||
Q_ENUMS(Error)
|
||||
Q_ENUMS(StereoMode)
|
||||
Q_ENUMS(SearchMode)
|
||||
Q_ENUMS(Availability)
|
||||
|
||||
public:
|
||||
enum State {
|
||||
@@ -114,6 +116,13 @@ public:
|
||||
SearchGetStationId = QRadioTuner::SearchGetStationId
|
||||
};
|
||||
|
||||
enum Availability {
|
||||
Available = QtMultimedia::NoError,
|
||||
Busy = QtMultimedia::BusyError,
|
||||
Unavailable = QtMultimedia::ServiceMissingError,
|
||||
ResourceMissing = QtMultimedia::ResourceError
|
||||
};
|
||||
|
||||
QDeclarativeRadio(QObject *parent = 0);
|
||||
~QDeclarativeRadio();
|
||||
|
||||
@@ -134,7 +143,8 @@ public:
|
||||
|
||||
bool isAntennaConnected() const;
|
||||
|
||||
Q_INVOKABLE bool isAvailable() const;
|
||||
Q_INVOKABLE bool isAvailable() const {return availability() == Available;}
|
||||
Availability availability() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setBand(QDeclarativeRadio::Band band);
|
||||
@@ -165,6 +175,8 @@ Q_SIGNALS:
|
||||
void stationFound(int frequency, QString stationId);
|
||||
void antennaConnectedChanged(bool connectionStatus);
|
||||
|
||||
void availabilityChanged(Availability availability);
|
||||
|
||||
void errorChanged();
|
||||
void error(QDeclarativeRadio::Error errorCode);
|
||||
|
||||
@@ -172,6 +184,7 @@ private Q_SLOTS:
|
||||
void _q_stateChanged(QRadioTuner::State state);
|
||||
void _q_bandChanged(QRadioTuner::Band band);
|
||||
void _q_error(QRadioTuner::Error errorCode);
|
||||
void _q_availabilityChanged(QtMultimedia::AvailabilityError);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QDeclarativeRadio)
|
||||
|
||||
@@ -112,6 +112,9 @@ QDeclarativeRadioData::QDeclarativeRadioData(QObject *parent) :
|
||||
connect(m_radioData, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), this,
|
||||
SIGNAL(alternativeFrequenciesEnabledChanged(bool)));
|
||||
|
||||
// Note we map availabilityError->availability
|
||||
connect(m_radioData, SIGNAL(availabilityErrorChanged(QtMultimedia::AvailabilityError)), this, SLOT(_q_availabilityChanged(QtMultimedia::AvailabilityError)));
|
||||
|
||||
connect(m_radioData, SIGNAL(error(QRadioData::Error)), this, SLOT(_q_error(QRadioData::Error)));
|
||||
}
|
||||
|
||||
@@ -120,15 +123,32 @@ QDeclarativeRadioData::~QDeclarativeRadioData()
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlmethod bool QtMultimedia5::RadioData::isAvailable()
|
||||
\qmlproperty enumeration QtMultimedia5::RadioData::availability
|
||||
|
||||
Returns whether the radio data element is ready to use.
|
||||
*/
|
||||
bool QDeclarativeRadioData::isAvailable() const
|
||||
Returns the availability state of the radio data interface.
|
||||
|
||||
This is one of:
|
||||
|
||||
\table
|
||||
\header \li Value \li Description
|
||||
\row \li Available
|
||||
\li The radio data interface is available to use
|
||||
\row \li Busy
|
||||
\li The radio data interface is usually available to use, but is currently busy.
|
||||
\row \li Unavailable
|
||||
\li The radio data interface is not available to use (there may be no radio
|
||||
hardware)
|
||||
\row \li ResourceMissing
|
||||
\li There is one or more resources missing, so the radio cannot
|
||||
be used. It may be possible to try again at a later time.
|
||||
\endtable
|
||||
*/
|
||||
QDeclarativeRadioData::Availability QDeclarativeRadioData::availability() const
|
||||
{
|
||||
return m_radioData->isAvailable();
|
||||
return Availability(m_radioData->availabilityError());
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\qmlproperty string QtMultimedia5::RadioData::stationId
|
||||
|
||||
@@ -265,4 +285,9 @@ void QDeclarativeRadioData::_q_error(QRadioData::Error errorCode)
|
||||
emit errorChanged();
|
||||
}
|
||||
|
||||
void QDeclarativeRadioData::_q_availabilityChanged(QtMultimedia::AvailabilityError error)
|
||||
{
|
||||
emit availabilityChanged(Availability(error));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -70,8 +70,10 @@ class QDeclarativeRadioData : public QObject
|
||||
Q_PROPERTY(QString radioText READ radioText NOTIFY radioTextChanged)
|
||||
Q_PROPERTY(bool alternativeFrequenciesEnabled READ alternativeFrequenciesEnabled
|
||||
WRITE setAlternativeFrequenciesEnabled NOTIFY alternativeFrequenciesEnabledChanged)
|
||||
Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged)
|
||||
Q_ENUMS(Error)
|
||||
Q_ENUMS(ProgramType)
|
||||
Q_ENUMS(Availability)
|
||||
|
||||
public:
|
||||
|
||||
@@ -130,14 +132,19 @@ public:
|
||||
ReligiousTalk = QRadioData::ReligiousTalk,
|
||||
Personality = QRadioData::Personality,
|
||||
Public = QRadioData::Public,
|
||||
College = QRadioData::College,
|
||||
College = QRadioData::College
|
||||
};
|
||||
|
||||
enum Availability {
|
||||
Available = QtMultimedia::NoError,
|
||||
Busy = QtMultimedia::BusyError,
|
||||
Unavailable = QtMultimedia::ServiceMissingError,
|
||||
ResourceMissing = QtMultimedia::ResourceError
|
||||
};
|
||||
|
||||
QDeclarativeRadioData(QObject *parent = 0);
|
||||
~QDeclarativeRadioData();
|
||||
|
||||
Q_INVOKABLE bool isAvailable() const;
|
||||
|
||||
QString stationId() const;
|
||||
QDeclarativeRadioData::ProgramType programType() const;
|
||||
QString programTypeName() const;
|
||||
@@ -145,6 +152,9 @@ public:
|
||||
QString radioText() const;
|
||||
bool alternativeFrequenciesEnabled() const;
|
||||
|
||||
Q_INVOKABLE bool isAvailable() const {return availability() == Available;}
|
||||
Availability availability() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setAlternativeFrequenciesEnabled(bool enabled);
|
||||
|
||||
@@ -156,12 +166,15 @@ Q_SIGNALS:
|
||||
void radioTextChanged(QString radioText);
|
||||
void alternativeFrequenciesEnabledChanged(bool enabled);
|
||||
|
||||
void availabilityChanged(Availability availability);
|
||||
|
||||
void errorChanged();
|
||||
void error(QDeclarativeRadioData::Error errorCode);
|
||||
|
||||
private Q_SLOTS:
|
||||
void _q_programTypeChanged(QRadioData::ProgramType programType);
|
||||
void _q_error(QRadioData::Error errorCode);
|
||||
void _q_availabilityChanged(QtMultimedia::AvailabilityError);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QDeclarativeRadioData)
|
||||
|
||||
Reference in New Issue
Block a user