From 9b515b245eaaa5477929880ea9f56f4ff77abc5d Mon Sep 17 00:00:00 2001 From: David Engel Date: Sun, 24 Feb 2013 14:12:21 -0600 Subject: [PATCH] Allow the EPG to be called from ViewScheduled and ProgList. Also add the ability to set the initial time when calling the EPG. The primary use case for this is to more easily check what shows preceed a scheduled recording to see if padding needs to be added in case live programming runs late. --- mythtv/libs/libmythbase/mythversion.h | 2 +- mythtv/libs/libmythtv/tv_play.cpp | 3 ++- mythtv/libs/libmythtv/tv_play.h | 2 +- mythtv/programs/mythfrontend/guidegrid.cpp | 11 ++++++--- mythtv/programs/mythfrontend/guidegrid.h | 7 ++++-- mythtv/programs/mythfrontend/main.cpp | 3 ++- mythtv/programs/mythfrontend/progfind.cpp | 12 +++++++++- mythtv/programs/mythfrontend/proglist.cpp | 15 ++++++++++++ mythtv/programs/mythfrontend/proglist.h | 1 + .../programs/mythfrontend/viewscheduled.cpp | 24 +++++++++++++++++++ mythtv/programs/mythfrontend/viewscheduled.h | 1 + 11 files changed, 71 insertions(+), 10 deletions(-) diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h index aa6df83a33f..207f2812f61 100644 --- a/mythtv/libs/libmythbase/mythversion.h +++ b/mythtv/libs/libmythbase/mythversion.h @@ -12,7 +12,7 @@ /// Update this whenever the plug-in API changes. /// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and /// libmythui class methods used by plug-ins. -#define MYTH_BINARY_VERSION "0.27.20130130-1" +#define MYTH_BINARY_VERSION "0.27.20130224-1" /** \brief Increment this whenever the MythTV network protocol changes. * diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp index 15af9ab57c7..a8d2e63deb3 100644 --- a/mythtv/libs/libmythtv/tv_play.cpp +++ b/mythtv/libs/libmythtv/tv_play.cpp @@ -8538,6 +8538,7 @@ void TV::DoEditSchedule(int editType) const ProgramInfo pginfo(*actx->playingInfo); uint chanid = pginfo.GetChanID(); QString channum = pginfo.GetChanNum(); + QDateTime starttime = pginfo.GetScheduledStartTime(); actx->UnlockPlayingInfo(__FILE__, __LINE__); ClearOSD(actx); @@ -8598,7 +8599,7 @@ void TV::DoEditSchedule(int editType) case kScheduleProgramGuide: { isEmbedded = (isLiveTV && !pause_active && allowEmbedding); - RunProgramGuidePtr(chanid, channum, this, + RunProgramGuidePtr(chanid, channum, starttime, this, isEmbedded, true, channelGroupId); ignoreKeyPresses = true; break; diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h index 1b8e05f0862..56556dc867f 100644 --- a/mythtv/libs/libmythtv/tv_play.h +++ b/mythtv/libs/libmythtv/tv_play.h @@ -58,7 +58,7 @@ struct osdInfo; typedef QMap DDValueMap; typedef QMap DDKeyMap; typedef void (*EMBEDRETURNVOID) (void *, bool); -typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, TV *, bool, bool, int); +typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, const QDateTime, TV *, bool, bool, int); typedef void (*EMBEDRETURNVOIDFINDER) (TV *, bool, bool); typedef void (*EMBEDRETURNVOIDSCHEDIT) (const ProgramInfo *, void *); diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp index 082e387e1fe..218a5574395 100644 --- a/mythtv/programs/mythfrontend/guidegrid.cpp +++ b/mythtv/programs/mythfrontend/guidegrid.cpp @@ -165,7 +165,9 @@ bool JumpToChannel::Update(void) } void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, - TV *player, bool embedVideo, bool allowFinder, int changrpid) + const QDateTime startTime, + TV *player, bool embedVideo, + bool allowFinder, int changrpid) { // which channel group should we default to if (changrpid == -2) @@ -207,7 +209,7 @@ void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); GuideGrid *gg = new GuideGrid(mainStack, - chanid, channum, + chanid, channum, startTime, player, embedVideo, allowFinder, changrpid); @@ -218,7 +220,7 @@ void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, } GuideGrid::GuideGrid(MythScreenStack *parent, - uint chanid, QString channum, + uint chanid, QString channum, const QDateTime startTime, TV *player, bool embedVideo, bool allowFinder, int changrpid) : ScheduleCommon(parent, "guidegrid"), @@ -254,6 +256,9 @@ GuideGrid::GuideGrid(MythScreenStack *parent, } m_originalStartTime = MythDate::current(); + if (startTime.isValid() && + startTime > m_originalStartTime.addSecs(-8 * 3600)) + m_originalStartTime = startTime; int secsoffset = -((m_originalStartTime.time().minute() % 30) * 60 + m_originalStartTime.time().second()); diff --git a/mythtv/programs/mythfrontend/guidegrid.h b/mythtv/programs/mythfrontend/guidegrid.h index 7b74088772e..bbc1ab6eeca 100644 --- a/mythtv/programs/mythfrontend/guidegrid.h +++ b/mythtv/programs/mythfrontend/guidegrid.h @@ -84,6 +84,7 @@ class GuideGrid : public ScheduleCommon, public JumpToChannelListener // Use this function to instantiate a guidegrid instance. static void RunProgramGuide(uint startChanId, const QString &startChanNum, + const QDateTime startTime, TV *player = NULL, bool embedVideo = false, bool allowFinder = true, @@ -133,8 +134,10 @@ class GuideGrid : public ScheduleCommon, public JumpToChannelListener protected: GuideGrid(MythScreenStack *parentStack, - uint chanid = 0, QString channum = "", - TV *player = NULL, bool embedVideo = false, + uint chanid, QString channum, + const QDateTime startTime, + TV *player = NULL, + bool embedVideo = false, bool allowFinder = true, int changrpid = -1); ~GuideGrid(); diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp index 54730fc769d..2a13d60cf86 100644 --- a/mythtv/programs/mythfrontend/main.cpp +++ b/mythtv/programs/mythfrontend/main.cpp @@ -343,7 +343,8 @@ static void startGuide(void) uint chanid = 0; QString channum = gCoreContext->GetSetting("DefaultTVChannel"); channum = (channum.isEmpty()) ? "3" : channum; - GuideGrid::RunProgramGuide(chanid, channum, NULL, false, true, -2); + QDateTime startTime; + GuideGrid::RunProgramGuide(chanid, channum, startTime, NULL, false, true, -2); } static void startFinder(void) diff --git a/mythtv/programs/mythfrontend/progfind.cpp b/mythtv/programs/mythfrontend/progfind.cpp index 16baf4a8e24..222e9e5ac54 100644 --- a/mythtv/programs/mythfrontend/progfind.cpp +++ b/mythtv/programs/mythfrontend/progfind.cpp @@ -402,7 +402,17 @@ void ProgFinder::showGuide() if (startchannel.isEmpty()) startchannel = '3'; uint startchanid = 0; - GuideGrid::RunProgramGuide(startchanid, startchannel, m_player, m_embedVideo, false, -2); + QDateTime starttime; + + if (GetFocusWidget() == m_timesList) + { + ProgramInfo *pginfo = m_showData[m_timesList->GetCurrentPos()]; + startchannel = pginfo->GetChanNum(); + startchanid = pginfo->GetChanID(); + starttime = pginfo->GetScheduledStartTime(); + } + GuideGrid::RunProgramGuide(startchanid, startchannel, starttime, + m_player, m_embedVideo, false, -2); } } diff --git a/mythtv/programs/mythfrontend/proglist.cpp b/mythtv/programs/mythfrontend/proglist.cpp index 9c012b3b14a..5373a2c921c 100644 --- a/mythtv/programs/mythfrontend/proglist.cpp +++ b/mythtv/programs/mythfrontend/proglist.cpp @@ -21,6 +21,7 @@ using namespace std; #include "proglist.h" #include "mythdb.h" #include "mythdate.h" +#include "guidegrid.h" #define LOC QString("ProgLister: ") #define LOC_WARN QString("ProgLister, Warning: ") @@ -242,6 +243,8 @@ bool ProgLister::keyPressEvent(QKeyEvent *e) ShowUpcoming(); else if (action == "DETAILS" || action == "INFO") ShowDetails(); + else if (action == "GUIDE") + ShowGuide(); else if (action == "TOGGLERECORD") RecordSelected(); else if (action == "1") @@ -308,6 +311,7 @@ void ProgLister::ShowMenu(void) menu->AddItem(tr("Edit Schedule"), SLOT(EditScheduled())); menu->AddItem(tr("Program Details"), SLOT(ShowDetails())); + menu->AddItem(tr("Program Guide"), SLOT(ShowGuide())); menu->AddItem(tr("Upcoming"), SLOT(ShowUpcoming())); menu->AddItem(tr("Custom Edit"), SLOT(EditCustom())); @@ -763,6 +767,17 @@ void ProgLister::ShowOldRecordedMenu(void) delete menuPopup; } +void ProgLister::ShowGuide(void) +{ + ProgramInfo *pi = GetCurrent(); + if (pi) + { + GuideGrid::RunProgramGuide(pi->GetChanID(), pi->GetChanNum(), + pi->GetScheduledStartTime(), + NULL, this, -2); + } +} + void ProgLister::ShowUpcoming(void) { ProgramInfo *pi = GetCurrent(); diff --git a/mythtv/programs/mythfrontend/proglist.h b/mythtv/programs/mythfrontend/proglist.h index 5ecc84c622a..8846e9872cc 100644 --- a/mythtv/programs/mythfrontend/proglist.h +++ b/mythtv/programs/mythfrontend/proglist.h @@ -64,6 +64,7 @@ class ProgLister : public ScheduleCommon void EditCustom(void) { ScheduleCommon::EditCustom(GetCurrent()); } void ShowDetails(void) { ScheduleCommon::ShowDetails(GetCurrent()); } + void ShowGuide(void); void ShowUpcoming(void); void ShowDeleteRuleMenu(void); void ShowDeleteOldEpisodeMenu(void); diff --git a/mythtv/programs/mythfrontend/viewscheduled.cpp b/mythtv/programs/mythfrontend/viewscheduled.cpp index 5fa026170cb..cbfc6cbc42f 100644 --- a/mythtv/programs/mythfrontend/viewscheduled.cpp +++ b/mythtv/programs/mythfrontend/viewscheduled.cpp @@ -15,6 +15,7 @@ #include "mythuibuttonlist.h" #include "mythdialogbox.h" #include "mythmainwindow.h" +#include "guidegrid.h" void *ViewScheduled::RunViewScheduled(void *player, bool showTV) { @@ -170,6 +171,8 @@ bool ViewScheduled::keyPressEvent(QKeyEvent *event) upcomingScheduled(); else if (action == "DETAILS" || action == "INFO") details(); + else if (action == "GUIDE") + showGuide(); else if (action == "1") setShowAll(true); else if (action == "2") @@ -212,6 +215,7 @@ void ViewScheduled::ShowMenu(void) else menuPopup->AddButton(tr("Show All")); menuPopup->AddButton(tr("Program Details")); + menuPopup->AddButton(tr("Program Guide")); menuPopup->AddButton(tr("Upcoming by title")); menuPopup->AddButton(tr("Upcoming scheduled")); menuPopup->AddButton(tr("Custom Edit")); @@ -577,6 +581,22 @@ void ViewScheduled::deleteRule() delete okPopup; } +void ViewScheduled::showGuide() +{ + MythUIButtonListItem *item = m_schedulesList->GetItemCurrent(); + + if (!item) + return; + + ProgramInfo *pginfo = qVariantValue(item->GetData()); + + QString startchannel = pginfo->GetChanNum(); + uint startchanid = pginfo->GetChanID(); + QDateTime starttime = pginfo->GetScheduledStartTime(); + GuideGrid::RunProgramGuide(startchanid, startchannel, starttime, + m_player, this, -2); +} + void ViewScheduled::upcoming() { MythUIButtonListItem *item = m_schedulesList->GetItemCurrent(); @@ -733,6 +753,10 @@ void ViewScheduled::customEvent(QEvent *event) { details(); } + else if (resulttext == tr("Program Guide")) + { + showGuide(); + } else if (resulttext == tr("Upcoming by title")) { upcoming(); diff --git a/mythtv/programs/mythfrontend/viewscheduled.h b/mythtv/programs/mythfrontend/viewscheduled.h index 787f1d3b144..8b2d2125f30 100644 --- a/mythtv/programs/mythfrontend/viewscheduled.h +++ b/mythtv/programs/mythfrontend/viewscheduled.h @@ -41,6 +41,7 @@ class ViewScheduled : public ScheduleCommon protected slots: void ChangeGroup(MythUIButtonListItem *item); + void showGuide(); void edit(); void customEdit(); void deleteRule();