Skip to content

Commit

Permalink
Allow the EPG to be called from ViewScheduled and ProgList.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gigem committed Feb 24, 2013
1 parent 1dee2a5 commit 7d6d049
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -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.
*
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -58,7 +58,7 @@ struct osdInfo;
typedef QMap<QString,InfoMap> DDValueMap;
typedef QMap<QString,DDValueMap> 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 *);

Expand Down
11 changes: 8 additions & 3 deletions mythtv/programs/mythfrontend/guidegrid.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand All @@ -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"),
Expand Down Expand Up @@ -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());
Expand Down
7 changes: 5 additions & 2 deletions mythtv/programs/mythfrontend/guidegrid.h
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion mythtv/programs/mythfrontend/main.cpp
Expand Up @@ -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)
Expand Down
12 changes: 11 additions & 1 deletion mythtv/programs/mythfrontend/progfind.cpp
Expand Up @@ -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);
}
}

Expand Down
15 changes: 15 additions & 0 deletions mythtv/programs/mythfrontend/proglist.cpp
Expand Up @@ -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: ")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()));

Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions mythtv/programs/mythfrontend/proglist.h
Expand Up @@ -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);
Expand Down
24 changes: 24 additions & 0 deletions mythtv/programs/mythfrontend/viewscheduled.cpp
Expand Up @@ -15,6 +15,7 @@
#include "mythuibuttonlist.h"
#include "mythdialogbox.h"
#include "mythmainwindow.h"
#include "guidegrid.h"

void *ViewScheduled::RunViewScheduled(void *player, bool showTV)
{
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -577,6 +581,22 @@ void ViewScheduled::deleteRule()
delete okPopup;
}

void ViewScheduled::showGuide()
{
MythUIButtonListItem *item = m_schedulesList->GetItemCurrent();

if (!item)
return;

ProgramInfo *pginfo = qVariantValue<ProgramInfo*>(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();
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions mythtv/programs/mythfrontend/viewscheduled.h
Expand Up @@ -41,6 +41,7 @@ class ViewScheduled : public ScheduleCommon

protected slots:
void ChangeGroup(MythUIButtonListItem *item);
void showGuide();
void edit();
void customEdit();
void deleteRule();
Expand Down

0 comments on commit 7d6d049

Please sign in to comment.