| 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 | |
| 41 | #include "qmediaplaylistcontrol_p.h" |
| 42 | #include "qmediacontrol_p.h" |
| 43 | |
| 44 | QT_BEGIN_NAMESPACE |
| 45 | |
| 46 | /*! |
| 47 | \class QMediaPlaylistControl |
| 48 | \internal |
| 49 | |
| 50 | \inmodule QtMultimedia |
| 51 | |
| 52 | |
| 53 | \ingroup multimedia_control |
| 54 | |
| 55 | |
| 56 | \brief The QMediaPlaylistControl class provides access to the playlist |
| 57 | functionality of a QMediaService. |
| 58 | |
| 59 | If a QMediaService contains an internal playlist it will implement |
| 60 | QMediaPlaylistControl. This control provides access to the contents of the |
| 61 | \l {playlistProvider()}{playlist}, as well as the \l |
| 62 | {currentIndex()}{position} of the current media, and a means of navigating |
| 63 | to the \l {next()}{next} and \l {previous()}{previous} media. |
| 64 | |
| 65 | The functionality provided by the control is exposed to application code |
| 66 | through the QMediaPlaylist class. |
| 67 | |
| 68 | The interface name of QMediaPlaylistControl is \c org.qt-project.qt.mediaplaylistcontrol/5.0 as |
| 69 | defined in QMediaPlaylistControl_iid. |
| 70 | |
| 71 | \sa QMediaService::requestControl(), QMediaPlayer |
| 72 | */ |
| 73 | |
| 74 | /*! |
| 75 | \macro QMediaPlaylistControl_iid |
| 76 | |
| 77 | \c org.qt-project.qt.mediaplaylistcontrol/5.0 |
| 78 | |
| 79 | Defines the interface name of the QMediaPlaylistControl class. |
| 80 | |
| 81 | \relates QMediaPlaylistControl |
| 82 | */ |
| 83 | |
| 84 | /*! |
| 85 | Create a new playlist control object with the given \a parent. |
| 86 | */ |
| 87 | QMediaPlaylistControl::QMediaPlaylistControl(QObject *parent): |
| 88 | QMediaControl(*new QMediaControlPrivate, parent) |
| 89 | { |
| 90 | } |
| 91 | |
| 92 | /*! |
| 93 | Destroys the playlist control. |
| 94 | */ |
| 95 | QMediaPlaylistControl::~QMediaPlaylistControl() |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | |
| 100 | /*! |
| 101 | \fn QMediaPlaylistControl::playlistProvider() const |
| 102 | |
| 103 | Returns the playlist used by this media player. |
| 104 | */ |
| 105 | |
| 106 | /*! |
| 107 | \fn QMediaPlaylistControl::setPlaylistProvider(QMediaPlaylistProvider *playlist) |
| 108 | |
| 109 | Set the playlist of this media player to \a playlist. |
| 110 | |
| 111 | In many cases it is possible just to use the playlist |
| 112 | constructed by player, but sometimes replacing the whole |
| 113 | playlist allows to avoid copyting of all the items bettween playlists. |
| 114 | |
| 115 | Returns true if player can use this passed playlist; otherwise returns false. |
| 116 | |
| 117 | */ |
| 118 | |
| 119 | /*! |
| 120 | \fn QMediaPlaylistControl::currentIndex() const |
| 121 | |
| 122 | Returns position of the current media source in the playlist. |
| 123 | */ |
| 124 | |
| 125 | /*! |
| 126 | \fn QMediaPlaylistControl::setCurrentIndex(int position) |
| 127 | |
| 128 | Jump to the item at the given \a position. |
| 129 | */ |
| 130 | |
| 131 | /*! |
| 132 | \fn QMediaPlaylistControl::nextIndex(int step) const |
| 133 | |
| 134 | Returns the index of item, which were current after calling next() |
| 135 | \a step times. |
| 136 | |
| 137 | Returned value depends on the size of playlist, current position |
| 138 | and playback mode. |
| 139 | |
| 140 | \sa QMediaPlaylist::playbackMode |
| 141 | */ |
| 142 | |
| 143 | /*! |
| 144 | \fn QMediaPlaylistControl::previousIndex(int step) const |
| 145 | |
| 146 | Returns the index of item, which were current after calling previous() |
| 147 | \a step times. |
| 148 | |
| 149 | \sa QMediaPlaylist::playbackMode |
| 150 | */ |
| 151 | |
| 152 | /*! |
| 153 | \fn QMediaPlaylistControl::next() |
| 154 | |
| 155 | Moves to the next item in playlist. |
| 156 | */ |
| 157 | |
| 158 | /*! |
| 159 | \fn QMediaPlaylistControl::previous() |
| 160 | |
| 161 | Returns to the previous item in playlist. |
| 162 | */ |
| 163 | |
| 164 | /*! |
| 165 | \fn QMediaPlaylistControl::playbackMode() const |
| 166 | |
| 167 | Returns the playlist navigation mode. |
| 168 | |
| 169 | \sa QMediaPlaylist::PlaybackMode |
| 170 | */ |
| 171 | |
| 172 | /*! |
| 173 | \fn QMediaPlaylistControl::setPlaybackMode(QMediaPlaylist::PlaybackMode mode) |
| 174 | |
| 175 | Sets the playback \a mode. |
| 176 | |
| 177 | \sa QMediaPlaylist::PlaybackMode |
| 178 | */ |
| 179 | |
| 180 | /*! |
| 181 | \fn QMediaPlaylistControl::playlistProviderChanged() |
| 182 | |
| 183 | Signal emitted when the playlist provider has changed. |
| 184 | */ |
| 185 | |
| 186 | /*! |
| 187 | \fn QMediaPlaylistControl::currentIndexChanged(int position) |
| 188 | |
| 189 | Signal emitted when the playlist \a position is changed. |
| 190 | */ |
| 191 | |
| 192 | /*! |
| 193 | \fn QMediaPlaylistControl::playbackModeChanged(QMediaPlaylist::PlaybackMode mode) |
| 194 | |
| 195 | Signal emitted when the playback \a mode is changed. |
| 196 | */ |
| 197 | |
| 198 | /*! |
| 199 | \fn QMediaPlaylistControl::currentMediaChanged(const QMediaContent& content) |
| 200 | |
| 201 | Signal emitted when current media changes to \a content. |
| 202 | */ |
| 203 | |
| 204 | QT_END_NAMESPACE |
| 205 | |
| 206 | #include "moc_qmediaplaylistcontrol_p.cpp" |
| 207 | |