Actually, I was wrong modifying UniqueResults. We should just not sort the results at the end, to keep the initial order we wanted
This commit is contained in:
parent
93b4b2caac
commit
bc7bc9910d
@ -142,7 +142,9 @@ void MusicBrainzClient::DiscIdRequestFinished(const QString& discid,
|
||||
}
|
||||
}
|
||||
|
||||
emit Finished(artist, album, UniqueResults(ret));
|
||||
ResultList unique_ret = UniqueResults(ret);
|
||||
qSort(unique_ret);
|
||||
emit Finished(artist, album, unique_ret);
|
||||
}
|
||||
|
||||
void MusicBrainzClient::RequestFinished(QNetworkReply* reply, int id, int request_number) {
|
||||
@ -345,8 +347,7 @@ MusicBrainzClient::Release MusicBrainzClient::ParseRelease(
|
||||
return ret;
|
||||
}
|
||||
|
||||
MusicBrainzClient::ResultList& MusicBrainzClient::UniqueResults(ResultList& results) {
|
||||
qStableSort(results);
|
||||
results.erase(std::unique(results.begin(), results.end()), results.end());
|
||||
return results;
|
||||
MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList& results) {
|
||||
ResultList ret = QSet<Result>::fromList(results).toList();
|
||||
return ret;
|
||||
}
|
||||
|
@ -137,8 +137,7 @@ signals:
|
||||
static ResultList ParseTrack(QXmlStreamReader* reader);
|
||||
static void ParseArtist(QXmlStreamReader* reader, QString* artist);
|
||||
static Release ParseRelease(QXmlStreamReader* reader);
|
||||
// Remove duplicate from the list. Returns a reference to the input parameter
|
||||
static ResultList& UniqueResults(ResultList& results);
|
||||
static ResultList UniqueResults(const ResultList& results);
|
||||
|
||||
private:
|
||||
static const char* kTrackUrl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user