[mythtv] Key binding: local vs. global context
John P Poet
jppoet at gmail.com
Sun Oct 15 21:28:07 UTC 2006
I believe that key presses should always be processed for the "local"
context in preference to the "global" context. To that end, I
modified MythMainWindow::TranslateKeyPress() to look like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool MythMainWindow::TranslateKeyPress(const QString &context,
QKeyEvent *e, QStringList &actions,
bool allowJumps)
{
actions.clear();
int keynum = d->TranslateKeyNum(e);
bool retval = false;
if (d->keyContexts[context])
{
if (d->keyContexts[context]->GetMapping(keynum, actions))
retval = true;
}
if (context != "Global" &&
d->keyContexts["Global"]->GetMapping(keynum, actions))
{
retval = true;
}
if (!retval && allowJumps &&
d->jumpMap.count(keynum) > 0 && d->exitmenucallback == NULL)
{
d->exitingtomain = true;
d->exitmenucallback = d->jumpMap[keynum]->callback;
QApplication::postEvent(this, new ExitToMainMenuEvent());
return false;
}
return retval;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This allows me to use the same button on my remote to bring up the
"live tv" guide while watching a show, that I use to bring up the
"scheduling" guide while in the menu system.
I have been running my system this way for a few weeks and have not
noticed any problems.
I would also like to use the GUIDE button on my remote to bring up the
DVDMENU, when watching a DVD. In my mind, the program guide has no
relevance while watching a DVD. The problem is, the Internal player
runs in the "TV Playback" context (even when watching a DVD), so
cannot use the same key for a different action. To make this work, I
changed this bit of code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else if (action == "JUMPTODVDROOTMENU")
activenvp->GoToDVDMenu("menu");
else if (action == "GUIDE")
{
if (activerbuffer->isDVD())
activenvp->GoToDVDMenu("menu");
else
EditSchedule(kScheduleProgramGuide);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While the main Myth developers may accept the first patch, I have a
feeling they will reject the second. Does anyone have a
recommendation on a better way of achieving the desired result, here?
Thanks,
John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KeyLocalContext.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20061015/b7b7112e/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DVD-guide-is-menu.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20061015/b7b7112e/attachment-0001.bin
More information about the mythtv-dev
mailing list