Made QRadioData bind to QRadioTuner to avoid using multiple services

QRadioData has been updated to be a QMediaBindableInterface, and it
will bind to a QRadioTuner instance, i.e. a QMediaObject that provides
a service which implements the QRadioDataControl.
This change is reflected in the declarative implementations of radio
tuner and data. There is a new `radioData` property in the Radio element
which will give access to the declarative RadioData element for the
tuner.
If a RadioData element is created in QML, it will have an anonymous
tuner which communicates with the underlying media service (which is
pretty much the same how the QRadioTuner and QRadioData classes work
previously).
Updated radio tuner and data test cases to use availability control
and extended the mock media service to allow providing a number of
controls rather than just one (needed for testing availability of
all classes extending from or using QMediaObject).

Change-Id: Id41dde66eee529decd828fd2dcdfe4a54c0e81f4
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Jonas Rabbe
2012-03-08 11:05:30 +10:00
committed by Qt by Nokia
parent a15b9d3ce8
commit 942ff7a3c6
12 changed files with 319 additions and 118 deletions

View File

@@ -43,6 +43,7 @@
#include "qmediaservice.h"
#include "qmediaobject_p.h"
#include "qradiotunercontrol.h"
#include "qradiodata.h"
#include "qmediaserviceprovider_p.h"
#include <QPair>
@@ -94,9 +95,10 @@ namespace
class QRadioTunerPrivate : public QMediaObjectPrivate
{
public:
QRadioTunerPrivate():provider(0), control(0) {}
QRadioTunerPrivate():provider(0), control(0), radioData(0) {}
QMediaServiceProvider *provider;
QRadioTunerControl* control;
QRadioData *radioData;
};
@@ -131,6 +133,8 @@ QRadioTuner::QRadioTuner(QObject *parent):
connect(d->control, SIGNAL(antennaConnectedChanged(bool)), SIGNAL(antennaConnectedChanged(bool)));
connect(d->control, SIGNAL(error(QRadioTuner::Error)), SIGNAL(error(QRadioTuner::Error)));
}
d->radioData = new QRadioData(this, this);
}
}
@@ -142,6 +146,9 @@ QRadioTuner::~QRadioTuner()
{
Q_D(QRadioTuner);
if (d->radioData)
delete d->radioData;
if (d->service && d->control)
d->service->releaseControl(d->control);
@@ -539,6 +546,18 @@ QString QRadioTuner::errorString() const
return QString();
}
/*!
\property QRadioTuner::radioData
\brief holds an instance of \l QRadioData
The instance of QRadioData is already bound to this instance of QRadioTuner.
*/
QRadioData *QRadioTuner::radioData() const
{
return d_func()->radioData;
}
/*!
\fn void QRadioTuner::bandChanged(QRadioTuner::Band band)