Skip to content

Commit

Permalink
[pvr] changed: display a 'play recording' button in the epg info dial…
Browse files Browse the repository at this point in the history
…og 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
  • Loading branch information
opdenkamp committed Mar 5, 2015
1 parent 67bf6a4 commit 9df42d2
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 20 deletions.
5 changes: 5 additions & 0 deletions language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 15 additions & 8 deletions xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -162,19 +163,19 @@ 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;
CEpgInfoTagPtr epgTag(m_progItem->GetEPGInfoTag());

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()));
Expand Down Expand Up @@ -226,7 +227,7 @@ bool CGUIDialogPVRGuideInfo::OnMessage(CGUIMessage& message)
case GUI_MSG_CLICKED:
return OnClickButtonOK(message) ||
OnClickButtonRecord(message) ||
OnClickButtonSwitch(message) ||
OnClickButtonPlay(message) ||
OnClickButtonFind(message);
}

Expand Down Expand Up @@ -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 */
Expand All @@ -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
}
}
2 changes: 1 addition & 1 deletion xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions xbmc/pvr/windows/GUIWindowPVRBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions xbmc/pvr/windows/GUIWindowPVRBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
15 changes: 11 additions & 4 deletions xbmc/pvr/windows/GUIWindowPVRGuide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 9df42d2

Please sign in to comment.