Skip to content

Commit

Permalink
MythMusic: Speed up the creation of the playlist button items
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Harrison committed Mar 18, 2012
1 parent de4f093 commit f572535
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions mythplugins/mythmusic/mythmusic/musiccommon.cpp
Expand Up @@ -1760,10 +1760,10 @@ void MusicCommon::playlistItemVisible(MythUIButtonListItem *item)
if (!item)
return;

if (item->GetImage().isEmpty())
Metadata *mdata = qVariantValue<Metadata*> (item->GetData());
if (mdata)
{
Metadata *mdata = qVariantValue<Metadata*> (item->GetData());
if (mdata)
if (item->GetImage().isEmpty())
{
QString artFile = mdata->getAlbumArtFile();
if (artFile.isEmpty())
Expand All @@ -1777,8 +1777,15 @@ void MusicCommon::playlistItemVisible(MythUIButtonListItem *item)
item->SetImage(mdata->getAlbumArtFile(), "coverart");
}
}
else
item->SetImage("");

if (item->GetText() == " ")
{
MetadataMap metadataMap;
mdata->toMap(metadataMap);
item->SetText("");
item->SetTextFromMap(metadataMap);
item->DisplayState(QString("%1").arg(mdata->Rating()), "ratingstate");
}
}
}

Expand All @@ -1802,11 +1809,8 @@ void MusicCommon::updateUIPlaylist(void)
if (mdata)
{
MythUIButtonListItem *item =
new MythUIButtonListItem(m_currentPlaylist, "", qVariantFromValue(mdata));
new MythUIButtonListItem(m_currentPlaylist, " ", qVariantFromValue(mdata));

MetadataMap metadataMap;
mdata->toMap(metadataMap);
item->SetTextFromMap(metadataMap);
item->SetFontState("normal");
item->DisplayState("default", "playstate");

Expand All @@ -1830,8 +1834,6 @@ void MusicCommon::updateUIPlaylist(void)
}
}

item->DisplayState(QString("%1").arg(mdata->Rating()), "ratingstate");

if (gPlayer->getCurrentMetadata() && mdata->ID() == gPlayer->getCurrentMetadata()->ID())
m_currentPlaylist->SetItemCurrent(item);
}
Expand Down

0 comments on commit f572535

Please sign in to comment.