diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2016-01-26 15:26:29 +0100 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2016-01-27 20:00:27 +0100 |
commit | e15ed4cf55e9715a761166902034d87f44badaee (patch) | |
tree | 3aae39219e4b2ae8a127de18c13895ca490afc41 | |
parent | a71d319a95523d9fbc57ecd483dbf634350cc0e3 (diff) |
[PVR] Guide/Search/channel window: Do not add 'Record' if backend does not support timers.
-rw-r--r-- | xbmc/pvr/addons/PVRClients.cpp | 14 | ||||
-rw-r--r-- | xbmc/pvr/addons/PVRClients.h | 6 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRChannels.cpp | 2 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRGuide.cpp | 2 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRSearch.cpp | 2 |
5 files changed, 23 insertions, 3 deletions
diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index 17e5e2c290..da39071205 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -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; diff --git a/xbmc/pvr/addons/PVRClients.h b/xbmc/pvr/addons/PVRClients.h index 03f5da1b44..7bd9b3a4af 100644 --- a/xbmc/pvr/addons/PVRClients.h +++ b/xbmc/pvr/addons/PVRClients.h @@ -323,6 +323,12 @@ namespace PVR //@{ /*! + * @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. * @return True if the supports timers, false otherwise. diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp index 5d89d1e4c1..29fdf29908 100644 --- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp @@ -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()) diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp index ad6e04b31d..baa75af4ca 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp @@ -101,7 +101,7 @@ 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() && epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) { buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */ buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */ diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp index d782025773..f0786f7b4a 100644 --- a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp @@ -67,7 +67,7 @@ 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() && epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) { buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */ buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */ |