summaryrefslogtreecommitdiffstats
path: root/src/imports/multimedia/qdeclarativeplaylist.cpp
diff options
context:
space:
mode:
authorJim Hodapp <jim.hodapp@canonical.com>2015-11-25 16:06:07 -0500
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-12-18 16:33:57 +0000
commit8dddfe3f43606b385f48e8142c8ecb70d6c103a3 (patch)
tree0af02b1c0a4f200ed1dd09b6104869bf85645100 /src/imports/multimedia/qdeclarativeplaylist.cpp
parent7228e7c8b79cd4ae74c6abd12317b43a7b1e6334 (diff)
Added insertItems and removeItems to QML Playlist.
Change-Id: Iba4d08551016c486e88e738e35fb590d82a058a2 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/imports/multimedia/qdeclarativeplaylist.cpp')
-rw-r--r--src/imports/multimedia/qdeclarativeplaylist.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/imports/multimedia/qdeclarativeplaylist.cpp b/src/imports/multimedia/qdeclarativeplaylist.cpp
index c6ea1bd3..3432bf23 100644
--- a/src/imports/multimedia/qdeclarativeplaylist.cpp
+++ b/src/imports/multimedia/qdeclarativeplaylist.cpp
@@ -456,6 +456,29 @@ bool QDeclarativePlaylist::insertItem(int index, const QUrl &source)
}
/*!
+ \qmlmethod bool QtMultimedia::Playlist::insertItems(index, sources)
+
+ Inserts the list of URLs in \a sources to the playlist at the given \a index.
+
+ Returns true if the \a sources are added successfully.
+
+ \since 5.7
+*/
+bool QDeclarativePlaylist::insertItems(int index, const QList<QUrl> &sources)
+{
+ if (sources.empty())
+ return false;
+
+ QList<QMediaContent> contents;
+ QList<QUrl>::const_iterator it = sources.constBegin();
+ while (it != sources.constEnd()) {
+ contents.push_back(QMediaContent(*it));
+ ++it;
+ }
+ return m_playlist->insertMedia(index, contents);
+}
+
+/*!
\qmlmethod bool QtMultimedia::Playlist::removeItem(index)
Removed the item at the given \a index from the playlist.
@@ -468,6 +491,20 @@ bool QDeclarativePlaylist::removeItem(int index)
}
/*!
+ \qmlmethod bool QtMultimedia::Playlist::removeItems(int start, int end)
+
+ Removes items in the playlist from \a start to \end inclusive.
+
+ Returns true if the items are removed successfully.
+
+ \since 5.7
+*/
+bool QDeclarativePlaylist::removeItems(int start, int end)
+{
+ return m_playlist->removeMedia(start, end);
+}
+
+/*!
\qmlmethod bool QtMultimedia::Playlist::clear()
Removes all the items from the playlist.