Check if songs are in playlist when displaying them, not up-front
This commit is contained in:
@@ -165,7 +165,6 @@ void Browser::resize()
|
||||
void Browser::switchTo()
|
||||
{
|
||||
SwitchTo::execute(this);
|
||||
markSongsInPlaylist(w);
|
||||
drawHeader();
|
||||
}
|
||||
|
||||
@@ -527,10 +526,7 @@ void Browser::getDirectory(std::string directory)
|
||||
}
|
||||
case MPD::Item::Type::Song:
|
||||
{
|
||||
auto properties = NC::List::Properties::Selectable;
|
||||
if (myPlaylist->checkForSong(item.song()))
|
||||
properties |= NC::List::Properties::Bold;
|
||||
w.addItem(std::move(item), properties);
|
||||
w.addItem(std::move(item));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -45,7 +45,12 @@ Outputs::Outputs()
|
||||
w.centeredCursor(Config.centered_cursor);
|
||||
w.setHighlightColor(Config.main_highlight_color);
|
||||
w.setItemDisplayer([](NC::Menu<MPD::Output> &menu) {
|
||||
menu << Charset::utf8ToLocale(menu.drawn()->value().name());
|
||||
auto &output = menu.drawn()->value();
|
||||
if (output.enabled())
|
||||
menu << NC::Format::Bold;
|
||||
menu << Charset::utf8ToLocale(output.name());
|
||||
if (output.enabled())
|
||||
menu << NC::Format::NoBold;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,14 +92,7 @@ void Outputs::fetchList()
|
||||
{
|
||||
w.clear();
|
||||
for (MPD::OutputIterator out = Mpd.GetOutputs(), end; out != end; ++out)
|
||||
{
|
||||
auto properties = NC::List::Properties::Selectable;
|
||||
if (out->enabled())
|
||||
properties |= NC::List::Properties::Bold;
|
||||
w.addItem(std::move(*out), properties);
|
||||
}
|
||||
if (myScreen == this)
|
||||
w.refresh();
|
||||
w.addItem(std::move(*out));
|
||||
}
|
||||
|
||||
void Outputs::toggleOutput()
|
||||
|
||||
@@ -136,7 +136,6 @@ void PlaylistEditor::refresh()
|
||||
void PlaylistEditor::switchTo()
|
||||
{
|
||||
SwitchTo::execute(this);
|
||||
markSongsInPlaylist(Content);
|
||||
drawHeader();
|
||||
refresh();
|
||||
}
|
||||
@@ -186,19 +185,10 @@ void PlaylistEditor::update()
|
||||
MPD::SongIterator s = Mpd.GetPlaylistContent(Playlists.current()->value().path()), end;
|
||||
for (; s != end; ++s, ++idx)
|
||||
{
|
||||
bool in_playlist = myPlaylist->checkForSong(*s);
|
||||
if (idx < Content.size())
|
||||
{
|
||||
Content[idx].setBold(in_playlist);
|
||||
Content[idx].value() = std::move(*s);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto properties = NC::List::Properties::Selectable;
|
||||
if (in_playlist)
|
||||
properties |= NC::List::Properties::Bold;
|
||||
Content.addItem(std::move(*s), properties);
|
||||
}
|
||||
Content.addItem(std::move(*s));
|
||||
}
|
||||
if (idx < Content.size())
|
||||
Content.resizeList(idx);
|
||||
|
||||
@@ -208,7 +208,6 @@ void SearchEngine::switchTo()
|
||||
SwitchTo::execute(this);
|
||||
if (w.empty())
|
||||
Prepare();
|
||||
markSongsInPlaylist(w);
|
||||
drawHeader();
|
||||
}
|
||||
|
||||
@@ -346,17 +345,18 @@ void SearchEngine::runAction()
|
||||
size_t found = w.size()-SearchEngine::StaticOptions;
|
||||
found += 3; // don't count options inserted below
|
||||
w.insertSeparator(ResetButton+1);
|
||||
w.insertItem(ResetButton+2, SEItem(), NC::List::Properties::Bold | NC::List::Properties::Inactive);
|
||||
w.insertItem(ResetButton+2, SEItem(), NC::List::Properties::Inactive);
|
||||
w.at(ResetButton+2).value().mkBuffer()
|
||||
<< NC::Format::Bold
|
||||
<< Config.color1
|
||||
<< "Search results: "
|
||||
<< NC::FormattedColor::End(Config.color1)
|
||||
<< Config.color2
|
||||
<< "Found " << found << (found > 1 ? " songs" : " song")
|
||||
<< NC::FormattedColor::End(Config.color2);
|
||||
<< NC::FormattedColor::End(Config.color2)
|
||||
<< NC::Format::NoBold;
|
||||
w.insertSeparator(ResetButton+3);
|
||||
markSongsInPlaylist(w);
|
||||
Statusbar::print("Searching finished");
|
||||
Statusbar::print("Searching finished");
|
||||
if (Config.block_search_constraints_change)
|
||||
for (size_t i = 0; i < StaticOptions-4; ++i)
|
||||
w.at(i).setInactive(true);
|
||||
|
||||
@@ -154,7 +154,7 @@ TagEditor::TagEditor() : FParser(0), FParserHelper(0), FParserLegend(0), FParser
|
||||
TagTypes->addSeparator();
|
||||
if (Config.titles_visibility)
|
||||
{
|
||||
TagTypes->addItem("Options", NC::List::Properties::Bold | NC::List::Properties::Inactive);
|
||||
TagTypes->addItem("Options", NC::List::Properties::Inactive);
|
||||
TagTypes->addSeparator();
|
||||
}
|
||||
TagTypes->addItem("Capitalize First Letters");
|
||||
@@ -571,7 +571,7 @@ void TagEditor::runAction()
|
||||
if (!Patterns.empty())
|
||||
{
|
||||
FParser->addSeparator();
|
||||
FParser->addItem("Recent patterns", NC::List::Properties::Bold | NC::List::Properties::Inactive);
|
||||
FParser->addItem("Recent patterns", NC::List::Properties::Inactive);
|
||||
FParser->addSeparator();
|
||||
for (std::list<std::string>::const_iterator it = Patterns.begin(); it != Patterns.end(); ++it)
|
||||
FParser->addItem(*it);
|
||||
|
||||
Reference in New Issue
Block a user