Permalink
Browse files

[pvr] Show last view when restoring the PVR window.

Workaround for the problem, that the default PVR windows is shown, when the empty items list loses the focus during update. This is accomplished by adding some dummy entry. Also saves the window history, when the window is unloaded.
  • Loading branch information...
1 parent c606dbf commit 71ac2a8dd01124289cacd2e614425af206257038 @axmhari committed Nov 15, 2012
@@ -207,7 +207,7 @@ void CGUIWindowPVRChannels::UpdateData(bool bUpdateSelectedFile /* = true */)
CPVRChannelGroupPtr selectedGroup = SelectedGroup();
m_iSelected = m_parent->m_viewControl.GetSelectedItem();
- m_parent->m_viewControl.Clear();
+ PrepareListUpdate();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
@@ -190,6 +190,7 @@ bool CGUIWindowPVRCommon::OnMessageFocus(CGUIMessage &message)
void CGUIWindowPVRCommon::OnWindowUnload(void)
{
m_iSelected = m_parent->m_viewControl.GetSelectedItem();
+ m_history = m_parent->m_history;
}
bool CGUIWindowPVRCommon::OnAction(const CAction &action)
@@ -869,3 +870,15 @@ bool CGUIWindowPVRCommon::OnContextButtonFind(CFileItem *item, CONTEXT_BUTTON bu
return bReturn;
}
+
+void CGUIWindowPVRCommon::PrepareListUpdate(void)
+{
+ /* FIXME: display a temporary entry so that the list can keep its focus */
+ static CFileItemList busy_items;
+ if (busy_items.IsEmpty())
+ {
+ CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(194)));
+ busy_items.AddFront(pItem, 0);
+ }
+ m_parent->m_viewControl.SetItems(busy_items);
+}
@@ -119,6 +119,7 @@ namespace PVR
virtual bool UpdateEpgForChannel(CFileItem *item);
virtual bool ShowTimerSettings(CFileItem *item);
virtual bool ShowNewTimerDialog(void);
+ virtual void PrepareListUpdate(void);
virtual bool OnContextButtonMenuHooks(CFileItem *item, CONTEXT_BUTTON button);
virtual bool OnContextButtonSortAsc(CFileItem *item, CONTEXT_BUTTON button);
@@ -270,7 +270,7 @@ void CGUIWindowPVRGuide::UpdateData(bool bUpdateSelectedFile /* = true */)
/* lock the graphics context while updating */
CSingleLock graphicsLock(g_graphicsContext);
- m_parent->m_viewControl.Clear();
+ PrepareListUpdate();
m_parent->m_vecItems->Clear();
if (m_iGuideView == GUIDE_VIEW_CHANNEL)
@@ -208,7 +208,7 @@ void CGUIWindowPVRRecordings::UpdateData(bool bUpdateSelectedFile /* = true */)
else
m_strSelectedPath = m_parent->m_vecItems->GetPath();
- m_parent->m_viewControl.Clear();
+ PrepareListUpdate();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
m_parent->m_vecItems->SetPath(m_strSelectedPath);
@@ -101,7 +101,7 @@ void CGUIWindowPVRSearch::UpdateData(bool bUpdateSelectedFile /* = true */)
CSingleLock graphicsLock(g_graphicsContext);
m_iSelected = m_parent->m_viewControl.GetSelectedItem();
- m_parent->m_viewControl.Clear();
+ PrepareListUpdate();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
@@ -105,7 +105,7 @@ void CGUIWindowPVRTimers::UpdateData(bool bUpdateSelectedFile /* = true */)
CSingleLock graphicsLock(g_graphicsContext);
m_iSelected = m_parent->m_viewControl.GetSelectedItem();
- m_parent->m_viewControl.Clear();
+ PrepareListUpdate();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
m_parent->m_vecItems->SetPath("pvr://timers/");

0 comments on commit 71ac2a8

Please sign in to comment.