Permalink
Browse files

Merge pull request #8144 from ksooo/fix-find-similar-for-timers

[PVR] Search window fixes
  • Loading branch information...
2 parents 8899d0b + b8d1957 commit 9a8f353869feaecc260c0c7c2288dd49fcc378b4 @ksooo ksooo committed Sep 29, 2015
Showing with 27 additions and 15 deletions.
  1. +27 −15 xbmc/pvr/windows/GUIWindowPVRSearch.cpp
View
42 xbmc/pvr/windows/GUIWindowPVRSearch.cpp
@@ -121,15 +121,21 @@ bool CGUIWindowPVRSearch::OnContextButton(const CFileItem &item, CONTEXT_BUTTON
m_searchfilter.m_strSearchTerm = "\"" + item.GetEPGInfoTag()->Title() + "\"";
else if (item.IsPVRChannel())
{
- CEpgInfoTagPtr tag(item.GetPVRChannelInfoTag()->GetEPGNow());
+ const CEpgInfoTagPtr tag(item.GetPVRChannelInfoTag()->GetEPGNow());
if (tag)
m_searchfilter.m_strSearchTerm = "\"" + tag->Title() + "\"";
}
else if (item.IsUsablePVRRecording())
m_searchfilter.m_strSearchTerm = "\"" + item.GetPVRRecordingInfoTag()->m_strTitle + "\"";
else if (item.IsPVRTimer())
- m_searchfilter.m_strSearchTerm = "\"" + item.GetPVRTimerInfoTag()->m_strTitle + "\"";
-
+ {
+ const CPVRTimerInfoTagPtr info(item.GetPVRTimerInfoTag());
+ const CEpgInfoTagPtr tag(info->GetEpgInfoTag());
+ if (tag)
+ m_searchfilter.m_strSearchTerm = "\"" + tag->Title() + "\"";
+ else
+ m_searchfilter.m_strSearchTerm = "\"" + info->m_strTitle + "\"";
+ }
m_bSearchConfirmed = true;
Refresh(true);
bReturn = true;
@@ -144,20 +150,19 @@ bool CGUIWindowPVRSearch::OnContextButton(const CFileItem &item, CONTEXT_BUTTON
void CGUIWindowPVRSearch::OnPrepareFileItems(CFileItemList &items)
{
- items.Clear();
-
- CFileItemPtr item(new CFileItem("pvr://guide/searchresults/search/", true));
- item->SetLabel(g_localizeStrings.Get(19140));
- item->SetLabelPreformated(true);
- item->SetSpecialSort(SortSpecialOnTop);
- items.Add(item);
+ bool bAddSpecialSearchItem = items.IsEmpty();
if (m_bSearchConfirmed)
{
+ m_bSearchConfirmed = false;
+
+ items.Clear();
+ bAddSpecialSearchItem = true;
+
CGUIDialogProgress* dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (dlgProgress)
{
- dlgProgress->SetHeading(CVariant{194});
+ dlgProgress->SetHeading(CVariant{194}); // "Searching..."
dlgProgress->SetText(CVariant{m_searchfilter.m_strSearchTerm});
dlgProgress->Open();
dlgProgress->Progress();
@@ -170,10 +175,17 @@ void CGUIWindowPVRSearch::OnPrepareFileItems(CFileItemList &items)
dlgProgress->Close();
if (items.IsEmpty())
- {
- CGUIDialogOK::ShowAndGetInput(CVariant{194}, CVariant{284});
- m_bSearchConfirmed = false;
- }
+ CGUIDialogOK::ShowAndGetInput(CVariant{194}, // "Searching..."
+ CVariant{284}); // "No results found"
+ }
+
+ if (bAddSpecialSearchItem)
+ {
+ CFileItemPtr item(new CFileItem("pvr://guide/searchresults/search/", true));
+ item->SetLabel(g_localizeStrings.Get(19140)); // "Search..."
+ item->SetLabelPreformated(true);
+ item->SetSpecialSort(SortSpecialOnTop);
+ items.Add(item);
}
}

0 comments on commit 9a8f353

Please sign in to comment.