1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include <QtCore/qmetaobject.h> |
41 | #include <QtCore/qtimer.h> |
42 | |
43 | #include "qmediacontrol.h" |
44 | #include "qmediacontrol_p.h" |
45 | |
46 | |
47 | |
48 | QT_BEGIN_NAMESPACE |
49 | |
50 | /*! |
51 | \class QMediaControl |
52 | \inmodule QtMultimedia |
53 | |
54 | \ingroup multimedia |
55 | \ingroup multimedia_control |
56 | \ingroup multimedia_core |
57 | |
58 | \brief The QMediaControl class provides a base interface for media service controls. |
59 | |
60 | Media controls provide an interface to individual features provided by a |
61 | media service. Most services implement a principal control which exposes |
62 | the core functionality of the service and a number of optional controls which |
63 | expose any additional functionality. |
64 | |
65 | A pointer to a control implemented by a media service can be obtained using |
66 | the \l {QMediaService::requestControl()} member of QMediaService. If the |
67 | service doesn't implement a control it will instead return a null pointer. |
68 | |
69 | \snippet multimedia-snippets/media.cpp Request control |
70 | |
71 | Alternatively if the IId of the control has been declared using |
72 | Q_MEDIA_DECLARE_CONTROL the template version of |
73 | QMediaService::requestControl() can be used to request the service without |
74 | explicitly passing the IId or using qobject_cast(). |
75 | |
76 | \snippet multimedia-snippets/media.cpp Request control templated |
77 | |
78 | Most application code will not interface directly with a media service's |
79 | controls, instead the QMediaObject which owns the service acts as an |
80 | intermediary between one or more controls and the application. |
81 | |
82 | \sa QMediaService, QMediaObject |
83 | */ |
84 | |
85 | /*! |
86 | \macro Q_MEDIA_DECLARE_CONTROL(Class, IId) |
87 | \relates QMediaControl |
88 | |
89 | The Q_MEDIA_DECLARE_CONTROL macro declares an \a IId for a \a Class that |
90 | inherits from QMediaControl. |
91 | |
92 | Declaring an IId for a QMediaControl allows an instance of that control to |
93 | be requested from QMediaService::requestControl() without explicitly |
94 | passing the IId. |
95 | |
96 | \snippet multimedia-snippets/media.cpp Request control templated |
97 | |
98 | \sa QMediaService::requestControl() |
99 | */ |
100 | |
101 | /*! |
102 | Destroys a media control. |
103 | */ |
104 | |
105 | QMediaControl::~QMediaControl() |
106 | { |
107 | delete d_ptr; |
108 | } |
109 | |
110 | /*! |
111 | Constructs a media control with the given \a parent. |
112 | */ |
113 | |
114 | QMediaControl::QMediaControl(QObject *parent) |
115 | : QObject(parent) |
116 | , d_ptr(new QMediaControlPrivate) |
117 | { |
118 | d_ptr->q_ptr = this; |
119 | } |
120 | |
121 | /*! |
122 | \internal |
123 | */ |
124 | |
125 | QMediaControl::QMediaControl(QMediaControlPrivate &dd, QObject *parent) |
126 | : QObject(parent) |
127 | , d_ptr(&dd) |
128 | |
129 | { |
130 | d_ptr->q_ptr = this; |
131 | } |
132 | |
133 | #include "moc_qmediacontrol.cpp" |
134 | QT_END_NAMESPACE |
135 | |
136 | |