Skip to content

Commit

Permalink
Make music Videos Playback upon selection, part of xbmc#1477
Browse files Browse the repository at this point in the history
  • Loading branch information
LongChair committed Mar 8, 2015
1 parent 907d396 commit 2934bf5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
30 changes: 29 additions & 1 deletion plex/GUI/GUIPlexMediaWindow.cpp
Expand Up @@ -195,7 +195,7 @@ bool CGUIPlexMediaWindow::OnMessage(CGUIMessage &message)
{
CFileItemList extralist;
extralist.Copy(*(m_extraDataLoader.getItems()));
CLog::Log(LOGDEBUG,"CGUIWindowPlexPreplayVideo::OnMessage GUI_MSG_PLEX_EXTRA_DATA_LOADED (%d)", extralist.Size());
CLog::Log(LOGDEBUG,"CGUIPlexMediaWindow::OnMessage GUI_MSG_PLEX_EXTRA_DATA_LOADED (%d)", extralist.Size());

if (extralist.Size())
{
Expand Down Expand Up @@ -575,6 +575,17 @@ bool CGUIPlexMediaWindow::OnAction(const CAction &action)
}
}

if (action.GetID() == ACTION_SELECT_ITEM)
{
// if we pick an extra, play it !
CFileItemPtr extraItem = getSelectedExtraItem();
if (extraItem)
{
g_application.PlayFile(*extraItem, extraItem->GetProperty("extratype").asInteger() == 1);
return true;
}
}

if (g_plexApplication.defaultActionHandler->OnAction(WINDOW_VIDEO_NAV, action, m_vecItems->Get(m_viewControl.GetSelectedItem()), m_vecItems))
return true;

Expand Down Expand Up @@ -1467,3 +1478,20 @@ CStdString CGUIPlexMediaWindow::GetLevelURL()

return levelUrl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
CFileItemPtr CGUIPlexMediaWindow::getSelectedExtraItem()
{
int focusedControl = GetFocusedControlID();
if (focusedControl == EXTRAS_LIST_CONTROL_ID)
{
CGUIBaseContainer* container = (CGUIBaseContainer*)(GetControl(focusedControl));
if (container)
{
CGUIListItemPtr listItem = container->GetListItem(0);
if (listItem && listItem->IsFileItem())
return boost::static_pointer_cast<CFileItem>(listItem);
}
}
return CFileItemPtr();
}
1 change: 1 addition & 0 deletions plex/GUI/GUIPlexMediaWindow.h
Expand Up @@ -125,6 +125,7 @@ class CGUIPlexMediaWindow : public CGUIMediaWindow, public IJobCallback
std::string GetFilteredURI(const CFileItem &item) const;

CStdString GetLevelURL();
CFileItemPtr getSelectedExtraItem();

bool m_hasAdvancedFilters;
CCriticalSection m_filterValuesSection;
Expand Down

0 comments on commit 2934bf5

Please sign in to comment.