on xenial help sign in
Use the addSources function instead of the addSource
c183767Albert Astals Cid
plugins/Dash/DashAudioPlayer.qml+4−2
@@ -54,14 +54,16 @@ QtObject {
54 break;
54 break;
55 }
55 }
56 }
56 }
57+ var urls = [];
57 if (sourceIndex === -1 && newSource != "") {
58 if (sourceIndex === -1 && newSource != "") {
58 // If the playing song is not in the playlist, add it
59 // If the playing song is not in the playlist, add it
59− playlist.addSource(newSource);
60+ urls.push(newSource);
60 sourceIndex = 0;
61 sourceIndex = 0;
61 }
62 }
62 for (var i in newPlaylist) {
63 for (var i in newPlaylist) {
63− playlist.addSource(newPlaylist[i]);
64+ urls.push(newPlaylist[i]);
64 }
65 }
66+ playlist.addSources(urls);
65 playlist.currentIndex = sourceIndex;
67 playlist.currentIndex = sourceIndex;
66 } else {
68 } else {
67 audio.source = newSource;
69 audio.source = newSource;
tests/mocks/QtMultimedia/declarativeplaylist.cpp+5
@@ -53,6 +53,11 @@ bool DeclarativePlaylist::addSource(const QUrl &source)
53 return true;
53 return true;
54}
54}
55
55
56+bool DeclarativePlaylist::addSources(const QList<QUrl> &sources)
57+{
58+ m_medias << sources;
59+ return true;
60+}
56
61
57bool DeclarativePlaylist::clear()
62bool DeclarativePlaylist::clear()
58{
63{
tests/mocks/QtMultimedia/declarativeplaylist.h+1
@@ -37,6 +37,7 @@ public:
37public Q_SLOTS:
37public Q_SLOTS:
38 QUrl source(int index) const;
38 QUrl source(int index) const;
39 bool addSource(const QUrl &source);
39 bool addSource(const QUrl &source);
40+ bool addSources(const QList<QUrl> &sources);
40 bool clear();
41 bool clear();
41
42
42Q_SIGNALS:
43Q_SIGNALS: