From 9df42d29bed30ddef675418b9a3fcb9b53dcdfec Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Sat, 28 Feb 2015 15:23:23 +0100 Subject: [PATCH] [pvr] changed: display a 'play recording' button in the epg info dialog and context menu when a recording is found, and don't make 'switch channel' play a recording, but always make it switch channels like the label says --- language/English/strings.po | 5 +++++ xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp | 23 ++++++++++++++-------- xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h | 2 +- xbmc/pvr/windows/GUIWindowPVRBase.cpp | 4 ++-- xbmc/pvr/windows/GUIWindowPVRBase.h | 11 ++++++----- xbmc/pvr/windows/GUIWindowPVRGuide.cpp | 15 ++++++++++---- 6 files changed, 40 insertions(+), 20 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po index 206d98821a7fd..e95433f75b562 100644 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -9378,6 +9378,11 @@ msgctxt "#19686" msgid "The PVR backend is busy. Shutdown anyway?" msgstr "" +#: xbmc/pvr/windows/GUIWindowPVRGuide.cpp +msgctxt "#19687" +msgid "Play recording" +msgstr "" + #: xbmc/pvr/addons/PVRClients.cpp msgctxt "#19688" msgid "Scanning for PVR services" diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp index a5522d78bef7b..2fce8c6fef219 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp @@ -40,6 +40,7 @@ using namespace EPG; #define CONTROL_BTN_SWITCH 5 #define CONTROL_BTN_RECORD 6 #define CONTROL_BTN_OK 7 +#define CONTROL_BTN_PLAY_RECORDING 8 CGUIDialogPVRGuideInfo::CGUIDialogPVRGuideInfo(void) : CGUIDialog(WINDOW_DIALOG_PVR_GUIDE_INFO, "DialogPVRGuideInfo.xml") @@ -162,11 +163,11 @@ bool CGUIDialogPVRGuideInfo::OnClickButtonRecord(CGUIMessage &message) return bReturn; } -bool CGUIDialogPVRGuideInfo::OnClickButtonSwitch(CGUIMessage &message) +bool CGUIDialogPVRGuideInfo::OnClickButtonPlay(CGUIMessage &message) { bool bReturn = false; - if (message.GetSenderId() == CONTROL_BTN_SWITCH) + if (message.GetSenderId() == CONTROL_BTN_SWITCH || message.GetSenderId() == CONTROL_BTN_PLAY_RECORDING) { Close(); PlayBackRet ret = PLAYBACK_CANCELED; @@ -174,7 +175,7 @@ bool CGUIDialogPVRGuideInfo::OnClickButtonSwitch(CGUIMessage &message) if (epgTag) { - if (epgTag->HasRecording()) + if (message.GetSenderId() == CONTROL_BTN_PLAY_RECORDING && epgTag->HasRecording()) ret = g_application.PlayFile(CFileItem(epgTag->Recording())); else if (epgTag->HasPVRChannel()) ret = g_application.PlayFile(CFileItem(epgTag->ChannelTag())); @@ -226,7 +227,7 @@ bool CGUIDialogPVRGuideInfo::OnMessage(CGUIMessage& message) case GUI_MSG_CLICKED: return OnClickButtonOK(message) || OnClickButtonRecord(message) || - OnClickButtonSwitch(message) || + OnClickButtonPlay(message) || OnClickButtonFind(message); } @@ -254,6 +255,12 @@ void CGUIDialogPVRGuideInfo::OnInitWindow() return; } + if (!tag->HasRecording()) + { + /* not recording. hide the play recording button */ + SET_CONTROL_HIDDEN(CONTROL_BTN_PLAY_RECORDING); + } + if (tag->EndAsLocalTime() <= CDateTime::GetCurrentDateTime()) { /* event has passed. hide the record button */ @@ -266,16 +273,16 @@ void CGUIDialogPVRGuideInfo::OnInitWindow() { /* no timer present on this tag */ if (tag->StartAsLocalTime() < CDateTime::GetCurrentDateTime()) - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 264); + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 264); // Record else - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19061); + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19061); // Add timer } else { /* timer present on this tag */ if (tag->StartAsLocalTime() < CDateTime::GetCurrentDateTime()) - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19059); + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19059); // Stop recording else - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19060); + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19060); // Delete timer } } diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h index dc6ea703f0c7e..39fc09fbd7826 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h @@ -51,7 +51,7 @@ namespace PVR bool OnClickButtonOK(CGUIMessage &message); bool OnClickButtonRecord(CGUIMessage &message); - bool OnClickButtonSwitch(CGUIMessage &message); + bool OnClickButtonPlay(CGUIMessage &message); bool OnClickButtonFind(CGUIMessage &message); CFileItemPtr m_progItem; diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp index 469553d5c2305..a3de78537f6dc 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp @@ -534,7 +534,7 @@ bool CGUIWindowPVRBase::ActionPlayChannel(CFileItem *item) return PlayFile(item, CSettings::Get().GetBool("pvrplayback.playminimized")); } -bool CGUIWindowPVRBase::ActionPlayEpg(CFileItem *item) +bool CGUIWindowPVRBase::ActionPlayEpg(CFileItem *item, bool bPlayRecording) { if (!item || !item->HasEPGInfoTag()) return false; @@ -548,7 +548,7 @@ bool CGUIWindowPVRBase::ActionPlayEpg(CFileItem *item) return false; CFileItem fileItem; - if (epgTag->HasRecording()) + if (bPlayRecording && epgTag->HasRecording()) fileItem = CFileItem(epgTag->Recording()); else fileItem = CFileItem(channel); diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.h b/xbmc/pvr/windows/GUIWindowPVRBase.h index f8f0b0346e9f2..e8c7dd88170c6 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.h +++ b/xbmc/pvr/windows/GUIWindowPVRBase.h @@ -47,10 +47,11 @@ namespace PVR enum EPGSelectAction { - EPG_SELECT_ACTION_CONTEXT_MENU = 0, - EPG_SELECT_ACTION_SWITCH = 1, - EPG_SELECT_ACTION_INFO = 2, - EPG_SELECT_ACTION_RECORD = 3 + EPG_SELECT_ACTION_CONTEXT_MENU = 0, + EPG_SELECT_ACTION_SWITCH = 1, + EPG_SELECT_ACTION_INFO = 2, + EPG_SELECT_ACTION_RECORD = 3, + EPG_SELECT_ACTION_PLAY_RECORDING = 4, }; class CGUIWindowPVRBase : public CGUIMediaWindow, public Observer @@ -82,7 +83,7 @@ namespace PVR virtual bool ActionRecord(CFileItem *item); virtual bool ActionPlayChannel(CFileItem *item); - virtual bool ActionPlayEpg(CFileItem *item); + virtual bool ActionPlayEpg(CFileItem *item, bool bPlayRecording); virtual bool ActionDeleteChannel(CFileItem *item); virtual bool ActionInputChannelNumber(int input); diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp index de23a1b3f3319..c1c2c2e673452 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp @@ -72,6 +72,9 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 19000); /* switch channel */ + if (pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->HasRecording()) + buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 19687); /* play recording */ + CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(pItem.get()); if (timer && timer->HasPVRTimerInfoTag()) { @@ -170,7 +173,11 @@ bool CGUIWindowPVRGuide::OnMessage(CGUIMessage& message) bReturn = true; break; case EPG_SELECT_ACTION_SWITCH: - ActionPlayEpg(pItem.get()); + ActionPlayEpg(pItem.get(), false); + bReturn = true; + break; + case EPG_SELECT_ACTION_PLAY_RECORDING: + ActionPlayEpg(pItem.get(), true); bReturn = true; break; case EPG_SELECT_ACTION_INFO: @@ -188,7 +195,7 @@ bool CGUIWindowPVRGuide::OnMessage(CGUIMessage& message) bReturn = true; break; case ACTION_PLAY: - ActionPlayEpg(pItem.get()); + ActionPlayEpg(pItem.get(), true); bReturn = true; break; case ACTION_RECORD: @@ -461,9 +468,9 @@ bool CGUIWindowPVRGuide::OnContextButtonPlay(CFileItem *item, CONTEXT_BUTTON but { bool bReturn = false; - if (button == CONTEXT_BUTTON_PLAY_ITEM) + if (button == CONTEXT_BUTTON_PLAY_ITEM || button == CONTEXT_BUTTON_PLAY_OTHER) { - ActionPlayEpg(item); + ActionPlayEpg(item, button == CONTEXT_BUTTON_PLAY_OTHER); bReturn = true; }