Skip to content

Commit

Permalink
[PVR] Guide/Search/channel window: Do not add 'Record' if backend doe…
Browse files Browse the repository at this point in the history
…s not support timers.
  • Loading branch information
ksooo committed Jan 26, 2016
1 parent ddf1bf3 commit e7da31f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
14 changes: 14 additions & 0 deletions xbmc/pvr/addons/PVRClients.cpp
Expand Up @@ -1439,6 +1439,20 @@ bool CPVRClients::GetClient(const std::string &strId, AddonPtr &addon) const
return false;
}

bool CPVRClients::SupportsTimers() const
{
PVR_CLIENTMAP clients;
GetConnectedClients(clients);

for (const auto &entry : clients)
{
if (entry.second->SupportsTimers())
return true;
}

return false;
}

bool CPVRClients::SupportsChannelGroups(int iClientId) const
{
PVR_CLIENT client;
Expand Down
6 changes: 6 additions & 0 deletions xbmc/pvr/addons/PVRClients.h
Expand Up @@ -322,6 +322,12 @@ namespace PVR
/*! @name Timer methods */
//@{

/*!
* @brief Check whether there is at least one connected client supporting timers.
* @return True if at least one connected client supports timers, false otherwise.
*/
bool SupportsTimers() const;

/*!
* @brief Check whether a client supports timers.
* @param iClientId The id of the client to check.
Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvr/windows/GUIWindowPVRChannels.cpp
Expand Up @@ -85,7 +85,7 @@ void CGUIWindowPVRChannels::GetContextButtons(int itemNumber, CContextButtons &b

if (channel->IsRecording())
buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */
else
else if (g_PVRClients->SupportsTimers(channel->ClientID()))
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */

if (ActiveAE::CActiveAEDSP::GetInstance().IsProcessing())
Expand Down
5 changes: 3 additions & 2 deletions xbmc/pvr/windows/GUIWindowPVRGuide.cpp
Expand Up @@ -101,9 +101,10 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt
buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060); /* Delete timer */
}
}
else if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
else if (g_PVRClients->SupportsTimers())
{
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */
}

Expand Down
5 changes: 3 additions & 2 deletions xbmc/pvr/windows/GUIWindowPVRSearch.cpp
Expand Up @@ -67,9 +67,10 @@ void CGUIWindowPVRSearch::GetContextButtons(int itemNumber, CContextButtons &but
buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060); /* Delete timer */
}
}
else if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
else if (g_PVRClients->SupportsTimers())
{
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */
}

Expand Down

0 comments on commit e7da31f

Please sign in to comment.