fixes for locating song in media library in two columns mode
This commit is contained in:
@@ -566,42 +566,51 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
|
|||||||
ShowMessage("Invalid tag type in left column of the media library");
|
ShowMessage("Invalid tag type in left column of the media library");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (primary_tag == "")
|
if (primary_tag.empty())
|
||||||
{
|
{
|
||||||
std::string item_type = IntoStr(Config.media_lib_primary_tag);
|
std::string item_type = IntoStr(Config.media_lib_primary_tag);
|
||||||
ToLower(item_type);
|
ToLower(item_type);
|
||||||
ShowMessage("Can't jump to media library because the song has no %s tag set.", item_type.c_str());
|
ShowMessage("Can't jump to media library because the song has no %s tag set.", item_type.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myScreen != this)
|
if (myScreen != this)
|
||||||
SwitchTo();
|
SwitchTo();
|
||||||
Statusbar() << "Jumping to song...";
|
Statusbar() << "Jumping to song...";
|
||||||
wFooter->Refresh();
|
wFooter->Refresh();
|
||||||
|
|
||||||
if (Artists->Empty() || primary_tag != Artists->Current())
|
if (!hasTwoColumns)
|
||||||
{
|
{
|
||||||
Update();
|
if (Artists->Empty())
|
||||||
for (size_t i = 0; i < Artists->Size(); ++i)
|
Update();
|
||||||
|
if (primary_tag != Artists->Current())
|
||||||
{
|
{
|
||||||
if (primary_tag == Artists->at(i))
|
for (size_t i = 0; i < Artists->Size(); ++i)
|
||||||
{
|
{
|
||||||
Artists->Highlight(i);
|
if (primary_tag == (*Artists)[i])
|
||||||
Albums->Clear();
|
{
|
||||||
break;
|
Artists->Highlight(i);
|
||||||
|
Albums->Clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Albums->Empty())
|
||||||
|
Update();
|
||||||
|
|
||||||
std::string album = s.GetAlbum();
|
std::string album = s.GetAlbum();
|
||||||
std::string date = s.GetDate();
|
std::string date = s.GetDate();
|
||||||
if (Albums->Empty() || (album != Albums->Current().second.Album
|
if ((hasTwoColumns && Albums->Current().second.Artist != primary_tag)
|
||||||
&& date != Albums->Current().second.Year))
|
|| album != Albums->Current().second.Album
|
||||||
|
|| date != Albums->Current().second.Year)
|
||||||
{
|
{
|
||||||
Update();
|
|
||||||
for (size_t i = 0; i < Albums->Size(); ++i)
|
for (size_t i = 0; i < Albums->Size(); ++i)
|
||||||
{
|
{
|
||||||
if (album == Albums->at(i).second.Album && date == Albums->at(i).second.Year)
|
if ((!hasTwoColumns || (*Albums)[i].second.Artist == primary_tag)
|
||||||
|
&& album == (*Albums)[i].second.Album
|
||||||
|
&& date == (*Albums)[i].second.Year)
|
||||||
{
|
{
|
||||||
Albums->Highlight(i);
|
Albums->Highlight(i);
|
||||||
Songs->Clear();
|
Songs->Clear();
|
||||||
@@ -609,21 +618,23 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string song = s.GetTitle();
|
if (Songs->Empty())
|
||||||
if (Songs->Empty() || song != Songs->Current().GetTitle())
|
|
||||||
{
|
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
|
std::string song = s.GetTitle();
|
||||||
|
if (song != Songs->Current().GetTitle())
|
||||||
|
{
|
||||||
for (size_t i = 0; i < Songs->Size(); ++i)
|
for (size_t i = 0; i < Songs->Size(); ++i)
|
||||||
{
|
{
|
||||||
if (song == Songs->at(i).GetTitle())
|
if (song == (*Songs)[i].GetTitle())
|
||||||
{
|
{
|
||||||
Songs->Highlight(i);
|
Songs->Highlight(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Artists->HighlightColor(Config.main_highlight_color);
|
Artists->HighlightColor(Config.main_highlight_color);
|
||||||
Albums->HighlightColor(Config.main_highlight_color);
|
Albums->HighlightColor(Config.main_highlight_color);
|
||||||
Songs->HighlightColor(Config.active_column_color);
|
Songs->HighlightColor(Config.active_column_color);
|
||||||
|
|||||||
Reference in New Issue
Block a user