on xenial help sign in
Use the addSources function instead of the addSource

Jim says it's more performant

commitc183767903167c7020501df9679aa302e8744ce2 authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 29 Oct 2015, 16:32 (11 years ago) parent4b55dae
3 files changed+10−2
plugins/Dash/DashAudioPlayer.qml+4−2 tests/mocks/QtMultimedia/declarativeplaylist.cpp+5 tests/mocks/QtMultimedia/declarativeplaylist.h+1
plugins/Dash/DashAudioPlayer.qml+4−2
@@ -54,14 +54,16 @@ QtObject {
5454 break;
5555 }
5656 }
57+ var urls = [];
5758 if (sourceIndex === -1 && newSource != "") {
5859 // If the playing song is not in the playlist, add it
59− playlist.addSource(newSource);
60+ urls.push(newSource);
6061 sourceIndex = 0;
6162 }
6263 for (var i in newPlaylist) {
63− playlist.addSource(newPlaylist[i]);
64+ urls.push(newPlaylist[i]);
6465 }
66+ playlist.addSources(urls);
6567 playlist.currentIndex = sourceIndex;
6668 } else {
6769 audio.source = newSource;
tests/mocks/QtMultimedia/declarativeplaylist.cpp+5
@@ -53,6 +53,11 @@ bool DeclarativePlaylist::addSource(const QUrl &source)
5353 return true;
5454}
5555
56+bool DeclarativePlaylist::addSources(const QList<QUrl> &sources)
57+{
58+ m_medias << sources;
59+ return true;
60+}
5661
5762bool DeclarativePlaylist::clear()
5863{
tests/mocks/QtMultimedia/declarativeplaylist.h+1
@@ -37,6 +37,7 @@ public:
3737public Q_SLOTS:
3838 QUrl source(int index) const;
3939 bool addSource(const QUrl &source);
40+ bool addSources(const QList<QUrl> &sources);
4041 bool clear();
4142
4243Q_SIGNALS: