Skip to content

Commit

Permalink
Improved handling of 'Show the Program Guide when Start Live TV'.
Browse files Browse the repository at this point in the history
There is no longer a need to hit the database for the appropriate action
and add a simulated keypress to the list of queued keypresses (and hope
the player is up and running before the keypress is processed).

Instead just start the guide when the player is ready.
  • Loading branch information
Mark Kendall committed Feb 9, 2011
1 parent 48bf9de commit 341efdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 30 deletions.
34 changes: 5 additions & 29 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -266,7 +266,7 @@ bool TV::StartTV(ProgramInfo *tvrec, uint flags)
else if (RemoteGetFreeRecorderCount())
{
VERBOSE(VB_PLAYBACK, LOC + "tv->LiveTV() -- begin");
if (!tv->LiveTV(showDialogs, startInGuide))
if (!tv->LiveTV(showDialogs))
{
tv->SetExitPlayer(true, true);
quitAll = true;
Expand All @@ -277,6 +277,9 @@ bool TV::StartTV(ProgramInfo *tvrec, uint flags)
SendMythSystemEvent("LIVETV_STARTED");
}

if (!quitAll && (startInGuide || tv->StartLiveTVInGuide()))
tv->DoEditSchedule();

VERBOSE(VB_PLAYBACK, LOC + "tv->LiveTV() -- end");
}
else
Expand Down Expand Up @@ -1267,9 +1270,8 @@ TVState TV::GetState(const PlayerContext *actx) const
/** \fn TV::LiveTV(bool,bool)
* \brief Starts LiveTV
* \param showDialogs if true error dialogs are shown, if false they are not
* \param startInGuide if true the EPG will be shown upon entering LiveTV
*/
bool TV::LiveTV(bool showDialogs, bool startInGuide)
bool TV::LiveTV(bool showDialogs)
{
requestDelete = false;
allowRerecord = false;
Expand All @@ -1291,32 +1293,6 @@ bool TV::LiveTV(bool showDialogs, bool startInGuide)
.arg(db_idle_timeout*(1.0f/60000.0f)));
}

if (startInGuide || db_start_in_guide)
{
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT keylist FROM keybindings WHERE "
"context = 'TV Playback' AND action = :GUIDE AND "
"hostname = :HOSTNAME ;");
query.bindValue(":GUIDE", ACTION_GUIDE);
query.bindValue(":HOSTNAME", gCoreContext->GetHostName());

if (query.exec() && query.isActive() && query.size() > 0)
{
query.next();

QKeySequence keyseq(query.value(0).toString());

int keynum = keyseq[0];
keynum &= ~Qt::UNICODE_ACCEL;

QMutexLocker locker(&timerIdLock);
keyList.push_front(
new QKeyEvent(QEvent::KeyPress, keynum, 0, 0));
if (!keyListTimerId)
keyListTimerId = StartTimer(1, __LINE__);
}
}

ReturnPlayerLock(actx);
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -194,7 +194,8 @@ class MPUBLIC TV : public QObject
bool HandleTrackAction(PlayerContext*, const QString &action);

// LiveTV commands
bool LiveTV(bool showDialogs = true, bool startInGuide = false);
bool LiveTV(bool showDialogs = true);
bool StartLiveTVInGuide(void) { return db_start_in_guide; }

// Embedding commands for the guidegrid to use in LiveTV
bool StartEmbedding(PlayerContext*, WId wid, const QRect&);
Expand Down

0 comments on commit 341efdf

Please sign in to comment.