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