Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

FIX: Add missing "Play with" to playlist viewers #1689

Merged
merged 1 commit into from

3 participants

@koying
Collaborator

Extracted from #1679

@elupus elupus commented on the diff
xbmc/video/windows/GUIWindowVideoPlaylist.cpp
@@ -419,6 +426,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())
@elupus Collaborator
elupus added a note

Why is this needed. It's not done everywhere. If it's needed it feels like it would be something the playercorefactory should take care of.

@koying Collaborator
koying added a note

It's a copy-paste from GUIWindowVideoBase.cpp:1203, i.e. the original "Play using" code.
I suppose it is remove both or none, but I wouldn't have arguments for removing it from the original code.

@elupus Collaborator
elupus added a note

Ok. then we leave it as is now and remove them in one sweep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xbmc/video/windows/GUIWindowVideoPlaylist.cpp
@@ -390,10 +390,17 @@ void CGUIWindowVideoPlaylist::GetContextButtons(int itemNumber, CContextButtons
}
else
- {
- if (itemNumber > -1)
+ {
@elupus Collaborator
elupus added a note

trailing whitespace added, please remove.

@koying Collaborator
koying added a note

ack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xbmc/video/windows/GUIWindowVideoPlaylist.cpp
@@ -390,10 +390,17 @@ void CGUIWindowVideoPlaylist::GetContextButtons(int itemNumber, CContextButtons
}
else
- {
- if (itemNumber > -1)
+ {
+ if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
@elupus Collaborator
elupus added a note

It would seem we previously assumed itemNumber was valid here. You can do the same, so this diff is not needed.

@koying Collaborator
koying added a note

ack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xbmc/video/windows/GUIWindowVideoPlaylist.cpp
@@ -393,7 +393,14 @@ 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;
+ 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
@elupus Collaborator
elupus added a note

This need the IsVideoDb() check too then.

@koying Collaborator
koying added a note

Indeed. In the original code, the File Item is constructed only with the filename in that case ?!
I'll just copy-paste to keep the filiation.

@elupus Collaborator
elupus added a note

Weird that it differs this way. but if it's the way it's done in the movie settings we should do the same. but it should probably be fixed up.

@jmarshallnz Owner

Playlist window will contain only non-videodb items perhaps, as they're resolved prior to adding to the playlist?

@elupus Collaborator
elupus added a note

Well the originating code was from the original video base window. ie not playlists. So it's strange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xbmc/video/windows/GUIWindowVideoPlaylist.cpp
@@ -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)
@elupus Collaborator
elupus added a note

should be > 1 not >= 1. Change the music one too even if it's wrong in the place you copied it from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@elupus elupus merged commit 0f6fb94 into xbmc:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2012
  1. @koying
This page is out of date. Refresh to see the latest.
View
21 xbmc/music/windows/GUIWindowMusicPlaylist.cpp
@@ -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()))
@@ -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;
View
37 xbmc/video/windows/GUIWindowVideoPlaylist.cpp
@@ -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;
@@ -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())
@elupus Collaborator
elupus added a note

Why is this needed. It's not done everywhere. If it's needed it feels like it would be something the playercorefactory should take care of.

@koying Collaborator
koying added a note

It's a copy-paste from GUIWindowVideoBase.cpp:1203, i.e. the original "Play using" code.
I suppose it is remove both or none, but I wouldn't have arguments for removing it from the original code.

@elupus Collaborator
elupus added a note

Ok. then we leave it as is now and remove them in one sweep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ {
+ 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;
Something went wrong with that request. Please try again.