Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bluray] Add way to select playback title or menu's on bluray startup

  • Loading branch information...
commit 8882678385450149abb23b621afd8f0302c3cecc 1 parent a04efb7
Joakim Plate authored
74 xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1048,6 +1048,77 @@ bool CGUIWindowVideoBase::ShowResumeMenu(CFileItem &item)
1048 1048 return true;
1049 1049 }
1050 1050
  1051 +bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item)
  1052 +{
  1053 + /* if asked to resume somewhere, we should not show anything */
  1054 + if (item->m_lStartOffset)
  1055 + return true;
  1056 +
  1057 + if (item->IsBDFile())
  1058 + {
  1059 + CStdString root = URIUtils::GetParentPath(item->GetPath());
  1060 + URIUtils::RemoveSlashAtEnd(root);
  1061 + if(URIUtils::GetFileName(root) == "BDMV")
  1062 + {
  1063 + CURL url("bluray://");
  1064 + url.SetHostName(URIUtils::GetParentPath(root));
  1065 + return ShowPlaySelection(item, url.Get());
  1066 + }
  1067 + }
  1068 +
  1069 + return true;
  1070 +}
  1071 +
  1072 +bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item, const CStdString& directory)
  1073 +{
  1074 +
  1075 + CFileItemList items;
  1076 +
  1077 + if (!XFILE::CDirectory::GetDirectory(directory, items, XFILE::CDirectory::CHints(), true))
  1078 + {
  1079 + CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get play directory for %s", directory.c_str());
  1080 + return true;
  1081 + }
  1082 +
  1083 + if (items.Size() == 0)
  1084 + {
  1085 + CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", directory.c_str());
  1086 + return true;
  1087 + }
  1088 +
  1089 + CGUIDialogSelect* dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
  1090 + while(true)
  1091 + {
  1092 + dialog->Reset();
  1093 + dialog->SetHeading("Select playback item");
  1094 + dialog->SetItems(&items);
  1095 + dialog->SetUseDetails(true);
  1096 + dialog->DoModal();
  1097 +
  1098 + CFileItemPtr item_new = dialog->GetSelectedItem();
  1099 + if(!item_new || dialog->GetSelectedLabel() < 0)
  1100 + {
  1101 + CLog::Log(LOGDEBUG, "CGUIWindowVideoBase::ShowPlaySelection - User aborted %s", directory.c_str());
  1102 + break;
  1103 + }
  1104 +
  1105 + if(item_new->m_bIsFolder == false)
  1106 + {
  1107 + item = item_new;
  1108 + return true;
  1109 + }
  1110 +
  1111 + items.Clear();
  1112 + if(!XFILE::CDirectory::GetDirectory(item_new->GetPath(), items, XFILE::CDirectory::CHints(), true) || items.Size() == 0)
  1113 + {
  1114 + CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", item_new->GetPath().c_str());
  1115 + break;
  1116 + }
  1117 + }
  1118 +
  1119 + return false;
  1120 +}
  1121 +
1051 1122 bool CGUIWindowVideoBase::OnResumeItem(int iItem)
1052 1123 {
1053 1124 if (iItem < 0 || iItem >= m_vecItems->Size()) return true;
@@ -1418,6 +1489,9 @@ void CGUIWindowVideoBase::PlayMovie(const CFileItem *item)
1418 1489 {
1419 1490 CFileItemPtr movieItem(new CFileItem(*item));
1420 1491
  1492 + if(!ShowPlaySelection(movieItem))
  1493 + return;
  1494 +
1421 1495 g_playlistPlayer.Reset();
1422 1496 g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
1423 1497 CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_VIDEO);
5 xbmc/video/windows/GUIWindowVideoBase.h
@@ -43,6 +43,11 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse
43 43 static void MarkWatched(const CFileItemPtr &pItem, bool bMark);
44 44 static void UpdateVideoTitle(const CFileItem* pItem);
45 45
  46 + /*! \brief Show dialog allowing selection of wanted playback item */
  47 + static bool ShowPlaySelection(CFileItemPtr& item);
  48 + static bool ShowPlaySelection(CFileItemPtr& item, const CStdString& directory);
  49 +
  50 +
46 51 /*! \brief Show the resume menu for this item (if it has a resume bookmark)
47 52 If a resume bookmark is found, we set the item's m_lStartOffset to STARTOFFSET_RESUME
48 53 \param item item to check for a resume bookmark

0 comments on commit 8882678

Please sign in to comment.
Something went wrong with that request. Please try again.