bool EpgSearchFilter::MatchChannelGroup(const CEpgInfoTag &tag) const { bool bReturn(true); if (m_iChannelGroup != EPG_SEARCH_UNSET && g_PVRManager.IsStarted()) { CPVRChannelGroupPtr group = g_PVRChannelGroups->GetByIdFromAll(m_iChannelGroup); bReturn = (group && group->IsGroupMember(*tag.ChannelTag())); } return bReturn; }
void CPVRChannelGroups::RemoveFromAllGroups(const CPVRChannelPtr &channel) { CSingleLock lock(m_critSection); const CPVRChannelGroupPtr allGroup = GetGroupAll(); for (const auto& group : m_groups) { // only delete the channel from non-system groups and if it was deleted from "all" group if (!group->IsInternalGroup() && !allGroup->IsGroupMember(channel)) group->RemoveFromGroup(channel); } }
bool CPVREpgSearchFilter::MatchChannelGroup(const CPVREpgInfoTagPtr &tag) const { bool bReturn(true); if (m_iChannelGroup != EPG_SEARCH_UNSET && CServiceBroker::GetPVRManager().IsStarted()) { CPVRChannelGroupPtr group = CServiceBroker::GetPVRManager().ChannelGroups()->GetByIdFromAll(m_iChannelGroup); bReturn = (group && group->IsGroupMember(tag->Channel())); } return bReturn; }
void CPVRManager::SetPlayingGroup(const CPVRChannelPtr &channel) { CPVRChannelGroupPtr group = m_channelGroups->GetSelectedGroup(channel->IsRadio()); if (!group || !group->IsGroupMember(channel)) { // The channel we'll switch to is not part of the current selected group. // Set the first group as the selected group where the channel is a member. CPVRChannelGroups *channelGroups = m_channelGroups->Get(channel->IsRadio()); std::vector<CPVRChannelGroupPtr> groups = channelGroups->GetGroupsByChannel(channel, true); if (!groups.empty()) channelGroups->SetSelectedGroup(groups.front()); } }
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message) { switch (message.GetMessage()) { case GUI_MSG_WINDOW_INIT: { // check whether we've come back here from a window during which time we've actually // stopped playing videos if (message.GetParam1() == WINDOW_INVALID && !g_application.IsPlayingVideo()) { // why are we here if nothing is playing??? g_windowManager.PreviousWindow(); return true; } g_infoManager.SetShowInfo(false); g_infoManager.SetShowCodec(false); m_bShowCurrentTime = false; m_bGroupSelectShow = false; g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off. // switch resolution g_graphicsContext.SetFullScreenVideo(true); #ifdef HAS_VIDEO_PLAYBACK // make sure renderer is uptospeed g_renderManager.Update(false); #endif // now call the base class to load our windows CGUIWindow::OnMessage(message); m_bShowViewModeInfo = false; if (CUtil::IsUsingTTFSubtitles()) { CSingleLock lock (m_fontLock); CStdString fontPath = "special://xbmc/media/Fonts/"; fontPath += g_guiSettings.GetString("subtitles.font"); // We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions. RESOLUTION_INFO pal(720, 576, 0); CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, &pal, true); CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, &pal, true); if (!subFont || !borderFont) CLog::Log(LOGERROR, "CGUIWindowFullScreen::OnMessage(WINDOW_INIT) - Unable to load subtitle font"); else m_subsLayout = new CGUITextLayout(subFont, true, 0, borderFont); } else m_subsLayout = NULL; return true; } case GUI_MSG_WINDOW_DEINIT: { CGUIWindow::OnMessage(message); CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT); if (pDialog) pDialog->Close(true); CGUIDialogSlider *slider = (CGUIDialogSlider *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER); if (slider) slider->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER); if (pDialog) pDialog->Close(true); FreeResources(true); CSingleLock lock (g_graphicsContext); g_graphicsContext.SetFullScreenVideo(false); lock.Leave(); #ifdef HAS_VIDEO_PLAYBACK // make sure renderer is uptospeed g_renderManager.Update(false); #endif CSingleLock lockFont(m_fontLock); if (m_subsLayout) { g_fontManager.Unload("__subtitle__"); g_fontManager.Unload("__subtitleborder__"); delete m_subsLayout; m_subsLayout = NULL; } return true; } case GUI_MSG_CLICKED: { unsigned int iControl = message.GetSenderId(); if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted()) { // Get the currently selected label of the Select button CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl); OnMessage(msg); CStdString strLabel = msg.GetLabel(); CPVRChannelPtr playingChannel; if (g_PVRManager.GetCurrentChannel(playingChannel)) { CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel); if (selectedGroup) { g_PVRManager.SetPlayingGroup(selectedGroup); CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str()); if (!selectedGroup->IsGroupMember(*playingChannel)) { CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group", __FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str()); CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1); if (switchChannel && switchChannel->HasPVRChannelInfoTag()) OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber())); else { CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str()); CApplicationMessenger::Get().MediaStop(false); } } } else { CLog::Log(LOGERROR, "%s - could not switch to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str()); CApplicationMessenger::Get().MediaStop(false); } } else { CLog::Log(LOGERROR, "%s - cannot find the current channel", __FUNCTION__); CApplicationMessenger::Get().MediaStop(false); } // hide the control and reset focus m_bGroupSelectShow = false; SET_CONTROL_HIDDEN(CONTROL_GROUP_CHOOSER); // SET_CONTROL_FOCUS(0, 0); return true; } break; } case GUI_MSG_SETFOCUS: case GUI_MSG_LOSTFOCUS: if (message.GetSenderId() != WINDOW_FULLSCREEN_VIDEO) return true; break; } return CGUIWindow::OnMessage(message); }
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message) { switch (message.GetMessage()) { case GUI_MSG_WINDOW_INIT: { // check whether we've come back here from a window during which time we've actually // stopped playing videos if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo()) { // why are we here if nothing is playing??? g_windowManager.PreviousWindow(); return true; } g_infoManager.SetShowInfo(false); g_infoManager.SetShowCodec(false); m_bShowCurrentTime = false; m_bGroupSelectShow = false; g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off. // switch resolution g_graphicsContext.SetFullScreenVideo(true); #ifdef HAS_VIDEO_PLAYBACK // make sure renderer is uptospeed g_renderManager.Update(); #endif // now call the base class to load our windows CGUIWindow::OnMessage(message); m_bShowViewModeInfo = false; return true; } case GUI_MSG_WINDOW_DEINIT: { CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SUBTITLES); if (pDialog) pDialog->Close(true); CGUIWindow::OnMessage(message); CSettings::Get().Save(); CSingleLock lock (g_graphicsContext); g_graphicsContext.SetFullScreenVideo(false); lock.Leave(); #ifdef HAS_VIDEO_PLAYBACK // make sure renderer is uptospeed g_renderManager.Update(); #endif return true; } case GUI_MSG_CLICKED: { unsigned int iControl = message.GetSenderId(); if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted()) { // Get the currently selected label of the Select button CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl); OnMessage(msg); CStdString strLabel = msg.GetLabel(); CPVRChannelPtr playingChannel; if (g_PVRManager.GetCurrentChannel(playingChannel)) { CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel); if (selectedGroup) { g_PVRManager.SetPlayingGroup(selectedGroup); CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str()); if (!selectedGroup->IsGroupMember(*playingChannel)) { CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group", __FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str()); CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1); if (switchChannel && switchChannel->HasPVRChannelInfoTag()) g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber())); else { CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str()); CApplicationMessenger::Get().MediaStop(false); } } } else { CLog::Log(LOGERROR, "%s - could not switch to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str()); CApplicationMessenger::Get().MediaStop(false); } } else { CLog::Log(LOGERROR, "%s - cannot find the current channel", __FUNCTION__); CApplicationMessenger::Get().MediaStop(false); } // hide the control and reset focus m_bGroupSelectShow = false; SET_CONTROL_HIDDEN(CONTROL_GROUP_CHOOSER); // SET_CONTROL_FOCUS(0, 0); return true; } break; } case GUI_MSG_SETFOCUS: case GUI_MSG_LOSTFOCUS: if (message.GetSenderId() != WINDOW_FULLSCREEN_VIDEO) return true; break; } return CGUIWindow::OnMessage(message); }