Update issue 2398

Also sort GS songs by names
This commit is contained in:
Arnaud Bienner 2012-05-16 01:37:06 +02:00
parent aaef0de224
commit cd7d967271
1 changed files with 5 additions and 0 deletions

View File

@ -1528,6 +1528,10 @@ QVariantMap GroovesharkService::ExtractResult(QNetworkReply* reply) {
return result["result"].toMap(); return result["result"].toMap();
} }
int CompareSongsName(const Song& song1, const Song& song2) {
return song1.PrettyTitleWithArtist().compare(song2.PrettyTitleWithArtist(), Qt::CaseInsensitive) < 0;
}
SongList GroovesharkService::ExtractSongs(const QVariantMap& result) { SongList GroovesharkService::ExtractSongs(const QVariantMap& result) {
QVariantList result_songs = result["songs"].toList(); QVariantList result_songs = result["songs"].toList();
SongList songs; SongList songs;
@ -1535,6 +1539,7 @@ SongList GroovesharkService::ExtractSongs(const QVariantMap& result) {
QVariantMap result_song = result_songs[i].toMap(); QVariantMap result_song = result_songs[i].toMap();
songs << ExtractSong(result_song); songs << ExtractSong(result_song);
} }
qSort(songs.begin(), songs.end(), CompareSongsName);
return songs; return songs;
} }