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:
@@ -43,6 +43,9 @@
|
||||
#define MOCKMEDIASERVICE_H
|
||||
|
||||
#include "qmediaservice.h"
|
||||
#include <QtCore/QMap>
|
||||
|
||||
Q_DECLARE_METATYPE(QMediaControl *)
|
||||
|
||||
class MockMediaService : public QMediaService
|
||||
{
|
||||
@@ -52,14 +55,23 @@ public:
|
||||
QMediaService(parent),
|
||||
mockControl(control) {}
|
||||
|
||||
QMediaControl* requestControl(const char *)
|
||||
MockMediaService(QObject *parent, QMap<QString, QMediaControl *> controls):
|
||||
QMediaService(parent),
|
||||
mockControl(0),
|
||||
mockControls(controls) {}
|
||||
|
||||
QMediaControl* requestControl(const char *key)
|
||||
{
|
||||
return mockControl;
|
||||
if (mockControl)
|
||||
return mockControl;
|
||||
else
|
||||
return mockControls.value(key);
|
||||
}
|
||||
|
||||
void releaseControl(QMediaControl*) {}
|
||||
|
||||
QMediaControl *mockControl;
|
||||
QMediaControl *mockControl;
|
||||
QMap<QString, QMediaControl *> mockControls;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user