qtmobility/src/multimedia/qmediaservice.h
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    49 #include "qmediacontrol.h"
    49 #include "qmediacontrol.h"
    50 
    50 
    51 QT_BEGIN_NAMESPACE
    51 QT_BEGIN_NAMESPACE
    52 
    52 
    53 class QMediaServicePrivate;
    53 class QMediaServicePrivate;
    54 class Q_MEDIA_EXPORT QMediaService : public QObject
    54 class Q_MULTIMEDIA_EXPORT QMediaService : public QObject
    55 {
    55 {
    56     Q_OBJECT
    56     Q_OBJECT
    57 
    57 
    58 public:
    58 public:
    59     ~QMediaService();
    59     ~QMediaService();
    60 
    60 
    61     virtual QMediaControl* control(const char *name) const = 0;
    61     virtual QMediaControl* requestControl(const char *name) = 0;
    62 
    62 
    63 #ifndef QT_NO_MEMBER_TEMPLATES
    63 #ifndef QT_NO_MEMBER_TEMPLATES
    64     template <typename T> inline T control() const {
    64     template <typename T> inline T requestControl() {
    65         if (QObject *object = control(qmediacontrol_iid<T>())) {
    65         if (QMediaControl *control = requestControl(qmediacontrol_iid<T>())) {
    66             return qobject_cast<T>(object);
    66             if (T typedControl = qobject_cast<T>(control))
       
    67                 return typedControl;
       
    68             releaseControl(control);
    67         }
    69         }
    68         return 0;
    70         return 0;
    69     }
    71     }
    70 #endif
    72 #endif
       
    73 
       
    74     virtual void releaseControl(QMediaControl *control) = 0;
    71 
    75 
    72 protected:
    76 protected:
    73     QMediaService(QObject* parent);
    77     QMediaService(QObject* parent);
    74     QMediaService(QMediaServicePrivate &dd, QObject *parent);
    78     QMediaService(QMediaServicePrivate &dd, QObject *parent);
    75 
    79