qtmobility/src/multimedia/qmediacontrol.cpp
changeset 1 2b40d63a9c3d
child 4 90517678cc4f
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 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 QTM_BEGIN_NAMESPACE
       
    51 
       
    52 /*!
       
    53     \class QMediaControl
       
    54     \ingroup multimedia-serv
       
    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 media service.  Most
       
    60     services implement a principal control which exposes the core functionality of the service and
       
    61     a number optional controls which expose any additional functionality.
       
    62 
       
    63     A pointer to a control implemented by a media service can be obtained using the
       
    64     \l {QMediaService::control()}{control()} member of QMediaService.  If the service doesn't
       
    65     implement a control it will instead return a null pointer.
       
    66 
       
    67     \code
       
    68     QMediaPlayerControl *control = qobject_cast<QMediaPlayerControl *>(
       
    69             service->control("com.nokia.Qt.QMediaPlayerControl/1.0"));
       
    70     \endcode
       
    71 
       
    72     Alternatively if the IId of the control has been declared using Q_MEDIA_DECLARE_CONTROL
       
    73     the template version of QMediaService::control() can be used to request the service without
       
    74     explicitly passing the IId.
       
    75 
       
    76     \code
       
    77     QMediaPlayerControl *control = service->control<QMediaPlayerControl *>();
       
    78     \endcode
       
    79 
       
    80     Most application code will not interface directly with a media service's controls, instead the
       
    81     QMediaObject which owns the service acts as an intermeditary between one or more controls and
       
    82     the application.
       
    83 
       
    84     \sa QMediaService, QMediaObject
       
    85 */
       
    86 
       
    87 /*!
       
    88     \macro Q_MEDIA_DECLARE_CONTROL(Class, IId)
       
    89     \relates QMediaControl
       
    90 
       
    91     The Q_MEDIA_DECLARE_CONTROL macro declares an \a IId for a \a Class that inherits from
       
    92     QMediaControl.
       
    93 
       
    94     Declaring an IId for a QMediaControl allows an instance of that control to be requested from
       
    95     QMediaService::control() without explicitly passing the IId.
       
    96 
       
    97     \code
       
    98     QMediaPlayerControl *control = service->control<QMediaPlayerControl *>();
       
    99     \endcode
       
   100 
       
   101     \sa QMediaService::control()
       
   102 */
       
   103 
       
   104 /*!
       
   105     Destroys a media control.
       
   106 */
       
   107 
       
   108 QMediaControl::~QMediaControl()
       
   109 {
       
   110     delete d_ptr;
       
   111 }
       
   112 
       
   113 /*!
       
   114     Constructs a media control with the given \a parent.
       
   115 */
       
   116 
       
   117 QMediaControl::QMediaControl(QObject *parent)
       
   118     : QObject(parent)
       
   119     , d_ptr(new QMediaControlPrivate)
       
   120 {
       
   121     d_ptr->q_ptr = this;
       
   122 }
       
   123 
       
   124 /*!
       
   125     \internal
       
   126 */
       
   127 
       
   128 QMediaControl::QMediaControl(QMediaControlPrivate &dd, QObject *parent)
       
   129     : QObject(parent)
       
   130     , d_ptr(&dd)
       
   131 
       
   132 {
       
   133     d_ptr->q_ptr = this;
       
   134 }
       
   135 
       
   136 #include "moc_qmediacontrol.cpp"
       
   137 QTM_END_NAMESPACE
       
   138