Skip to content

Commit

Permalink
[pvr] remove hardcoded keymap in fullscreen video playback add possib…
Browse files Browse the repository at this point in the history
…ility for PVR specific keymaps with a fallback to the default FullscreenVideo bindings if no PVR specific are found
  • Loading branch information
Franz Koch committed Nov 4, 2012
1 parent fcc1090 commit 6eb6367
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 42 deletions.
8 changes: 8 additions & 0 deletions system/keymaps/keyboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,14 @@
<backspace>Close</backspace>
</keyboard>
</NumericInput>
<FullscreenLiveTV>
<keyboard>
<left>PreviousChannelGroup</left>
<right>NextChannelGroup</right>
<up>ChannelUp</up>
<down>ChannelDown</down>
</keyboard>
</FullscreenLiveTV>
<PVROSDChannels>
<keyboard>
<backspace>Close</backspace>
Expand Down
11 changes: 10 additions & 1 deletion xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2424,9 +2424,18 @@ bool CApplication::OnKey(const CKey& key)
// if player is in some sort of menu, (ie DVDMENU) map buttons differently
action = CButtonTranslator::GetInstance().GetAction(WINDOW_VIDEO_MENU, key);
}
else if (g_PVRManager.IsStarted() && g_application.CurrentFileItem().HasPVRChannelInfoTag())
{
// check for PVR specific keymaps in FULLSCREEN_VIDEO window
action = CButtonTranslator::GetInstance().GetAction(WINDOW_FULLSCREEN_LIVETV, key, false);

// if no PVR specific action/mapping is found, fall back to default
if (action.GetID() == 0)
action = CButtonTranslator::GetInstance().GetAction(iWin, key);
}
else
{
// no then use the fullscreen window section of keymap.xml to map key->action
// in any other case use the fullscreen window section of keymap.xml to map key->action
action = CButtonTranslator::GetInstance().GetAction(iWin, key);
}
}
Expand Down
3 changes: 3 additions & 0 deletions xbmc/guilib/Key.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@
#define ACTION_NEXT_CONTROL 181
#define ACTION_PREV_CONTROL 182
#define ACTION_CHANNEL_SWITCH 183
#define ACTION_NEXT_CHANNELGROUP 184
#define ACTION_PREVIOUS_CHANNELGROUP 185

#define ACTION_TOGGLE_FULLSCREEN 199 // switch 2 desktop resolution
#define ACTION_TOGGLE_WATCHED 200 // Toggle watched status (videos)
Expand Down Expand Up @@ -416,6 +418,7 @@
#define WINDOW_DIALOG_PVR_OSD_GUIDE 10611
#define WINDOW_DIALOG_PVR_OSD_DIRECTOR 10612
#define WINDOW_DIALOG_PVR_OSD_CUTTER 10613
#define WINDOW_FULLSCREEN_LIVETV 10614 // virtual window for PVR specific keymap bindings in fullscreen playback (which internally uses WINDOW_FULLSCREEN_VIDEO)
// PVR_WINDOW VIEWS = 10694-10699

//#define WINDOW_VIRTUAL_KEYBOARD 11000
Expand Down
7 changes: 7 additions & 0 deletions xbmc/input/ButtonTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ static const ActionMapping actions[] =
{"volampup" , ACTION_VOLAMP_UP},
{"volampdown" , ACTION_VOLAMP_DOWN},

// PVR actions
{"channelup" , ACTION_NEXT_ITEM}, // more self-explanatory alias for "skipnext"
{"channeldown" , ACTION_PREV_ITEM}, // more self-explanatory alias for "skipprevious"
{"previouschannelgroup" , ACTION_PREVIOUS_CHANNELGROUP},
{"nextchannelgroup" , ACTION_NEXT_CHANNELGROUP},

// Mouse actions
{"leftclick" , ACTION_MOUSE_LEFT_CLICK},
{"rightclick" , ACTION_MOUSE_RIGHT_CLICK},
Expand Down Expand Up @@ -322,6 +328,7 @@ static const ActionMapping windows[] =
{"movieinformation" , WINDOW_DIALOG_VIDEO_INFO},
{"textviewer" , WINDOW_DIALOG_TEXT_VIEWER},
{"fullscreenvideo" , WINDOW_FULLSCREEN_VIDEO},
{"fullscreenlivetv" , WINDOW_FULLSCREEN_LIVETV}, // virtual window/keymap section for PVR specific bindings in fullscreen playback (which internally uses WINDOW_FULLSCREEN_VIDEO)
{"visualisation" , WINDOW_VISUALISATION},
{"slideshow" , WINDOW_SLIDESHOW},
{"filestackingdialog" , WINDOW_DIALOG_FILESTACKING},
Expand Down
64 changes: 24 additions & 40 deletions xbmc/video/windows/GUIWindowFullScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,51 +169,31 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
break;

case ACTION_STEP_BACK:
if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
{
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
else
g_application.m_pPlayer->Seek(false, false);
}
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
else
SeekTV(false, false);
g_application.m_pPlayer->Seek(false, false);
return true;

case ACTION_STEP_FORWARD:
if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
{
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD);
else
g_application.m_pPlayer->Seek(true, false);
}
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD);
else
SeekTV(true, false);
g_application.m_pPlayer->Seek(true, false);
return true;

case ACTION_BIG_STEP_BACK:
if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
{
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
else
g_application.m_pPlayer->Seek(false, true);
}
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
else
SeekTV(false, true);
g_application.m_pPlayer->Seek(false, true);
return true;

case ACTION_BIG_STEP_FORWARD:
if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
{
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD);
else
g_application.m_pPlayer->Seek(true, true);
}
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD);
else
SeekTV(true, true);
g_application.m_pPlayer->Seek(true, true);
return true;

case ACTION_NEXT_SCENE:
Expand Down Expand Up @@ -636,6 +616,18 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)

break;
}
case ACTION_PREVIOUS_CHANNELGROUP:
{
if (g_application.CurrentFileItem().HasPVRChannelInfoTag())
ChangetheTVGroup(false);
return true;
}
case ACTION_NEXT_CHANNELGROUP:
{
if (g_application.CurrentFileItem().HasPVRChannelInfoTag())
ChangetheTVGroup(true);
return true;
}
default:
break;
}
Expand Down Expand Up @@ -1184,14 +1176,6 @@ void CGUIWindowFullScreen::SeekToTimeCodeStamp(SEEK_TYPE type, SEEK_DIRECTION di
m_timeCodeShow = false;
}

void CGUIWindowFullScreen::SeekTV(bool bPlus, bool bLargeStep)
{
if (bLargeStep)
OnAction(CAction(bPlus ? ACTION_NEXT_ITEM : ACTION_PREV_ITEM));
else if (!bLargeStep)
ChangetheTVGroup(bPlus);
}

double CGUIWindowFullScreen::GetTimeCodeStamp()
{
// Convert the timestamp into an integer
Expand Down
1 change: 0 additions & 1 deletion xbmc/video/windows/GUIWindowFullScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class CGUIWindowFullScreen :

private:
void RenderTTFSubtitles();
void SeekTV(bool bPlus, bool bLargeStep);
void SeekChapter(int iChapter);
void FillInTVGroups();
void ToggleOSD();
Expand Down

0 comments on commit 6eb6367

Please sign in to comment.