2 * Copyright (C) 2012-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "GUIWindowPVRCommon.h"
23 #include "Application.h"
24 #include "ApplicationMessenger.h"
25 #include "dialogs/GUIDialogKaiToast.h"
26 #include "dialogs/GUIDialogOK.h"
27 #include "dialogs/GUIDialogYesNo.h"
28 #include "filesystem/StackDirectory.h"
29 #include "guilib/GUIMessage.h"
30 #include "guilib/GUIWindowManager.h"
31 #include "guilib/Key.h"
32 #include "guilib/LocalizeStrings.h"
33 #include "pvr/PVRManager.h"
34 #include "pvr/channels/PVRChannelGroupsContainer.h"
35 #include "pvr/dialogs/GUIDialogPVRGuideInfo.h"
36 #include "pvr/dialogs/GUIDialogPVRRecordingInfo.h"
37 #include "pvr/dialogs/GUIDialogPVRTimerSettings.h"
39 #include "pvr/timers/PVRTimers.h"
40 #include "pvr/addons/PVRClients.h"
41 #include "pvr/windows/GUIWindowPVR.h"
42 #include "pvr/windows/GUIWindowPVRSearch.h"
43 #include "pvr/recordings/PVRRecordings.h"
44 #include "settings/MediaSettings.h"
45 #include "settings/Settings.h"
46 #include "utils/log.h"
47 #include "utils/URIUtils.h"
48 #include "GUIUserMessages.h"
49 #include "cores/IPlayer.h"
55 CGUIWindowPVRCommon::CGUIWindowPVRCommon(CGUIWindowPVR *parent, PVRWindow window,
56 unsigned int iControlButton, unsigned int iControlList)
60 m_iControlButton = iControlButton;
61 m_iControlList = iControlList;
62 m_bUpdateRequired = false;
64 m_iSortOrder = SortOrderAscending;
65 m_iSortMethod = SortByDate;
66 m_iSortAttributes = SortAttributeNone;
67 if( m_parent->GetViewState() )
69 SortDescription sorting = m_parent->GetViewState()->GetSortMethod();
70 m_iSortOrder = sorting.sortOrder;
71 m_iSortMethod = sorting.sortBy;
72 m_iSortAttributes = sorting.sortAttributes;
76 bool CGUIWindowPVRCommon::operator ==(const CGUIWindowPVRCommon &right) const
78 return (this == &right || m_window == right.m_window);
81 bool CGUIWindowPVRCommon::operator !=(const CGUIWindowPVRCommon &right) const
83 return !(*this == right);
86 const char *CGUIWindowPVRCommon::GetName(void) const
92 case PVR_WINDOW_CHANNELS_RADIO:
94 case PVR_WINDOW_CHANNELS_TV:
96 case PVR_WINDOW_RECORDINGS:
98 case PVR_WINDOW_SEARCH:
100 case PVR_WINDOW_TIMERS:
107 bool CGUIWindowPVRCommon::IsFocused(void) const
109 return !g_application.IsPlayingFullScreenVideo() &&
110 g_windowManager.GetFocusedWindow() == WINDOW_PVR &&
114 bool CGUIWindowPVRCommon::IsVisible(void) const
116 return !g_application.IsPlayingFullScreenVideo() &&
117 g_windowManager.GetActiveWindow() == WINDOW_PVR &&
121 bool CGUIWindowPVRCommon::IsActive(void) const
123 CGUIWindowPVRCommon *window = m_parent->GetActiveView();
124 return (window && *window == *this);
127 bool CGUIWindowPVRCommon::IsSavedView(void) const
129 CGUIWindowPVRCommon *window = m_parent->GetSavedView();
130 return (window && *window == *this);
133 bool CGUIWindowPVRCommon::IsSelectedButton(CGUIMessage &message) const
135 return (message.GetSenderId() == (int) m_iControlButton);
138 bool CGUIWindowPVRCommon::IsSelectedControl(CGUIMessage &message) const
140 return (message.GetControlId() == (int) m_iControlButton);
143 bool CGUIWindowPVRCommon::IsSelectedList(CGUIMessage &message) const
145 return (message.GetSenderId() == (int) m_iControlList);
148 void CGUIWindowPVRCommon::SetInvalid()
150 for (int iItemPtr = 0; iItemPtr < m_parent->m_vecItems->Size(); iItemPtr++)
151 m_parent->m_vecItems->Get(iItemPtr)->SetInvalid();
152 m_parent->SetInvalid();
155 void CGUIWindowPVRCommon::OnInitWindow()
157 m_parent->m_viewControl.SetCurrentView(m_iControlList);
160 bool CGUIWindowPVRCommon::SelectPlayingFile(void)
164 if (g_PVRManager.IsPlaying())
166 m_parent->m_viewControl.SetSelectedItem(g_application.CurrentFile());
173 bool CGUIWindowPVRCommon::OnMessageFocus(CGUIMessage &message)
175 bool bReturn = false;
177 if (message.GetMessage() == GUI_MSG_FOCUSED &&
178 (IsSelectedControl(message) || IsSavedView()))
180 CLog::Log(LOGDEBUG, "CGUIWindowPVRCommon - %s - focus set to window '%s'", __FUNCTION__, GetName());
181 bool bIsActive = IsActive();
182 m_parent->SetActiveView(this);
184 if (!bIsActive || m_bUpdateRequired)
193 void CGUIWindowPVRCommon::OnWindowUnload(void)
195 m_iSelected = m_parent->m_viewControl.GetSelectedItem();
196 m_history = m_parent->m_history;
199 bool CGUIWindowPVRCommon::OnAction(const CAction &action)
201 bool bReturn = false;
203 if (action.GetID() == ACTION_NAV_BACK ||
204 action.GetID() == ACTION_PREVIOUS_MENU)
206 g_windowManager.PreviousWindow();
213 bool CGUIWindowPVRCommon::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
215 if (itemNumber < 0 || itemNumber >= (int) m_parent->m_vecItems->Size())
217 CFileItemPtr pItem = m_parent->m_vecItems->Get(itemNumber);
219 return (OnContextButtonSortAsc(pItem.get(), button) ||
220 OnContextButtonSortBy(pItem.get(), button) ||
221 OnContextButtonSortByChannel(pItem.get(), button) ||
222 OnContextButtonSortByName(pItem.get(), button) ||
223 OnContextButtonSortByDate(pItem.get(), button) ||
224 OnContextButtonFind(pItem.get(), button) ||
225 OnContextButtonMenuHooks(pItem.get(), button));
228 bool CGUIWindowPVRCommon::OnContextButtonSortByDate(CFileItem *item, CONTEXT_BUTTON button)
230 bool bReturn = false;
232 if (button == CONTEXT_BUTTON_SORTBY_DATE)
236 if (m_iSortMethod != SortByDate)
238 m_iSortMethod = SortByDate;
239 m_iSortOrder = SortOrderAscending;
240 CGUIMessage message(GUI_MSG_CHANGE_SORT_METHOD, m_parent->GetID(), 0, m_iSortMethod, 0);
241 m_parent->OnMessage(message);
245 m_iSortOrder = m_iSortOrder == SortOrderAscending ? SortOrderDescending : SortOrderAscending;
247 CGUIMessage message(GUI_MSG_CHANGE_SORT_DIRECTION, m_parent->GetID(), 0, m_iSortOrder, 0);
248 m_parent->OnMessage(message);
255 bool CGUIWindowPVRCommon::OnContextButtonSortByName(CFileItem *item, CONTEXT_BUTTON button)
257 bool bReturn = false;
259 if (button == CONTEXT_BUTTON_SORTBY_NAME)
263 if (m_iSortMethod != SortByLabel)
265 m_iSortMethod = SortByLabel;
266 m_iSortOrder = SortOrderAscending;
267 CGUIMessage message(GUI_MSG_CHANGE_SORT_METHOD, m_parent->GetID(), 0, m_iSortMethod, 0);
268 m_parent->OnMessage(message);
272 m_iSortOrder = m_iSortOrder == SortOrderAscending ? SortOrderDescending : SortOrderAscending;
274 CGUIMessage message(GUI_MSG_CHANGE_SORT_DIRECTION, m_parent->GetID(), 0, m_iSortOrder, 0);
275 m_parent->OnMessage(message);
282 bool CGUIWindowPVRCommon::OnContextButtonSortByChannel(CFileItem *item, CONTEXT_BUTTON button)
284 bool bReturn = false;
286 if (button == CONTEXT_BUTTON_SORTBY_CHANNEL)
290 if (m_iSortMethod != SortByChannel)
292 m_iSortMethod = SortByChannel;
293 m_iSortOrder = SortOrderAscending;
297 m_iSortOrder = m_iSortOrder == SortOrderAscending ? SortOrderDescending : SortOrderAscending;
306 bool CGUIWindowPVRCommon::OnContextButtonSortAsc(CFileItem *item, CONTEXT_BUTTON button)
308 bool bReturn = false;
310 if (button == CONTEXT_BUTTON_SORTASC)
314 if (m_parent->m_guiState.get())
315 m_parent->m_guiState->SetNextSortOrder();
316 m_parent->UpdateFileList();
322 bool CGUIWindowPVRCommon::OnContextButtonSortBy(CFileItem *item, CONTEXT_BUTTON button)
324 bool bReturn = false;
326 if (button == CONTEXT_BUTTON_SORTBY)
330 if (m_parent->m_guiState.get())
331 m_parent->m_guiState->SetNextSortMethod();
333 m_parent->UpdateFileList();
339 bool CGUIWindowPVRCommon::OnContextButtonMenuHooks(CFileItem *item, CONTEXT_BUTTON button)
341 bool bReturn = false;
343 if (button == CONTEXT_BUTTON_MENU_HOOKS)
347 if (item->IsEPG() && item->GetEPGInfoTag()->HasPVRChannel())
348 g_PVRClients->ProcessMenuHooks(item->GetEPGInfoTag()->ChannelTag()->ClientID(), PVR_MENUHOOK_EPG, item);
349 else if (item->IsPVRChannel())
350 g_PVRClients->ProcessMenuHooks(item->GetPVRChannelInfoTag()->ClientID(), PVR_MENUHOOK_CHANNEL, item);
351 else if (item->IsPVRRecording())
352 g_PVRClients->ProcessMenuHooks(item->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING, item);
353 else if (item->IsPVRTimer())
354 g_PVRClients->ProcessMenuHooks(item->GetPVRTimerInfoTag()->m_iClientId, PVR_MENUHOOK_TIMER, item);
360 bool CGUIWindowPVRCommon::ActionDeleteTimer(CFileItem *item)
362 /* check if the timer tag is valid */
363 CPVRTimerInfoTag *timerTag = item->GetPVRTimerInfoTag();
364 if (!timerTag || timerTag->m_iClientIndex < 0)
367 /* show a confirmation dialog */
368 CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
371 pDialog->SetHeading(122);
372 pDialog->SetLine(0, 19040);
373 pDialog->SetLine(1, "");
374 pDialog->SetLine(2, timerTag->m_strTitle);
377 /* prompt for the user's confirmation */
378 if (!pDialog->IsConfirmed())
381 /* delete the timer */
382 return g_PVRTimers->DeleteTimer(*item);
385 bool CGUIWindowPVRCommon::ShowNewTimerDialog(void)
389 CPVRTimerInfoTag *newTimer = new CPVRTimerInfoTag;
390 CFileItem *newItem = new CFileItem(*newTimer);
391 if (ShowTimerSettings(newItem))
393 /* Add timer to backend */
394 bReturn = g_PVRTimers->AddTimer(*newItem->GetPVRTimerInfoTag());
403 bool CGUIWindowPVRCommon::ActionShowTimer(CFileItem *item)
405 bool bReturn = false;
407 /* Check if "Add timer..." entry is pressed by OK, if yes
408 create a new timer and open settings dialog, otherwise
409 open settings for selected timer entry */
410 if (item->GetPath() == "pvr://timers/add.timer")
412 bReturn = ShowNewTimerDialog();
416 if (ShowTimerSettings(item))
418 /* Update timer on pvr backend */
419 bReturn = g_PVRTimers->UpdateTimer(*item);
426 bool CGUIWindowPVRCommon::ActionRecord(CFileItem *item)
428 bool bReturn = false;
430 CEpgInfoTag *epgTag = item->GetEPGInfoTag();
434 CPVRChannelPtr channel = epgTag->ChannelTag();
435 if (!channel || !g_PVRManager.CheckParentalLock(*channel))
438 if (epgTag->Timer() == NULL)
440 /* create a confirmation dialog */
441 CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
445 pDialog->SetHeading(264);
446 pDialog->SetLine(0, "");
447 pDialog->SetLine(1, epgTag->Title());
448 pDialog->SetLine(2, "");
451 /* prompt for the user's confirmation */
452 if (!pDialog->IsConfirmed())
455 CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*epgTag);
458 bReturn = g_PVRTimers->AddTimer(*newTimer);
468 CGUIDialogOK::ShowAndGetInput(19033,19034,0,0);
476 bool CGUIWindowPVRCommon::ActionDeleteRecording(CFileItem *item)
478 bool bReturn = false;
480 /* check if the recording tag is valid */
481 CPVRRecording *recTag = (CPVRRecording *) item->GetPVRRecordingInfoTag();
482 if (!recTag || recTag->m_strRecordingId.empty())
485 /* show a confirmation dialog */
486 CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
489 pDialog->SetHeading(122);
490 pDialog->SetLine(0, 19043);
491 pDialog->SetLine(1, "");
492 pDialog->SetLine(2, recTag->m_strTitle);
495 /* prompt for the user's confirmation */
496 if (!pDialog->IsConfirmed())
499 /* delete the recording */
500 if (g_PVRRecordings->DeleteRecording(*item))
502 g_PVRManager.TriggerRecordingsUpdate();
509 bool CGUIWindowPVRCommon::ActionPlayChannel(CFileItem *item)
511 bool bReturn = false;
513 if (item->GetPath() == "pvr://channels/.add.channel")
515 /* show "add channel" dialog */
516 CGUIDialogOK::ShowAndGetInput(19033,0,19038,0);
522 bReturn = PlayFile(item, CSettings::Get().GetBool("pvrplayback.playminimized"));
528 bool CGUIWindowPVRCommon::ActionPlayEpg(CFileItem *item)
530 CPVRChannelPtr channel;
531 if (item && item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
532 channel = item->GetEPGInfoTag()->ChannelTag();
534 if (!channel || !g_PVRManager.CheckParentalLock(*channel))
537 CFileItem channelItem = CFileItem(*channel);
538 g_application.SwitchToFullScreen();
539 if (!PlayFile(&channelItem))
541 // CHANNELNAME could not be played. Check the log for details.
542 CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str());
543 CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
550 bool CGUIWindowPVRCommon::ActionDeleteChannel(CFileItem *item)
552 CPVRChannel *channel = item->GetPVRChannelInfoTag();
554 /* check if the channel tag is valid */
555 if (!channel || channel->ChannelNumber() <= 0)
558 /* show a confirmation dialog */
559 CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
562 pDialog->SetHeading(19039);
563 pDialog->SetLine(0, "");
564 pDialog->SetLine(1, channel->ChannelName());
565 pDialog->SetLine(2, "");
568 /* prompt for the user's confirmation */
569 if (!pDialog->IsConfirmed())
572 g_PVRChannelGroups->GetGroupAll(channel->IsRadio())->RemoveFromGroup(*channel);
578 bool CGUIWindowPVRCommon::UpdateEpgForChannel(CFileItem *item)
580 CPVRChannel *channel = item->GetPVRChannelInfoTag();
581 CEpg *epg = channel->GetEPG();
589 bool CGUIWindowPVRCommon::ShowTimerSettings(CFileItem *item)
591 /* Check item is TV timer information tag */
592 if (!item->IsPVRTimer())
594 CLog::Log(LOGERROR, "CGUIWindowPVRTimers: Can't open timer settings dialog, no timer info tag!");
598 /* Load timer settings dialog */
599 CGUIDialogPVRTimerSettings* pDlgInfo = (CGUIDialogPVRTimerSettings*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_TIMER_SETTING);
604 /* inform dialog about the file item */
605 pDlgInfo->SetTimer(item);
607 /* Open dialog window */
610 /* Get modify flag from window and return it to caller */
611 return pDlgInfo->GetOK();
615 bool CGUIWindowPVRCommon::PlayRecording(CFileItem *item, bool bPlayMinimized /* = false */)
617 if (!item->HasPVRRecordingInfoTag())
620 CStdString stream = item->GetPVRRecordingInfoTag()->m_strStreamURL;
623 CApplicationMessenger::Get().PlayFile(*item, false);
627 /* Isolate the folder from the filename */
628 size_t found = stream.find_last_of("/");
629 if (found == CStdString::npos)
630 found = stream.find_last_of("\\");
632 if (found != CStdString::npos)
634 /* Check here for asterisk at the begin of the filename */
635 if (stream[found+1] == '*')
637 /* Create a "stack://" url with all files matching the extension */
638 CStdString ext = URIUtils::GetExtension(stream);
639 CStdString dir = stream.substr(0, found).c_str();
642 CDirectory::GetDirectory(dir, items);
643 items.Sort(SortByFile, SortOrderAscending);
646 for (int i = 0; i < items.Size(); ++i)
648 if (URIUtils::HasExtension(items[i]->GetPath(), ext))
652 if (stack.size() > 0)
654 /* If we have a stack change the path of the item to it */
656 CStdString stackPath = dir.ConstructStackPath(items, stack);
657 item->SetPath(stackPath);
662 /* If no asterisk is present play only the given stream URL */
663 item->SetPath(stream);
668 CLog::Log(LOGERROR, "PVRManager - %s - can't open recording: no valid filename", __FUNCTION__);
669 CGUIDialogOK::ShowAndGetInput(19033,0,19036,0);
673 CApplicationMessenger::Get().PlayFile(*item, false);
678 bool CGUIWindowPVRCommon::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */)
680 if (item->m_bIsFolder)
685 if (item->GetPath() == g_application.CurrentFile())
687 CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, m_parent->GetID());
688 g_windowManager.SendMessage(msg);
692 CMediaSettings::Get().SetVideoStartWindowed(bPlayMinimized);
694 if (item->HasPVRRecordingInfoTag())
696 return PlayRecording(item, bPlayMinimized);
700 bool bSwitchSuccessful(false);
702 CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
704 if (channel && g_PVRManager.CheckParentalLock(*channel))
706 /* try a fast switch */
707 if (channel && (g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) &&
708 (channel->IsRadio() == g_PVRManager.IsPlayingRadio()))
710 if (channel->StreamURL().empty())
711 bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(*channel);
714 if (!bSwitchSuccessful)
716 CApplicationMessenger::Get().PlayFile(*item, false);
721 if (!bSwitchSuccessful)
723 CStdString channelName = g_localizeStrings.Get(19029); // Channel
725 channelName = channel->ChannelName();
726 CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
728 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
729 g_localizeStrings.Get(19166), // PVR information
738 bool CGUIWindowPVRCommon::StartRecordFile(CFileItem *item)
740 if (!item->HasEPGInfoTag())
743 CEpgInfoTag *tag = item->GetEPGInfoTag();
744 CPVRChannelPtr channel;
746 channel = tag->ChannelTag();
748 if (!channel || !g_PVRManager.CheckParentalLock(*channel))
751 CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(item);
752 if (timer && timer->HasPVRTimerInfoTag())
754 CGUIDialogOK::ShowAndGetInput(19033,19034,0,0);
758 CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
761 pDialog->SetHeading(264);
762 pDialog->SetLine(0, tag->PVRChannelName());
763 pDialog->SetLine(1, "");
764 pDialog->SetLine(2, tag->Title());
767 if (!pDialog->IsConfirmed())
770 CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag);
774 bReturn = g_PVRTimers->AddTimer(*newTimer);
780 bool CGUIWindowPVRCommon::StopRecordFile(CFileItem *item)
782 if (!item->HasEPGInfoTag())
785 CEpgInfoTag *tag = item->GetEPGInfoTag();
786 if (!tag || !tag->HasPVRChannel())
789 CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(item);
790 if (!timer || !timer->HasPVRTimerInfoTag() || timer->GetPVRTimerInfoTag()->m_bIsRepeating)
793 return g_PVRTimers->DeleteTimer(*timer);
796 void CGUIWindowPVRCommon::ShowEPGInfo(CFileItem *item)
798 CFileItem *tag = NULL;
799 bool bHasChannel(false);
803 tag = new CFileItem(*item);
804 if (item->GetEPGInfoTag()->HasPVRChannel())
806 channel = *item->GetEPGInfoTag()->ChannelTag();
810 else if (item->IsPVRChannel())
813 channel = *item->GetPVRChannelInfoTag();
815 if (!item->GetPVRChannelInfoTag()->GetEPGNow(epgnow))
817 CGUIDialogOK::ShowAndGetInput(19033,0,19055,0);
820 tag = new CFileItem(epgnow);
825 if (!bHasChannel || g_PVRManager.CheckParentalLock(channel))
827 CGUIDialogPVRGuideInfo* pDlgInfo = (CGUIDialogPVRGuideInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GUIDE_INFO);
830 pDlgInfo->SetProgInfo(tag);
838 void CGUIWindowPVRCommon::ShowRecordingInfo(CFileItem *item)
840 if (!item->IsPVRRecording())
843 CGUIDialogPVRRecordingInfo* pDlgInfo = (CGUIDialogPVRRecordingInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_RECORDING_INFO);
847 pDlgInfo->SetRecording(item);
851 bool CGUIWindowPVRCommon::OnContextButtonFind(CFileItem *item, CONTEXT_BUTTON button)
853 bool bReturn = false;
855 if (button == CONTEXT_BUTTON_FIND)
858 if (m_parent->m_windowSearch)
861 m_parent->m_windowSearch->m_searchfilter.Reset();
863 m_parent->m_windowSearch->m_searchfilter.m_strSearchTerm = "\"" + item->GetEPGInfoTag()->Title() + "\"";
864 else if (item->IsPVRChannel() && item->GetPVRChannelInfoTag()->GetEPGNow(tag))
865 m_parent->m_windowSearch->m_searchfilter.m_strSearchTerm = "\"" + tag.Title() + "\"";
866 else if (item->IsPVRRecording())
867 m_parent->m_windowSearch->m_searchfilter.m_strSearchTerm = "\"" + item->GetPVRRecordingInfoTag()->m_strTitle + "\"";
868 else if (item->IsPVRTimer())
869 m_parent->m_windowSearch->m_searchfilter.m_strSearchTerm = "\"" + item->GetPVRTimerInfoTag()->m_strTitle + "\"";
871 m_parent->m_windowSearch->m_bSearchConfirmed = true;
872 m_parent->SetLabel(m_iControlButton, 0);
873 m_parent->SetActiveView(m_parent->m_windowSearch);
874 m_parent->m_windowSearch->UpdateData();
875 m_parent->SetLabel(m_iControlList, 0);
876 m_parent->m_viewControl.SetFocused();
883 void CGUIWindowPVRCommon::ShowBusyItem(void)
885 // FIXME: display a temporary entry so that the list can keep its focus
886 // busy_items has to be static, because m_viewControl holds the pointer to it
887 static CFileItemList busy_items;
888 if (busy_items.IsEmpty())
890 CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(1040)));
891 busy_items.AddFront(pItem, 0);
893 m_parent->m_viewControl.SetItems(busy_items);