|
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 "qmediaplaylist.h" |
|
43 #include "qmediaplaylist_p.h" |
|
44 #include "qmediaplaylistprovider.h" |
|
45 #include "qlocalmediaplaylistprovider.h" |
|
46 #include "qmediaplaylistioplugin.h" |
|
47 #include "qmediaservice.h" |
|
48 #include "qmediaplaylistcontrol.h" |
|
49 #include "qmediaplayercontrol.h" |
|
50 |
|
51 #include <QtCore/qlist.h> |
|
52 #include <QtCore/qfile.h> |
|
53 #include <QtCore/qurl.h> |
|
54 #include <QtCore/qcoreevent.h> |
|
55 #include <QtCore/qcoreapplication.h> |
|
56 |
|
57 #include "qmediapluginloader_p.h" |
|
58 |
|
59 QT_BEGIN_NAMESPACE |
|
60 |
|
61 Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, playlistIOLoader, |
|
62 (QMediaPlaylistIOInterface_iid, QLatin1String("playlistformats"), Qt::CaseInsensitive)) |
|
63 |
|
64 |
|
65 /*! |
|
66 \class QMediaPlaylist |
|
67 \ingroup multimedia |
|
68 |
|
69 \preliminary |
|
70 \brief The QMediaPlaylist class provides a list of media content to play. |
|
71 |
|
72 QMediaPlaylist is intended to be used with other media objects, |
|
73 like QMediaPlayer or QMediaImageViewer. |
|
74 |
|
75 QMediaPlaylist allows to access the service intrinsic playlist functionality |
|
76 if available, otherwise it provides the the local memory playlist implementation. |
|
77 |
|
78 \code |
|
79 player = new QMediaPlayer; |
|
80 |
|
81 playlist = new QMediaPlaylist; |
|
82 playlist->append(QUrl("http://example.com/movie1.mp4")); |
|
83 playlist->append(QUrl("http://example.com/movie2.mp4")); |
|
84 playlist->append(QUrl("http://example.com/movie3.mp4")); |
|
85 |
|
86 playlist->setCurrentIndex(1); |
|
87 |
|
88 player->setPlaylist(playlist); |
|
89 |
|
90 player->play(); |
|
91 \endcode |
|
92 |
|
93 Depending on playlist source implementation, most of the playlist mutating |
|
94 operations can be asynchronous. |
|
95 |
|
96 \sa QMediaContent |
|
97 */ |
|
98 |
|
99 |
|
100 /*! |
|
101 \enum QMediaPlaylist::PlaybackMode |
|
102 |
|
103 The QMediaPlaylist::PlaybackMode describes the order items in playlist are played. |
|
104 |
|
105 \value CurrentItemOnce The current item is played only once. |
|
106 |
|
107 \value CurrentItemInLoop The current item is played repeatedly in a loop. |
|
108 |
|
109 \value Sequential Playback starts from the current and moves through each successive item until the last is reached and then stops. |
|
110 The next item is a null item when the last one is currently playing. |
|
111 |
|
112 \value Loop Playback restarts at the first item after the last has finished playing. |
|
113 |
|
114 \value Random Play items in random order. |
|
115 */ |
|
116 |
|
117 |
|
118 |
|
119 /*! |
|
120 Create a new playlist object for with the given \a parent. |
|
121 */ |
|
122 |
|
123 QMediaPlaylist::QMediaPlaylist(QObject *parent) |
|
124 : QObject(parent) |
|
125 , d_ptr(new QMediaPlaylistPrivate) |
|
126 { |
|
127 Q_D(QMediaPlaylist); |
|
128 |
|
129 d->q_ptr = this; |
|
130 d->localPlaylistControl = new QLocalMediaPlaylistControl(this); |
|
131 |
|
132 setMediaObject(0); |
|
133 } |
|
134 |
|
135 /*! |
|
136 Destroys the playlist. |
|
137 */ |
|
138 |
|
139 QMediaPlaylist::~QMediaPlaylist() |
|
140 { |
|
141 Q_D(QMediaPlaylist); |
|
142 |
|
143 if (d->mediaObject) |
|
144 d->mediaObject->unbind(this); |
|
145 |
|
146 delete d_ptr; |
|
147 } |
|
148 |
|
149 /*! |
|
150 Returns the QMediaObject instance that this QMediaPlaylist is bound too, |
|
151 or 0 otherwise. |
|
152 */ |
|
153 QMediaObject *QMediaPlaylist::mediaObject() const |
|
154 { |
|
155 return d_func()->mediaObject; |
|
156 } |
|
157 |
|
158 /*! |
|
159 \internal |
|
160 If \a mediaObject is null or doesn't have an intrinsic playlist, |
|
161 internal local memory playlist source will be created. |
|
162 */ |
|
163 bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject) |
|
164 { |
|
165 Q_D(QMediaPlaylist); |
|
166 |
|
167 if (mediaObject && mediaObject == d->mediaObject) |
|
168 return true; |
|
169 |
|
170 QMediaService *service = mediaObject |
|
171 ? mediaObject->service() : 0; |
|
172 |
|
173 QMediaPlaylistControl *newControl = 0; |
|
174 |
|
175 if (service) |
|
176 newControl = qobject_cast<QMediaPlaylistControl*>(service->requestControl(QMediaPlaylistControl_iid)); |
|
177 |
|
178 if (!newControl) |
|
179 newControl = d->localPlaylistControl; |
|
180 |
|
181 if (d->control != newControl) { |
|
182 int oldSize = 0; |
|
183 if (d->control) { |
|
184 QMediaPlaylistProvider *playlist = d->control->playlistProvider(); |
|
185 oldSize = playlist->mediaCount(); |
|
186 disconnect(playlist, SIGNAL(loadFailed(QMediaPlaylist::Error,QString)), |
|
187 this, SLOT(_q_loadFailed(QMediaPlaylist::Error,QString))); |
|
188 |
|
189 disconnect(playlist, SIGNAL(mediaChanged(int,int)), this, SIGNAL(mediaChanged(int,int))); |
|
190 disconnect(playlist, SIGNAL(mediaAboutToBeInserted(int,int)), this, SIGNAL(mediaAboutToBeInserted(int,int))); |
|
191 disconnect(playlist, SIGNAL(mediaInserted(int,int)), this, SIGNAL(mediaInserted(int,int))); |
|
192 disconnect(playlist, SIGNAL(mediaAboutToBeRemoved(int,int)), this, SIGNAL(mediaAboutToBeRemoved(int,int))); |
|
193 disconnect(playlist, SIGNAL(mediaRemoved(int,int)), this, SIGNAL(mediaRemoved(int,int))); |
|
194 |
|
195 disconnect(playlist, SIGNAL(loaded()), this, SIGNAL(loaded())); |
|
196 |
|
197 disconnect(d->control, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)), |
|
198 this, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode))); |
|
199 disconnect(d->control, SIGNAL(currentIndexChanged(int)), |
|
200 this, SIGNAL(currentIndexChanged(int))); |
|
201 disconnect(d->control, SIGNAL(currentMediaChanged(QMediaContent)), |
|
202 this, SIGNAL(currentMediaChanged(QMediaContent))); |
|
203 |
|
204 if (d->mediaObject) |
|
205 d->mediaObject->service()->releaseControl(d->control); |
|
206 } |
|
207 |
|
208 d->control = newControl; |
|
209 QMediaPlaylistProvider *playlist = d->control->playlistProvider(); |
|
210 connect(playlist, SIGNAL(loadFailed(QMediaPlaylist::Error,QString)), |
|
211 this, SLOT(_q_loadFailed(QMediaPlaylist::Error,QString))); |
|
212 |
|
213 connect(playlist, SIGNAL(mediaChanged(int,int)), this, SIGNAL(mediaChanged(int,int))); |
|
214 connect(playlist, SIGNAL(mediaAboutToBeInserted(int,int)), this, SIGNAL(mediaAboutToBeInserted(int,int))); |
|
215 connect(playlist, SIGNAL(mediaInserted(int,int)), this, SIGNAL(mediaInserted(int,int))); |
|
216 connect(playlist, SIGNAL(mediaAboutToBeRemoved(int,int)), this, SIGNAL(mediaAboutToBeRemoved(int,int))); |
|
217 connect(playlist, SIGNAL(mediaRemoved(int,int)), this, SIGNAL(mediaRemoved(int,int))); |
|
218 |
|
219 connect(playlist, SIGNAL(loaded()), this, SIGNAL(loaded())); |
|
220 |
|
221 connect(d->control, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)), |
|
222 this, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode))); |
|
223 connect(d->control, SIGNAL(currentIndexChanged(int)), |
|
224 this, SIGNAL(currentIndexChanged(int))); |
|
225 connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)), |
|
226 this, SIGNAL(currentMediaChanged(QMediaContent))); |
|
227 |
|
228 if (oldSize) |
|
229 emit mediaRemoved(0, oldSize-1); |
|
230 |
|
231 if (playlist->mediaCount()) { |
|
232 emit mediaAboutToBeInserted(0,playlist->mediaCount()-1); |
|
233 emit mediaInserted(0,playlist->mediaCount()-1); |
|
234 } |
|
235 } |
|
236 |
|
237 d->mediaObject = mediaObject; |
|
238 |
|
239 return true; |
|
240 } |
|
241 |
|
242 /*! |
|
243 \property QMediaPlaylist::playbackMode |
|
244 |
|
245 This property defines the order, items in playlist are played. |
|
246 |
|
247 \sa QMediaPlaylist::PlaybackMode |
|
248 */ |
|
249 |
|
250 QMediaPlaylist::PlaybackMode QMediaPlaylist::playbackMode() const |
|
251 { |
|
252 return d_func()->control->playbackMode(); |
|
253 } |
|
254 |
|
255 void QMediaPlaylist::setPlaybackMode(QMediaPlaylist::PlaybackMode mode) |
|
256 { |
|
257 Q_D(QMediaPlaylist); |
|
258 d->control->setPlaybackMode(mode); |
|
259 } |
|
260 |
|
261 /*! |
|
262 Returns position of the current media content in the playlist. |
|
263 */ |
|
264 int QMediaPlaylist::currentIndex() const |
|
265 { |
|
266 return d_func()->control->currentIndex(); |
|
267 } |
|
268 |
|
269 /*! |
|
270 Returns the current media content. |
|
271 */ |
|
272 |
|
273 QMediaContent QMediaPlaylist::currentMedia() const |
|
274 { |
|
275 return d_func()->playlist()->media(currentIndex()); |
|
276 } |
|
277 |
|
278 /*! |
|
279 Returns the index of the item, which would be current after calling next() |
|
280 \a steps times. |
|
281 |
|
282 Returned value depends on the size of playlist, current position |
|
283 and playback mode. |
|
284 |
|
285 \sa QMediaPlaylist::playbackMode |
|
286 */ |
|
287 int QMediaPlaylist::nextIndex(int steps) const |
|
288 { |
|
289 return d_func()->control->nextIndex(steps); |
|
290 } |
|
291 |
|
292 /*! |
|
293 Returns the index of the item, which would be current after calling previous() |
|
294 \a steps times. |
|
295 |
|
296 \sa QMediaPlaylist::playbackMode |
|
297 */ |
|
298 |
|
299 int QMediaPlaylist::previousIndex(int steps) const |
|
300 { |
|
301 return d_func()->control->previousIndex(steps); |
|
302 } |
|
303 |
|
304 |
|
305 /*! |
|
306 Returns the number of items in the playlist. |
|
307 |
|
308 \sa isEmpty() |
|
309 */ |
|
310 int QMediaPlaylist::mediaCount() const |
|
311 { |
|
312 return d_func()->playlist()->mediaCount(); |
|
313 } |
|
314 |
|
315 /*! |
|
316 Returns true if the playlist contains no items; otherwise returns false. |
|
317 |
|
318 \sa size() |
|
319 */ |
|
320 bool QMediaPlaylist::isEmpty() const |
|
321 { |
|
322 return mediaCount() == 0; |
|
323 } |
|
324 |
|
325 /*! |
|
326 Returns true if the playlist can be modified; otherwise returns false. |
|
327 |
|
328 \sa size() |
|
329 */ |
|
330 bool QMediaPlaylist::isReadOnly() const |
|
331 { |
|
332 return d_func()->playlist()->isReadOnly(); |
|
333 } |
|
334 |
|
335 /*! |
|
336 Returns the media content at \a index in the playlist. |
|
337 */ |
|
338 |
|
339 QMediaContent QMediaPlaylist::media(int index) const |
|
340 { |
|
341 return d_func()->playlist()->media(index); |
|
342 } |
|
343 |
|
344 /*! |
|
345 Append the media \a content to the playlist. |
|
346 |
|
347 Returns true if the operation is successful, otherwise return false. |
|
348 */ |
|
349 bool QMediaPlaylist::addMedia(const QMediaContent &content) |
|
350 { |
|
351 return d_func()->control->playlistProvider()->addMedia(content); |
|
352 } |
|
353 |
|
354 /*! |
|
355 Append multiple media content \a items to the playlist. |
|
356 |
|
357 Returns true if the operation is successful, otherwise return false. |
|
358 */ |
|
359 bool QMediaPlaylist::addMedia(const QList<QMediaContent> &items) |
|
360 { |
|
361 return d_func()->control->playlistProvider()->addMedia(items); |
|
362 } |
|
363 |
|
364 /*! |
|
365 Insert the media \a content to the playlist at position \a pos. |
|
366 |
|
367 Returns true if the operation is successful, otherwise false. |
|
368 */ |
|
369 |
|
370 bool QMediaPlaylist::insertMedia(int pos, const QMediaContent &content) |
|
371 { |
|
372 return d_func()->playlist()->insertMedia(pos, content); |
|
373 } |
|
374 |
|
375 /*! |
|
376 Insert multiple media content \a items to the playlist at position \a pos. |
|
377 |
|
378 Returns true if the operation is successful, otherwise false. |
|
379 */ |
|
380 |
|
381 bool QMediaPlaylist::insertMedia(int pos, const QList<QMediaContent> &items) |
|
382 { |
|
383 return d_func()->playlist()->insertMedia(pos, items); |
|
384 } |
|
385 |
|
386 /*! |
|
387 Remove the item from the playlist at position \a pos. |
|
388 |
|
389 Returns true if the operation is successful, otherwise return false. |
|
390 */ |
|
391 bool QMediaPlaylist::removeMedia(int pos) |
|
392 { |
|
393 Q_D(QMediaPlaylist); |
|
394 return d->playlist()->removeMedia(pos); |
|
395 } |
|
396 |
|
397 /*! |
|
398 Remove items in the playlist from \a start to \a end inclusive. |
|
399 |
|
400 Returns true if the operation is successful, otherwise return false. |
|
401 */ |
|
402 bool QMediaPlaylist::removeMedia(int start, int end) |
|
403 { |
|
404 Q_D(QMediaPlaylist); |
|
405 return d->playlist()->removeMedia(start, end); |
|
406 } |
|
407 |
|
408 /*! |
|
409 Remove all the items from the playlist. |
|
410 |
|
411 Returns true if the operation is successful, otherwise return false. |
|
412 */ |
|
413 bool QMediaPlaylist::clear() |
|
414 { |
|
415 Q_D(QMediaPlaylist); |
|
416 return d->playlist()->clear(); |
|
417 } |
|
418 |
|
419 bool QMediaPlaylistPrivate::readItems(QMediaPlaylistReader *reader) |
|
420 { |
|
421 while (!reader->atEnd()) |
|
422 playlist()->addMedia(reader->readItem()); |
|
423 |
|
424 return true; |
|
425 } |
|
426 |
|
427 bool QMediaPlaylistPrivate::writeItems(QMediaPlaylistWriter *writer) |
|
428 { |
|
429 for (int i=0; i<playlist()->mediaCount(); i++) { |
|
430 if (!writer->writeItem(playlist()->media(i))) |
|
431 return false; |
|
432 } |
|
433 writer->close(); |
|
434 return true; |
|
435 } |
|
436 |
|
437 /*! |
|
438 Load playlist from \a location. If \a format is specified, it is used, |
|
439 otherwise format is guessed from location name and data. |
|
440 |
|
441 New items are appended to playlist. |
|
442 |
|
443 QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully, |
|
444 otherwise the playlist emits loadFailed(). |
|
445 */ |
|
446 void QMediaPlaylist::load(const QUrl &location, const char *format) |
|
447 { |
|
448 Q_D(QMediaPlaylist); |
|
449 |
|
450 d->error = NoError; |
|
451 d->errorString.clear(); |
|
452 |
|
453 if (d->playlist()->load(location,format)) |
|
454 return; |
|
455 |
|
456 if (isReadOnly()) { |
|
457 d->error = AccessDeniedError; |
|
458 d->errorString = tr("Could not add items to read only playlist."); |
|
459 emit loadFailed(); |
|
460 return; |
|
461 } |
|
462 |
|
463 foreach (QString const& key, playlistIOLoader()->keys()) { |
|
464 QMediaPlaylistIOInterface* plugin = qobject_cast<QMediaPlaylistIOInterface*>(playlistIOLoader()->instance(key)); |
|
465 if (plugin && plugin->canRead(location,format)) { |
|
466 QMediaPlaylistReader *reader = plugin->createReader(location,QByteArray(format)); |
|
467 if (reader && d->readItems(reader)) { |
|
468 delete reader; |
|
469 emit loaded(); |
|
470 return; |
|
471 } |
|
472 delete reader; |
|
473 } |
|
474 } |
|
475 |
|
476 d->error = FormatNotSupportedError; |
|
477 d->errorString = tr("Playlist format is not supported"); |
|
478 emit loadFailed(); |
|
479 |
|
480 return; |
|
481 } |
|
482 |
|
483 /*! |
|
484 Load playlist from QIODevice \a device. If \a format is specified, it is used, |
|
485 otherwise format is guessed from device data. |
|
486 |
|
487 New items are appended to playlist. |
|
488 |
|
489 QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully, |
|
490 otherwise the playlist emits loadFailed(). |
|
491 */ |
|
492 void QMediaPlaylist::load(QIODevice * device, const char *format) |
|
493 { |
|
494 Q_D(QMediaPlaylist); |
|
495 |
|
496 d->error = NoError; |
|
497 d->errorString.clear(); |
|
498 |
|
499 if (d->playlist()->load(device,format)) |
|
500 return; |
|
501 |
|
502 if (isReadOnly()) { |
|
503 d->error = AccessDeniedError; |
|
504 d->errorString = tr("Could not add items to read only playlist."); |
|
505 emit loadFailed(); |
|
506 return; |
|
507 } |
|
508 |
|
509 foreach (QString const& key, playlistIOLoader()->keys()) { |
|
510 QMediaPlaylistIOInterface* plugin = qobject_cast<QMediaPlaylistIOInterface*>(playlistIOLoader()->instance(key)); |
|
511 if (plugin && plugin->canRead(device,format)) { |
|
512 QMediaPlaylistReader *reader = plugin->createReader(device,QByteArray(format)); |
|
513 if (reader && d->readItems(reader)) { |
|
514 delete reader; |
|
515 emit loaded(); |
|
516 return; |
|
517 } |
|
518 delete reader; |
|
519 } |
|
520 } |
|
521 |
|
522 d->error = FormatNotSupportedError; |
|
523 d->errorString = tr("Playlist format is not supported"); |
|
524 emit loadFailed(); |
|
525 |
|
526 return; |
|
527 } |
|
528 |
|
529 /*! |
|
530 Save playlist to \a location. If \a format is specified, it is used, |
|
531 otherwise format is guessed from location name. |
|
532 |
|
533 Returns true if playlist was saved successfully, otherwise returns false. |
|
534 */ |
|
535 bool QMediaPlaylist::save(const QUrl &location, const char *format) |
|
536 { |
|
537 Q_D(QMediaPlaylist); |
|
538 |
|
539 d->error = NoError; |
|
540 d->errorString.clear(); |
|
541 |
|
542 if (d->playlist()->save(location,format)) |
|
543 return true; |
|
544 |
|
545 QFile file(location.toLocalFile()); |
|
546 |
|
547 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { |
|
548 d->error = AccessDeniedError; |
|
549 d->errorString = tr("The file could not be accessed."); |
|
550 return false; |
|
551 } |
|
552 |
|
553 return save(&file, format); |
|
554 } |
|
555 |
|
556 /*! |
|
557 Save playlist to QIODevice \a device using format \a format. |
|
558 |
|
559 Returns true if playlist was saved successfully, otherwise returns false. |
|
560 */ |
|
561 bool QMediaPlaylist::save(QIODevice * device, const char *format) |
|
562 { |
|
563 Q_D(QMediaPlaylist); |
|
564 |
|
565 d->error = NoError; |
|
566 d->errorString.clear(); |
|
567 |
|
568 if (d->playlist()->save(device,format)) |
|
569 return true; |
|
570 |
|
571 foreach (QString const& key, playlistIOLoader()->keys()) { |
|
572 QMediaPlaylistIOInterface* plugin = qobject_cast<QMediaPlaylistIOInterface*>(playlistIOLoader()->instance(key)); |
|
573 if (plugin && plugin->canWrite(device,format)) { |
|
574 QMediaPlaylistWriter *writer = plugin->createWriter(device,QByteArray(format)); |
|
575 if (writer && d->writeItems(writer)) { |
|
576 delete writer; |
|
577 return true; |
|
578 } |
|
579 delete writer; |
|
580 } |
|
581 } |
|
582 |
|
583 d->error = FormatNotSupportedError; |
|
584 d->errorString = tr("Playlist format is not supported."); |
|
585 |
|
586 return false; |
|
587 } |
|
588 |
|
589 /*! |
|
590 Returns the last error condition. |
|
591 */ |
|
592 QMediaPlaylist::Error QMediaPlaylist::error() const |
|
593 { |
|
594 return d_func()->error; |
|
595 } |
|
596 |
|
597 /*! |
|
598 Returns the string describing the last error condition. |
|
599 */ |
|
600 QString QMediaPlaylist::errorString() const |
|
601 { |
|
602 return d_func()->errorString; |
|
603 } |
|
604 |
|
605 /*! |
|
606 Shuffle items in the playlist. |
|
607 */ |
|
608 void QMediaPlaylist::shuffle() |
|
609 { |
|
610 d_func()->playlist()->shuffle(); |
|
611 } |
|
612 |
|
613 |
|
614 /*! |
|
615 Advance to the next media content in playlist. |
|
616 */ |
|
617 void QMediaPlaylist::next() |
|
618 { |
|
619 d_func()->control->next(); |
|
620 } |
|
621 |
|
622 /*! |
|
623 Return to the previous media content in playlist. |
|
624 */ |
|
625 void QMediaPlaylist::previous() |
|
626 { |
|
627 d_func()->control->previous(); |
|
628 } |
|
629 |
|
630 /*! |
|
631 Activate media content from playlist at position \a playlistPosition. |
|
632 */ |
|
633 |
|
634 void QMediaPlaylist::setCurrentIndex(int playlistPosition) |
|
635 { |
|
636 d_func()->control->setCurrentIndex(playlistPosition); |
|
637 } |
|
638 |
|
639 /*! |
|
640 \fn void QMediaPlaylist::mediaInserted(int start, int end) |
|
641 |
|
642 This signal is emitted after media has been inserted into the playlist. |
|
643 The new items are those between \a start and \a end inclusive. |
|
644 */ |
|
645 |
|
646 /*! |
|
647 \fn void QMediaPlaylist::mediaRemoved(int start, int end) |
|
648 |
|
649 This signal is emitted after media has been removed from the playlist. |
|
650 The removed items are those between \a start and \a end inclusive. |
|
651 */ |
|
652 |
|
653 /*! |
|
654 \fn void QMediaPlaylist::mediaChanged(int start, int end) |
|
655 |
|
656 This signal is emitted after media has been changed in the playlist |
|
657 between \a start and \a end positions inclusive. |
|
658 */ |
|
659 |
|
660 /*! |
|
661 \fn void QMediaPlaylist::currentIndexChanged(int position) |
|
662 |
|
663 Signal emitted when playlist position changed to \a position. |
|
664 */ |
|
665 |
|
666 /*! |
|
667 \fn void QMediaPlaylist::playbackModeChanged(QMediaPlaylist::PlaybackMode mode) |
|
668 |
|
669 Signal emitted when playback mode changed to \a mode. |
|
670 */ |
|
671 |
|
672 /*! |
|
673 \fn void QMediaPlaylist::mediaAboutToBeInserted(int start, int end) |
|
674 |
|
675 Signal emitted when items are to be inserted at \a start and ending at \a end. |
|
676 */ |
|
677 |
|
678 /*! |
|
679 \fn void QMediaPlaylist::mediaAboutToBeRemoved(int start, int end) |
|
680 |
|
681 Signal emitted when item are to be deleted at \a start and ending at \a end. |
|
682 */ |
|
683 |
|
684 /*! |
|
685 \fn void QMediaPlaylist::currentMediaChanged(const QMediaContent &content) |
|
686 |
|
687 Signal emitted when current media changes to \a content. |
|
688 */ |
|
689 |
|
690 /*! |
|
691 \property QMediaPlaylist::currentIndex |
|
692 \brief Current position. |
|
693 */ |
|
694 |
|
695 /*! |
|
696 \property QMediaPlaylist::currentMedia |
|
697 \brief Current media content. |
|
698 */ |
|
699 |
|
700 /*! |
|
701 \fn QMediaPlaylist::loaded() |
|
702 |
|
703 Signal emitted when playlist finished loading. |
|
704 */ |
|
705 |
|
706 /*! |
|
707 \fn QMediaPlaylist::loadFailed() |
|
708 |
|
709 Signal emitted if failed to load playlist. |
|
710 */ |
|
711 |
|
712 /*! |
|
713 \enum QMediaPlaylist::Error |
|
714 |
|
715 This enum describes the QMediaPlaylist error codes. |
|
716 |
|
717 \value NoError No errors. |
|
718 \value FormatError Format error. |
|
719 \value FormatNotSupportedError Format not supported. |
|
720 \value NetworkError Network error. |
|
721 \value AccessDeniedError Access denied error. |
|
722 */ |
|
723 |
|
724 #include "moc_qmediaplaylist.cpp" |
|
725 #include "moc_qmediaplaylist_p.cpp" |
|
726 QT_END_NAMESPACE |
|
727 |