1 | # |
---|
2 | # Pressing "Play" on an album plays the album. |
---|
3 | # |
---|
4 | --- a/mythtv/mythplugins/mythmusic/mythmusic/playlisteditorview.cpp 2012-04-24 17:33:41.000000000 +0930 |
---|
5 | +++ b/mythtv/mythplugins/mythmusic/mythmusic/playlisteditorview.cpp 2012-05-16 18:18:16.950560552 +0930 |
---|
6 | @@ -449,6 +451,90 @@ bool PlaylistEditorView::keyPressEvent(Q |
---|
7 | if (item) |
---|
8 | treeItemClicked(item); |
---|
9 | } |
---|
10 | + else if ((action == "PLAY") && (GetFocusWidget() == m_playlistTree)) |
---|
11 | + { |
---|
12 | + MythUIButtonListItem *item = m_playlistTree->GetItemCurrent(); |
---|
13 | + if (item) |
---|
14 | + { |
---|
15 | + MythGenericTree *node = qVariantValue<MythGenericTree*> (item->GetData()); |
---|
16 | + MusicGenericTree *mnode = dynamic_cast<MusicGenericTree*>(node); |
---|
17 | + |
---|
18 | + if (mnode) |
---|
19 | + { |
---|
20 | + if (mnode->getAction() == "trackid") |
---|
21 | + { |
---|
22 | + handled = false; |
---|
23 | + } |
---|
24 | + else if ((mnode->getAction() == "playlists") || (mnode->getAction() == "smartplaylists") || (mnode->getAction() == "smartplaylistcategory")) |
---|
25 | + { |
---|
26 | + handled = false; |
---|
27 | + } |
---|
28 | + else if (mnode->getAction() == "playlist") |
---|
29 | + { |
---|
30 | + // get list of tracks to add |
---|
31 | + int playlistID = mnode->getInt(); |
---|
32 | + Playlist *playlist = gMusicData->all_playlists->getPlaylist(playlistID); |
---|
33 | + |
---|
34 | + if (playlist) |
---|
35 | + { |
---|
36 | + SongList songlist = playlist->getSongs(); |
---|
37 | + if (songlist.count() > 0) |
---|
38 | + { |
---|
39 | + m_songList.clear(); |
---|
40 | + for (int x = 0; x < songlist.count(); x++) |
---|
41 | + { |
---|
42 | + m_songList.append(songlist.at(x)->ID()); |
---|
43 | + } |
---|
44 | + } |
---|
45 | + else |
---|
46 | + { |
---|
47 | + handled = false; |
---|
48 | + } |
---|
49 | + } |
---|
50 | + } |
---|
51 | + else if (mnode->getAction() == "smartplaylist") |
---|
52 | + { |
---|
53 | + // add the selected smart playlist's tracks to the song list |
---|
54 | + QList<MythGenericTree*> *children = mnode->getAllChildren(); |
---|
55 | + if (children->count() > 0) |
---|
56 | + { |
---|
57 | + m_songList.clear(); |
---|
58 | + for (int x = 0; x < children->count(); x++) |
---|
59 | + { |
---|
60 | + MythGenericTree *childnode = children->at(x); |
---|
61 | + m_songList.append(childnode->getInt()); |
---|
62 | + } |
---|
63 | + } |
---|
64 | + else |
---|
65 | + { |
---|
66 | + handled = false; |
---|
67 | + } |
---|
68 | + } |
---|
69 | + else |
---|
70 | + { |
---|
71 | + m_songList.clear(); |
---|
72 | + MetadataPtrList *tracks = qVariantValue<MetadataPtrList*> (mnode->GetData()); |
---|
73 | + for (int x = 0; x < tracks->count(); x++) |
---|
74 | + { |
---|
75 | + Metadata *mdata = tracks->at(x); |
---|
76 | + if (mdata) |
---|
77 | + m_songList.append((int)mdata->ID()); |
---|
78 | + } |
---|
79 | + } |
---|
80 | + if (handled) |
---|
81 | + { |
---|
82 | + m_playlistOptions.playPLOption = PL_FIRST; |
---|
83 | + m_playlistOptions.insertPLOption = PL_REPLACE; |
---|
84 | + doUpdatePlaylist(); |
---|
85 | + switchView(MV_PLAYLIST); |
---|
86 | + } |
---|
87 | + else |
---|
88 | + { |
---|
89 | + handled = false; |
---|
90 | + } |
---|
91 | + } |
---|
92 | + } |
---|
93 | + } |
---|
94 | else |
---|
95 | handled = false; |
---|
96 | } |
---|