When updating, remove songs first, then add. This way if a non-key field is updated, song wont disappear!

This commit is contained in:
craig.p.drummond@gmail.com
2012-06-26 11:30:55 +00:00
parent dea1f32ea2
commit 00a97e0ecb
2 changed files with 6 additions and 6 deletions

View File

@@ -107,12 +107,12 @@ void Device::applyUpdate()
QSet<Song> removed=currentSongs-updateSongs;
QSet<Song> added=updateSongs-currentSongs;
foreach (const Song &s, added) {
addSongToList(s);
}
foreach (const Song &s, removed) {
removeSongFromList(s);
}
foreach (const Song &s, added) {
addSongToList(s);
}
delete update;
} else*/ {
int oldCount=childCount();

View File

@@ -545,12 +545,12 @@ bool MusicLibraryModel::update(const QSet<Song> &songs)
QSet<Song> added=updateSongs-currentSongs;
bool updatedSongs=added.count()||removed.count();
foreach (const Song &s, added) {
addSongToList(s);
}
foreach (const Song &s, removed) {
removeSongFromList(s);
}
foreach (const Song &s, added) {
addSongToList(s);
}
return updatedSongs;
}