Skip to content

Commit

Permalink
[pvr] use busy dialog in all pvr windows and wait until manager has b…
Browse files Browse the repository at this point in the history
…e started
  • Loading branch information
xhaggi committed Jul 30, 2015
1 parent 1e1cf4e commit 7c078f3
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions xbmc/pvr/windows/GUIWindowPVRBase.cpp
Expand Up @@ -27,6 +27,7 @@
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogSelect.h"
#include "dialogs/GUIDialogBusy.h"
#include "filesystem/StackDirectory.h"
#include "input/Key.h"
#include "guilib/GUIMessage.h"
Expand All @@ -39,6 +40,7 @@
#include "pvr/dialogs/GUIDialogPVRTimerSettings.h"
#include "pvr/timers/PVRTimers.h"
#include "epg/Epg.h"
#include "epg/EpgContainer.h"
#include "epg/GUIEPGGridContainer.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
Expand Down Expand Up @@ -125,12 +127,45 @@ void CGUIWindowPVRBase::OnInitWindow(void)
{
if (!g_PVRManager.IsStarted() || !g_PVRClients->HasConnectedClients())
{
g_windowManager.PreviousWindow();
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning,
g_localizeStrings.Get(19045),
g_localizeStrings.Get(19044));
return;
// wait until the PVR manager has been started
CGUIDialogBusy* dialog = dynamic_cast<CGUIDialogBusy*>(g_windowManager.GetWindow(WINDOW_DIALOG_BUSY));
if (dialog)
{
dialog->Open();

// do not block the gfx context while waiting
CSingleExit exit(g_graphicsContext);

CEvent event(true);
while(!event.WaitMSec(1))
{
if (g_PVRManager.IsStarted() && g_PVRClients->HasConnectedClients())
event.Set();

if (dialog->IsCanceled())
{
// return to previous window if canceled
dialog->Close();
g_windowManager.PreviousWindow();
return;
}

g_windowManager.ProcessRenderLoop(false);
}

dialog->Close();
}
}

{
// set window group to playing group
CPVRChannelGroupPtr group = g_PVRManager.GetPlayingGroup(m_bRadio);
CSingleLock lock(m_critSection);
if (m_group != group)
m_viewControl.SetSelectedItem(0);
m_group = group;
}
SetProperty("IsRadio", m_bRadio ? "true" : "");

m_vecItems->SetPath(GetDirectoryPath());

Expand All @@ -149,16 +184,6 @@ bool CGUIWindowPVRBase::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
CPVRChannelGroupPtr group = g_PVRManager.GetPlayingGroup(m_bRadio);
if (m_group != group)
m_viewControl.SetSelectedItem(0);
m_group = group;
SetProperty("IsRadio", m_bRadio ? "true" : "");
}
break;

case GUI_MSG_CLICKED:
{
switch (message.GetSenderId())
Expand Down

0 comments on commit 7c078f3

Please sign in to comment.