Skip to content

Commit

Permalink
MythMusic: Add a nodetype statetype to the playlist tree
Browse files Browse the repository at this point in the history
This changes the playlist tree to show both a statetype that represents the
nodetype eg artists, albums, genres etc as well as an image that shows the
coverart, artist or genre images where appropriate. This is necessary to
remove the hard coded image filenames allowing the themer to use different
names if required.

This also adds icons for the new Compilations and Compilations Artists nodes
and fixes the missing images for compilation artists.
  • Loading branch information
Paul Harrison committed Mar 7, 2012
1 parent 1ceab85 commit 498f9f6
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 32 deletions.
84 changes: 53 additions & 31 deletions mythplugins/mythmusic/mythmusic/playlisteditorview.cpp
Expand Up @@ -733,65 +733,87 @@ void PlaylistEditorView::treeItemVisible(MythUIButtonListItem *item)
if (mdata)
artFile = mdata->getAlbumArtFile();
}
else if (mnode->getAction() == "all tracks")
else if (mnode->getAction() == "album")
{
// hunt for a coverart image for the album
MetadataPtrList *tracks = qVariantValue<MetadataPtrList*> (node->GetData());
for (int x = 0; x < tracks->count(); x++)
{
Metadata *mdata = tracks->at(x);
if (mdata)
{
artFile = mdata->getAlbumArtFile();
if (!artFile.isEmpty())
break;
}
}
}
else if (mnode->getAction() == "compartist")
{
artFile = findIcon("artist", mnode->getString().toLower());
}
else
{
artFile = findIcon(mnode->getAction(), mnode->getString().toLower());
}

QString state = "default";

if (mnode->getAction() == "all tracks")
{
artFile = "mm_alltracks.png";
state = "alltracks";
artFile="blank.png";
}
else if (mnode->getAction() == "genres")
{
artFile = "mm_genres.png";
state = "genres";
artFile="blank.png";
}
else if (mnode->getAction() == "albums")
{
artFile = "mm_albums.png";
state = "albums";
artFile="blank.png";
}
else if (mnode->getAction() == "artists")
{
artFile = "mm_artists.png";
state = "artists";
artFile="blank.png";
}
else if (mnode->getAction() == "compartists")
{
//TODO add a compilation artist icon
artFile = "mm_artists.png";
state = "compartists";
artFile="blank.png";
}
else if (mnode->getAction() == "ratings")
{
artFile = "mm_ratings.png";
state = "ratings";
artFile="blank.png";
}
else if (mnode->getAction() == "years")
{
artFile = "mm_years.png";
state = "years";
artFile="blank.png";
}
else if (mnode->getAction() == "playlists")
{
artFile = "mm_playlists.png";
}
else if (mnode->getAction() == "smartplaylists")
else if (mnode->getAction() == "compilations")
{
artFile = "mm_smartplaylists.png";
state = "compilations";
artFile="blank.png";
}
else if (mnode->getAction() == "album")
else if (mnode->getAction() == "playlists")
{
// hunt for a coverart image for the album
MetadataPtrList *tracks = qVariantValue<MetadataPtrList*> (node->GetData());
for (int x = 0; x < tracks->count(); x++)
{
Metadata *mdata = tracks->at(x);
if (mdata)
{
artFile = mdata->getAlbumArtFile();
if (!artFile.isEmpty())
break;
}
}
state = "playlists";
artFile="blank.png";
}
else
else if (mnode->getAction() == "smartplaylists")
{
artFile = findIcon(mnode->getAction(), mnode->getString().toLower());
state = "smartplaylists";
artFile="blank.png";
}

item->DisplayState(state, "nodetype");

if (artFile.isEmpty())
item->SetImage("mm_nothumb.png");
item->SetImage("");
else
item->SetImage(artFile);
}
Expand Down
66 changes: 66 additions & 0 deletions mythplugins/mythmusic/theme/default-wide/music-base.xml
Expand Up @@ -504,8 +504,74 @@

<imagetype name="buttonimage">
<area>42,10,110,110</area>
<filename>mm_nothumb.png</filename>
</imagetype>

<statetype name="nodetype">
<position>42,10</position>
<state name="default" />
<state name="alltracks">
<imagetype name="alltracks">
<area>0,0,110,110</area>
<filename>mm_alltracks.png</filename>
</imagetype>
</state>
<state name="genres">
<imagetype name="genres">
<area>0,0,110,110</area>
<filename>mm_genres.png</filename>
</imagetype>
</state>
<state name="albums">
<imagetype name="albums">
<area>0,0,110,110</area>
<filename>mm_albums.png</filename>
</imagetype>
</state>
<state name="artists">
<imagetype name="artists">
<area>0,0,110,110</area>
<filename>mm_artists.png</filename>
</imagetype>
</state>
<state name="compartists">
<imagetype name="compartists">
<area>0,0,110,110</area>
<filename>mm_compartists.png</filename>
</imagetype>
</state>
<state name="ratings">
<imagetype name="ratings">
<area>0,0,110,110</area>
<filename>mm_ratings.png</filename>
</imagetype>
</state>
<state name="years">
<imagetype name="years">
<area>0,0,110,110</area>
<filename>mm_years.png</filename>
</imagetype>
</state>
<state name="compilations">
<imagetype name="compilations">
<area>0,0,110,110</area>
<filename>mm_compilations.png</filename>
</imagetype>
</state>
<state name="playlists">
<imagetype name="playlists">
<area>0,0,110,110</area>
<filename>mm_playlists.png</filename>
</imagetype>
</state>
<state name="smartplaylists">
<imagetype name="smartplaylists">
<area>0,0,110,110</area>
<filename>mm_smartplaylists.png</filename>
</imagetype>
</state>
</statetype>

<statetype name="buttoncheck">
<position>15,100</position>
<showempty>yes</showempty>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/theme/theme.pro
@@ -1,6 +1,6 @@
include ( ../../mythconfig.mak )
include ( ../../settings.pro )

QMAKE_STRIP = echo

TARGET = themenop
Expand Down

0 comments on commit 498f9f6

Please sign in to comment.