new feature: go to currently playing song in browser

This commit is contained in:
Andrzej Rybczak
2009-02-27 00:20:45 +01:00
parent 89b53ddfdb
commit aed227ab5f
4 changed files with 40 additions and 25 deletions

View File

@@ -333,6 +333,28 @@ namespace
}
}
void Browser::LocateSong(const MPD::Song &s)
{
if (s.GetDirectory().empty())
return;
Config.local_browser = !s.IsFromDB();
string option = s.toString(Config.song_status_format);
locale_to_utf(option);
if (itsBrowsedDir != s.GetDirectory())
GetDirectory(s.GetDirectory());
for (size_t i = 0; i < w->Size(); i++)
{
if (w->at(i).type == itSong && option == w->at(i).song->toString(Config.song_status_format))
{
w->Highlight(i);
break;
}
}
SwitchTo();
}
void Browser::GetDirectory(string dir, string subdir)
{
if (dir.empty())