9
10
11
12
13
14
15
16
17
18
19
20
21
24
25
26
27
28
29
35QUrl QQuickPlaylistItem::source()
const
40void QQuickPlaylistItem::setSource(
const QUrl &source)
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
103 emit itemAboutToBeInserted(start, end);
105 beginInsertRows(QModelIndex(), start, end);
112 emit itemCountChanged();
113 emit itemInserted(start, end);
118 emit itemAboutToBeRemoved(start, end);
120 beginRemoveRows(QModelIndex(), start, end);
127 emit itemCountChanged();
128 emit itemRemoved(start, end);
133 emit dataChanged(createIndex(start, 0), createIndex(end, 0));
134 emit itemChanged(start, end);
139 m_error = m_playlist->error();
140 m_errorString = m_playlist->errorString();
142 emit error(Error(m_error), m_errorString);
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
182 return PlaybackMode(m_playlist->playbackMode());
187 if (playbackMode() == mode)
190 m_playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode(mode));
194
195
196
197
200 return m_playlist->currentMedia();
204
205
206
207
210 return m_playlist->currentIndex();
218 m_playlist->setCurrentIndex(index);
222
223
224
225
228 return m_playlist->mediaCount();
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
252 return Error(m_error);
256
257
258
259
262 return m_errorString;
266
267
268
269
272 return m_playlist->media(index);
276
277
278
279
280
281
282
283
284
287 return m_playlist->nextIndex(steps);
291
292
293
294
295
296
297
298
299
302 return m_playlist->previousIndex(steps);
306
307
308
309
316
317
318
319
322 m_playlist->previous();
326
327
328
329
332 m_playlist->shuffle();
336
337
338
339
340
341
342
343
344
345
348 m_error = QMediaPlaylist::NoError;
349 m_errorString = QString();
351 m_playlist->load(location, format.toLatin1().constData());
355
356
357
358
359
360
361
364 return m_playlist->save(location, format.toLatin1().constData());
368
369
370
371
372
373
376 m_playlist->addMedia(QUrl(source));
380
381
382
383
384
385
386
387
390 if (sources.isEmpty())
393 QList<QUrl> contents;
394 QList<QUrl>::const_iterator it = sources.constBegin();
395 while (it != sources.constEnd()) {
396 contents.push_back(QUrl(*it));
399 m_playlist->addMedia(contents);
403
404
405
406
407
408
411 return m_playlist->insertMedia(index, QUrl(source));
415
416
417
418
419
420
421
422
423bool QQuickPlaylist::insertItems(
int index,
const QList<QUrl> &sources)
428 QList<QUrl> contents;
429 QList<QUrl>::const_iterator it = sources.constBegin();
430 while (it != sources.constEnd()) {
431 contents.push_back(QUrl(*it));
434 return m_playlist->insertMedia(index, contents);
438
439
440
441
442
443
444
445
448 return m_playlist->moveMedia(from, to);
452
453
454
455
456
457
460 return m_playlist->removeMedia(index);
464
465
466
467
468
469
470
471
474 return m_playlist->removeMedia(start, end);
478
479
480
481
482
483
491 if (parent.isValid())
494 return m_playlist->mediaCount();
501 if (!index.isValid())
504 return m_playlist->media(index.row());
509 QHash<
int, QByteArray> roleNames;
510 roleNames[SourceRole] =
"source";
516 m_playlist =
new QMediaPlaylist(
this);
518 connect(m_playlist, SIGNAL(currentIndexChanged(
int)),
519 this, SIGNAL(currentIndexChanged()));
520 connect(m_playlist, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)),
521 this, SIGNAL(playbackModeChanged()));
522 connect(m_playlist, SIGNAL(currentMediaChanged(QUrl)),
523 this, SIGNAL(currentItemSourceChanged()));
524 connect(m_playlist, SIGNAL(mediaAboutToBeInserted(
int,
int)),
525 this, SLOT(_q_mediaAboutToBeInserted(
int,
int)));
526 connect(m_playlist, SIGNAL(mediaInserted(
int,
int)),
527 this, SLOT(_q_mediaInserted(
int,
int)));
528 connect(m_playlist, SIGNAL(mediaAboutToBeRemoved(
int,
int)),
529 this, SLOT(_q_mediaAboutToBeRemoved(
int,
int)));
530 connect(m_playlist, SIGNAL(mediaRemoved(
int,
int)),
531 this, SLOT(_q_mediaRemoved(
int,
int)));
532 connect(m_playlist, SIGNAL(mediaChanged(
int,
int)),
533 this, SLOT(_q_mediaChanged(
int,
int)));
534 connect(m_playlist, SIGNAL(loaded()),
535 this, SIGNAL(loaded()));
536 connect(m_playlist, SIGNAL(loadFailed()),
537 this, SLOT(_q_loadFailed()));
545
546
547
548
549
552
553
554
555
556
559
560
561
562
563
566
567
568
569
570
573
574
575
576
577
580
581
582
583
586
587
588
589
590
594#include "moc_qquickplaylist_p.cpp"
Error error() const
\qmlproperty enumeration QtMultimedia::Playlist::error
void shuffle()
\qmlmethod QtMultimedia::Playlist::shuffle()
QHash< int, QByteArray > roleNames() const override
int itemCount() const
\qmlproperty int QtMultimedia::Playlist::itemCount
bool insertItem(int index, const QUrl &source)
\qmlmethod bool QtMultimedia::Playlist::insertItem(index, source)
void setPlaybackMode(PlaybackMode playbackMode)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
QQuickPlaylist(QObject *parent=0)
PlaybackMode playbackMode() const
\qmlproperty enumeration QtMultimedia::Playlist::playbackMode
void next()
\qmlmethod QtMultimedia::Playlist::next()
QString errorString() const
\qmlproperty string QtMultimedia::Playlist::errorString
bool removeItem(int index)
\qmlmethod bool QtMultimedia::Playlist::removeItem(index)
bool save(const QUrl &location, const QString &format=QString())
\qmlmethod bool QtMultimedia::Playlist::save(location, format)
int nextIndex(int steps=1)
\qmlmethod int QtMultimedia::Playlist::nextIndex(steps)
QUrl currentItemSource() const
\qmlproperty url QtMultimedia::Playlist::currentItemsource
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void addItem(const QUrl &source)
\qmlmethod bool QtMultimedia::Playlist::addItem(source)
void previous()
\qmlmethod QtMultimedia::Playlist::previous()
void classBegin() override
Invoked after class creation, but before any properties have been set.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
void clear()
\qmlmethod bool QtMultimedia::Playlist::clear()
void load(const QUrl &location, const QString &format=QString())
\qmlmethod QtMultimedia::Playlist::load(location, format)
int previousIndex(int steps=1)
\qmlmethod int QtMultimedia::Playlist::previousIndex(steps)
void setCurrentIndex(int currentIndex)
int currentIndex() const
\qmlproperty int QtMultimedia::Playlist::currentIndex
Combined button and popup list for selecting options.