Skip to content
Permalink
Browse files

Add "Watch This Channel" to guide select menu when appropriate.

Fixes #13021
  • Loading branch information
bennettpeter committed Apr 8, 2017
1 parent f96871d commit 4920cb2c590e609564524f684f67acebb370f9fe
@@ -64,6 +64,7 @@ QWaitCondition epgIsVisibleCond;
const QString kUnknownTitle = "";
//const QString kUnknownCategory = QObject::tr("Unknown");
const unsigned long kUpdateMS = 60 * 1000UL; // Grid update interval (mS)
static bool SelectionIsTunable(const ChannelInfoList &selection);

JumpToChannel::JumpToChannel(
JumpToChannelListener *parent, const QString &start_entry,
@@ -805,16 +806,16 @@ bool GuideGrid::keyPressEvent(QKeyEvent *event)
Close();
else if (action == ACTION_SELECT)
{
ProgramInfo *pginfo =
m_programInfos[m_currentRow][m_currentCol];
int secsTillStart =
(pginfo) ? MythDate::current().secsTo(
pginfo->GetScheduledStartTime()) : 0;
if (m_player && (m_player->GetState(-1) == kState_WatchingLiveTV))
{
// See if this show is far enough into the future that it's
// probable that the user wanted to schedule it to record
// instead of changing the channel.
ProgramInfo *pginfo =
m_programInfos[m_currentRow][m_currentCol];
int secsTillStart =
(pginfo) ? MythDate::current().secsTo(
pginfo->GetScheduledStartTime()) : 0;
if (pginfo && (pginfo->GetTitle() != kUnknownTitle) &&
((secsTillStart / 60) >= m_selectRecThreshold))
{
@@ -826,7 +827,11 @@ bool GuideGrid::keyPressEvent(QKeyEvent *event)
}
}
else
EditRecording();
// Edit Recording should include "Watch this channel"
// is we selected a show that is current.
EditRecording(!m_player
&& SelectionIsTunable(GetSelection())
&& (secsTillStart / 60) < m_selectRecThreshold);
}
else if (action == "EDIT")
EditScheduled();
@@ -1100,7 +1105,7 @@ void GuideGrid::ShowMenu(void)

if (m_player && (m_player->GetState(-1) == kState_WatchingLiveTV))
menuPopup->AddButton(tr("Change to Channel"));
else if (SelectionIsTunable(GetSelection()))
else if (!m_player && SelectionIsTunable(GetSelection()))
menuPopup->AddButton(tr("Watch This Channel"));

menuPopup->AddButton(tr("Record This"));
@@ -1918,6 +1923,14 @@ void GuideGrid::customEvent(QEvent *event)
delete record;
}
}
// Test for this here because it can come from
// different menus.
else if (resulttext == tr("Watch This Channel"))
{
ChannelInfoList selection = GetSelection();
if (SelectionIsTunable(selection))
TV::StartTV(NULL, kStartTVNoFlags, selection);
}
else if (resultid == "guidemenu")
{
if (resulttext == tr("Record This"))
@@ -1928,12 +1941,6 @@ void GuideGrid::customEvent(QEvent *event)
{
enter();
}
else if (resulttext == tr("Watch This Channel"))
{
ChannelInfoList selection = GetSelection();
if (SelectionIsTunable(selection))
TV::StartTV(NULL, kStartTVNoFlags, selection);
}
else if (resulttext == tr("Program Details"))
{
ShowDetails();
@@ -266,7 +266,7 @@ void ScheduleCommon::ShowPrevious(void) const
* \brief Creates a dialog for editing the recording status,
* blocking until user leaves dialog.
*/
void ScheduleCommon::EditRecording(void)
void ScheduleCommon::EditRecording(bool may_watch_now)
{
ProgramInfo *pginfo = GetCurrentProgram();
if (!pginfo)
@@ -329,6 +329,9 @@ void ScheduleCommon::EditRecording(void)

QDateTime now = MythDate::current();

if(may_watch_now)
menuPopup->AddButton(tr("Watch This Channel"));

if (recinfo.GetRecordingStatus() == RecStatus::Unknown)
{
if (recinfo.GetRecordingEndTime() > now)
@@ -33,7 +33,7 @@ class ScheduleCommon : public MythScreenType
virtual void ShowDetails(void) const;

protected slots:
virtual void EditRecording(void);
virtual void EditRecording(bool may_watch_now = false);
virtual void QuickRecord(void);
virtual void ShowPrevious(void) const;
virtual void ShowUpcoming(void) const;

0 comments on commit 4920cb2

Please sign in to comment.
You can’t perform that action at this time.