Ticket #13021: 20170407_guide_livetv.patch

File 20170407_guide_livetv.patch, 5.1 KB (added by Peter Bennett, 7 years ago)

Pater's patch v1, without the threshold -1 part yet

  • mythtv/programs/mythfrontend/guidegrid.cpp

    diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp
    index 1361286..f944446 100644
    a b QWaitCondition epgIsVisibleCond; 
    6464const QString kUnknownTitle = "";
    6565//const QString kUnknownCategory = QObject::tr("Unknown");
    6666const unsigned long kUpdateMS = 60 * 1000UL; // Grid update interval (mS)
     67static bool SelectionIsTunable(const ChannelInfoList &selection);
    6768
    6869JumpToChannel::JumpToChannel(
    6970    JumpToChannelListener *parent, const QString &start_entry,
    bool GuideGrid::keyPressEvent(QKeyEvent *event) 
    805806            Close();
    806807        else if (action == ACTION_SELECT)
    807808        {
     809            ProgramInfo *pginfo =
     810                m_programInfos[m_currentRow][m_currentCol];
     811            int secsTillStart =
     812                (pginfo) ? MythDate::current().secsTo(
     813                    pginfo->GetScheduledStartTime()) : 0;
    808814            if (m_player && (m_player->GetState(-1) == kState_WatchingLiveTV))
    809815            {
    810816                // See if this show is far enough into the future that it's
    811817                // probable that the user wanted to schedule it to record
    812818                // instead of changing the channel.
    813                 ProgramInfo *pginfo =
    814                     m_programInfos[m_currentRow][m_currentCol];
    815                 int secsTillStart =
    816                     (pginfo) ? MythDate::current().secsTo(
    817                         pginfo->GetScheduledStartTime()) : 0;
    818819                if (pginfo && (pginfo->GetTitle() != kUnknownTitle) &&
    819820                    ((secsTillStart / 60) >= m_selectRecThreshold))
    820821                {
    bool GuideGrid::keyPressEvent(QKeyEvent *event) 
    826827                }
    827828            }
    828829            else
    829                 EditRecording();
     830                // Edit Recording should include "Watch this channel"
     831                // is we selected a show that is current.
     832                EditRecording(!m_player
     833                    && SelectionIsTunable(GetSelection())
     834                    && (secsTillStart / 60) < m_selectRecThreshold);
    830835        }
    831836        else if (action == "EDIT")
    832837            EditScheduled();
    void GuideGrid::ShowMenu(void) 
    11001105
    11011106        if (m_player && (m_player->GetState(-1) == kState_WatchingLiveTV))
    11021107            menuPopup->AddButton(tr("Change to Channel"));
    1103         else if (SelectionIsTunable(GetSelection()))
     1108        else if (!m_player && SelectionIsTunable(GetSelection()))
    11041109            menuPopup->AddButton(tr("Watch This Channel"));
    11051110
    11061111        menuPopup->AddButton(tr("Record This"));
    void GuideGrid::customEvent(QEvent *event) 
    19181923                delete record;
    19191924            }
    19201925        }
     1926        // Test for this here because it can come from
     1927        // different menus.
     1928        else if (resulttext == tr("Watch This Channel"))
     1929        {
     1930            ChannelInfoList selection = GetSelection();
     1931            if (SelectionIsTunable(selection))
     1932                TV::StartTV(NULL, kStartTVNoFlags, selection);
     1933        }
    19211934        else if (resultid == "guidemenu")
    19221935        {
    19231936            if (resulttext == tr("Record This"))
    void GuideGrid::customEvent(QEvent *event) 
    19281941            {
    19291942                enter();
    19301943            }
    1931             else if (resulttext == tr("Watch This Channel"))
    1932             {
    1933                 ChannelInfoList selection = GetSelection();
    1934                 if (SelectionIsTunable(selection))
    1935                     TV::StartTV(NULL, kStartTVNoFlags, selection);
    1936             }
    19371944            else if (resulttext == tr("Program Details"))
    19381945            {
    19391946                ShowDetails();
  • mythtv/programs/mythfrontend/schedulecommon.cpp

    diff --git a/mythtv/programs/mythfrontend/schedulecommon.cpp b/mythtv/programs/mythfrontend/schedulecommon.cpp
    index ca0bc58..96dfa48 100644
    a b void ScheduleCommon::ShowPrevious(void) const 
    266266*  \brief Creates a dialog for editing the recording status,
    267267*         blocking until user leaves dialog.
    268268*/
    269 void ScheduleCommon::EditRecording(void)
     269void ScheduleCommon::EditRecording(bool may_watch_now)
    270270{
    271271    ProgramInfo *pginfo = GetCurrentProgram();
    272272    if (!pginfo)
    void ScheduleCommon::EditRecording(void) 
    329329
    330330    QDateTime now = MythDate::current();
    331331
     332    if(may_watch_now)
     333        menuPopup->AddButton(tr("Watch This Channel"));
     334
    332335    if (recinfo.GetRecordingStatus() == RecStatus::Unknown)
    333336    {
    334337        if (recinfo.GetRecordingEndTime() > now)
  • mythtv/programs/mythfrontend/schedulecommon.h

    diff --git a/mythtv/programs/mythfrontend/schedulecommon.h b/mythtv/programs/mythfrontend/schedulecommon.h
    index 590e56e..909ddc9 100644
    a b class ScheduleCommon : public MythScreenType 
    3333    virtual void ShowDetails(void) const;
    3434
    3535  protected slots:
    36     virtual void EditRecording(void);
     36    virtual void EditRecording(bool may_watch_now = false);
    3737    virtual void QuickRecord(void);
    3838    virtual void ShowPrevious(void) const;
    3939    virtual void ShowUpcoming(void) const;