diff options
author | Jonas Rabbe <jonas.rabbe@nokia.com> | 2012-03-08 11:05:30 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 08:21:07 +0100 |
commit | 942ff7a3c6d25dc3a79d28a79676b0995d95874b (patch) | |
tree | b738fe9761a829e216aeeebdabb3a8febcd3e415 /tests/auto/unit/qmultimedia_common | |
parent | a15b9d3ce88037c973f868fdf6959eea4e157f68 (diff) | |
download | qtmultimedia-942ff7a3c6d25dc3a79d28a79676b0995d95874b.tar.gz |
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>
Diffstat (limited to 'tests/auto/unit/qmultimedia_common')
-rw-r--r-- | tests/auto/unit/qmultimedia_common/mockmediaservice.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/auto/unit/qmultimedia_common/mockmediaservice.h b/tests/auto/unit/qmultimedia_common/mockmediaservice.h index 4bd4a396e..316e78d7c 100644 --- a/tests/auto/unit/qmultimedia_common/mockmediaservice.h +++ b/tests/auto/unit/qmultimedia_common/mockmediaservice.h @@ -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; }; |