Check if songs are in playlist when displaying them, not up-front

This commit is contained in:
Andrzej Rybczak
2017-01-06 13:58:22 +01:00
parent e191959976
commit 7d502e42ba
11 changed files with 55 additions and 104 deletions

View File

@@ -265,7 +265,6 @@ void MediaLibrary::refresh()
void MediaLibrary::switchTo()
{
SwitchTo::execute(this);
markSongsInPlaylist(Songs);
drawHeader();
refresh();
}
@@ -433,19 +432,10 @@ void MediaLibrary::update()
size_t idx = 0;
for (MPD::SongIterator s = Mpd.CommitSearchSongs(), end; s != end; ++s, ++idx)
{
bool in_playlist = myPlaylist->checkForSong(*s);
if (idx < Songs.size())
{
Songs[idx].value() = std::move(*s);
Songs[idx].setBold(in_playlist);
}
else
{
auto properties = NC::List::Properties::Selectable;
if (in_playlist)
properties |= NC::List::Properties::Bold;
Songs.addItem(std::move(*s), properties);
}
Songs.addItem(std::move(*s));
};
if (idx < Songs.size())
Songs.resizeList(idx);