Skip to content

Commit

Permalink
Merge pull request xbmc#1689 from koying/playlistplayusing
Browse files Browse the repository at this point in the history
FIX: Add missing "Play with" to playlist viewers
  • Loading branch information
elupus committed Nov 2, 2012
2 parents e292b11 + 5f822c4 commit 0f6fb94
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
21 changes: 21 additions & 0 deletions xbmc/music/windows/GUIWindowMusicPlaylist.cpp
Expand Up @@ -514,6 +514,12 @@ void CGUIWindowMusicPlayList::GetContextButtons(int itemNumber, CContextButtons
}
else
{ // aren't in a move
// check what players we have, if we have multiple display play with option
VECPLAYERCORES vecCores;
CPlayerCoreFactory::GetPlayers(*item, vecCores);
if (vecCores.size() > 1)
buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...

if (!item->IsLastFM())
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
if (CFavourites::IsFavourite(item.get(), GetID()))
Expand Down Expand Up @@ -542,6 +548,21 @@ bool CGUIWindowMusicPlayList::OnContextButton(int itemNumber, CONTEXT_BUTTON but
{
switch (button)
{
case CONTEXT_BUTTON_PLAY_WITH:
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (!item)
break;

VECPLAYERCORES vecCores;
CPlayerCoreFactory::GetPlayers(*item, vecCores);
g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
if( g_application.m_eForcedNextPlayer != EPC_NONE )
OnClick(itemNumber);
return true;
}
case CONTEXT_BUTTON_MOVE_ITEM:
m_movingFrom = itemNumber;
return true;
Expand Down
37 changes: 36 additions & 1 deletion xbmc/video/windows/GUIWindowVideoPlaylist.cpp
Expand Up @@ -393,7 +393,20 @@ void CGUIWindowVideoPlaylist::GetContextButtons(int itemNumber, CContextButtons
{
if (itemNumber > -1)
{
if (CFavourites::IsFavourite(m_vecItems->Get(itemNumber).get(), GetID()))
CFileItemPtr item = m_vecItems->Get(itemNumber);
// check what players we have, if we have multiple display play with option
VECPLAYERCORES vecCores;
if (item->IsVideoDb())
{
CFileItem item2(item->GetVideoInfoTag()->m_strFileNameAndPath, false);
CPlayerCoreFactory::GetPlayers(item2, vecCores);
}
else
CPlayerCoreFactory::GetPlayers(*item, vecCores);
if (vecCores.size() > 1)
buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...

if (CFavourites::IsFavourite(item.get(), GetID()))
buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14077); // Remove Favourite
else
buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14076); // Add To Favourites;
Expand All @@ -419,6 +432,28 @@ bool CGUIWindowVideoPlaylist::OnContextButton(int itemNumber, CONTEXT_BUTTON but
{
switch (button)
{
case CONTEXT_BUTTON_PLAY_WITH:
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (!item)
break;

VECPLAYERCORES vecCores;
if (item->IsVideoDb())
{
CFileItem item2(*item->GetVideoInfoTag());
CPlayerCoreFactory::GetPlayers(item2, vecCores);
}
else
CPlayerCoreFactory::GetPlayers(*item, vecCores);
g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
if (g_application.m_eForcedNextPlayer != EPC_NONE)
OnClick(itemNumber);
return true;
}

case CONTEXT_BUTTON_MOVE_ITEM:
m_movingFrom = itemNumber;
return true;
Expand Down

0 comments on commit 0f6fb94

Please sign in to comment.