src/multimedia/qmediacontrol.cpp
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include <QtCore/qmetaobject.h>
       
    43 #include <QtCore/qtimer.h>
       
    44 
       
    45 #include "qmediacontrol.h"
       
    46 #include "qmediacontrol_p.h"
       
    47 
       
    48 
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 /*!
       
    53     \class QMediaControl
       
    54     \ingroup multimedia
       
    55 
       
    56     \preliminary
       
    57     \brief The QMediaControl class provides a base interface for media service controls.
       
    58 
       
    59     Media controls provide an interface to individual features provided by a
       
    60     media service.  Most services implement a principal control which exposes
       
    61     the core functionality of the service and a number optional controls which
       
    62     expose any additional functionality.
       
    63 
       
    64     A pointer to a control implemented by a media service can be obtained using
       
    65     the \l {QMediaService::requestControl()} member of QMediaService.  If the
       
    66     service doesn't implement a control it will instead return a null pointer.
       
    67 
       
    68     \code
       
    69     QMediaPlayerControl *control = qobject_cast<QMediaPlayerControl *>(
       
    70             service->requestControl("com.nokia.Qt.QMediaPlayerControl/1.0"));
       
    71     \endcode
       
    72 
       
    73     Alternatively if the IId of the control has been declared using
       
    74     Q_MEDIA_DECLARE_CONTROL the template version of
       
    75     QMediaService::requestControl() can be used to request the service without
       
    76     explicitly passing the IId.
       
    77 
       
    78     \code
       
    79     QMediaPlayerControl *control = service->requestControl<QMediaPlayerControl *>();
       
    80     \endcode
       
    81 
       
    82     Most application code will not interface directly with a media service's
       
    83     controls, instead the QMediaObject which owns the service acts as an
       
    84     intermediary between one or more controls and the application.
       
    85 
       
    86     \sa QMediaService, QMediaObject
       
    87 */
       
    88 
       
    89 /*!
       
    90     \macro Q_MEDIA_DECLARE_CONTROL(Class, IId)
       
    91     \relates QMediaControl
       
    92 
       
    93     The Q_MEDIA_DECLARE_CONTROL macro declares an \a IId for a \a Class that
       
    94     inherits from QMediaControl.
       
    95 
       
    96     Declaring an IId for a QMediaControl allows an instance of that control to
       
    97     be requested from QMediaService::requestControl() without explicitly
       
    98     passing the IId.
       
    99 
       
   100     \code
       
   101     QMediaPlayerControl *control = service->control<QMediaPlayerControl *>();
       
   102     \endcode
       
   103 
       
   104     \sa QMediaService::requestControl()
       
   105 */
       
   106 
       
   107 /*!
       
   108     Destroys a media control.
       
   109 */
       
   110 
       
   111 QMediaControl::~QMediaControl()
       
   112 {
       
   113     delete d_ptr;
       
   114 }
       
   115 
       
   116 /*!
       
   117     Constructs a media control with the given \a parent.
       
   118 */
       
   119 
       
   120 QMediaControl::QMediaControl(QObject *parent)
       
   121     : QObject(parent)
       
   122     , d_ptr(new QMediaControlPrivate)
       
   123 {
       
   124     d_ptr->q_ptr = this;
       
   125 }
       
   126 
       
   127 /*!
       
   128     \internal
       
   129 */
       
   130 
       
   131 QMediaControl::QMediaControl(QMediaControlPrivate &dd, QObject *parent)
       
   132     : QObject(parent)
       
   133     , d_ptr(&dd)
       
   134 
       
   135 {
       
   136     d_ptr->q_ptr = this;
       
   137 }
       
   138 
       
   139 #include "moc_qmediacontrol.cpp"
       
   140 QT_END_NAMESPACE
       
   141