Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[pvr] fix: missing action mapping for ACTION_RECORD #4171

Merged
merged 1 commit into from

4 participants

@xhaggi
Collaborator

This adds the missing button translator action "record" poiting to ACTION_RECORD which is currently used in several PVR related windows, but could not be used in key mappings.

It also adds a default implementation to GUIWindow which calls the application player record functionality, so there is no need to use XBMC.PlayerControls(record) in key mapping anymore.

Furthermore the default mapping for the record button in remote.xml is changed to this new action.

This is discussed at http://forum.xbmc.org/showthread.php?tid=185107.

@opdenkamp it's up to you if this is a fix or feature for G+1.

@opdenkamp opdenkamp was assigned by xhaggi
xbmc/guilib/GUIWindow.cpp
@@ -431,8 +431,17 @@ bool CGUIWindow::OnAction(const CAction &action)
}
// default implementations
- if (action.GetID() == ACTION_NAV_BACK || action.GetID() == ACTION_PREVIOUS_MENU)
- return OnBack(action.GetID());
+ switch (action.GetID())
+ {
+ case ACTION_NAV_BACK:
+ case ACTION_PREVIOUS_MENU:
+ return OnBack(action.GetID());
+
+ case ACTION_RECORD:
+ if(g_application.m_pPlayer->IsPlaying() && g_application.m_pPlayer->CanRecord())
+ g_application.m_pPlayer->Record(!g_application.m_pPlayer->IsRecording());
+ break;
@jmarshallnz Owner

CGUIWindow should not need to know about the player. Surely the record action belongs in the player action handling at the app level?

@xhaggi Collaborator
xhaggi added a note

should I execute a bulidin instead?

@jmarshallnz Owner

Nope, you should move the handling out of here to somewhere else (I'd do it at the application level).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@xhaggi
Collaborator

@jmarshallnz refactored the player stuff in fixup commit

xbmc/guilib/GUIWindow.cpp
@@ -431,8 +431,16 @@ bool CGUIWindow::OnAction(const CAction &action)
}
// default implementations
- if (action.GetID() == ACTION_NAV_BACK || action.GetID() == ACTION_PREVIOUS_MENU)
- return OnBack(action.GetID());
+ switch (action.GetID())
+ {
+ case ACTION_NAV_BACK:
+ case ACTION_PREVIOUS_MENU:
+ return OnBack(action.GetID());
+
+ case ACTION_RECORD:
+ g_application.Record();
@opdenkamp Collaborator

shouldn't we use app messenger for this instead since this could block the ui thread?

@xhaggi Collaborator
xhaggi added a note

i don't know enough about this .. @jmarshallnz please help ;)

@jmarshallnz Owner

I obviously haven't been clear enough :)

CGUIWindow should not need to know or care about ACTION_RECORD. It makes no sense for the handling thereof to be in this class. After all, why should the volume dialog for example need to care about the record action? Why should a settings screen need to care?

This block shouldn't be here, period.

If you need to handle ACTION_RECORD, then the code for doing so should be in CApplication::OnAction() or CApplicationPlayer::OnAction() or whatever it is.

@xhaggi Collaborator
xhaggi added a note

Thanks for clarifying this ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@xhaggi
Collaborator

@jmarshallnz done so far

@MartijnKaijser MartijnKaijser added this to the Pending for inclusion milestone
@jmarshallnz jmarshallnz commented on the diff
xbmc/Application.cpp
@@ -2748,6 +2748,13 @@ bool CApplication::OnAction(const CAction &action)
}
}
+ // record current file
+ if (action.GetID() == ACTION_RECORD)
+ {
+ if (m_pPlayer->CanRecord())
+ m_pPlayer->Record(!m_pPlayer->IsRecording());
+ }
+
@jmarshallnz Owner

I wonder if we should drop it down into CPlayerController so that it's handled in the next block. I don't really mind too much, but it makes sense IMO to move all the above block into there, so adding new code there instead of here seems a bit better?

(Purely cosmetic at this stage!)

@xhaggi Collaborator
xhaggi added a note

Agree, could be done in a separate cosmetic commit. Do you mean the whole if (m_pPlayer->IsPlaying()) block?

@jmarshallnz Owner

Yeah - I think it's safer to leave that alone at present. A useful cleanup in G+1 maybe?

@xhaggi Collaborator
xhaggi added a note

Okay I'll add a separate PR so it is not lost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jmarshallnz
Owner

Looks much better.

@jmarshallnz
Owner

jenkins build this please

@xhaggi
Collaborator

something goes wrong in build 176 while fetching from github.

Receiving objects:  99% (111685/112277), 308.43 MiB | 586 KiB/s   
remote: fatal: unable to read fafbcc65570226aeae31637004fa84e480075c4a�[K
remote: aborting due to possible repository corruption on the remote side.
@xhaggi xhaggi [pvr] fix: missing action mapping for ACTION_RECORD
This adds the missing button translator action "record" poiting to
ACTION_RECORD which is currently used in several PVR related windows,
but could not be used in key mappings.

It also adds a default implementation to GUIWindow which calls the
application player record functionality, so there is no need to use
XBMC.PlayerControls(record) in key mapping anymore.

Furthermore the default mapping for the record button in remote.xml is
changed to this new action.
c6eb32b
@xhaggi
Collaborator

rebased fixups.

jenkins build this please

@jmarshallnz jmarshallnz merged commit 733f36b into xbmc:master

1 check failed

Details default Merged build #177 failed in 26 min
@xhaggi xhaggi deleted the xhaggi:record-action-mapping branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 10, 2014
  1. @xhaggi

    [pvr] fix: missing action mapping for ACTION_RECORD

    xhaggi authored
    This adds the missing button translator action "record" poiting to
    ACTION_RECORD which is currently used in several PVR related windows,
    but could not be used in key mappings.
    
    It also adds a default implementation to GUIWindow which calls the
    application player record functionality, so there is no need to use
    XBMC.PlayerControls(record) in key mapping anymore.
    
    Furthermore the default mapping for the record button in remote.xml is
    changed to this new action.
This page is out of date. Refresh to see the latest.
View
2  system/keymaps/remote.xml
@@ -59,7 +59,7 @@
<skipminus>SkipPrevious</skipminus>
<display>FullScreen</display>
<start>PreviousMenu</start>
- <record>Screenshot</record>
+ <record>Record</record>
<volumeplus>VolumeUp</volumeplus>
<volumeminus>VolumeDown</volumeminus>
<mute>Mute</mute>
View
7 xbmc/Application.cpp
@@ -2748,6 +2748,13 @@ bool CApplication::OnAction(const CAction &action)
}
}
+ // record current file
+ if (action.GetID() == ACTION_RECORD)
+ {
+ if (m_pPlayer->CanRecord())
+ m_pPlayer->Record(!m_pPlayer->IsRecording());
+ }
+
@jmarshallnz Owner

I wonder if we should drop it down into CPlayerController so that it's handled in the next block. I don't really mind too much, but it makes sense IMO to move all the above block into there, so adding new code there instead of here seems a bit better?

(Purely cosmetic at this stage!)

@xhaggi Collaborator
xhaggi added a note

Agree, could be done in a separate cosmetic commit. Do you mean the whole if (m_pPlayer->IsPlaying()) block?

@jmarshallnz Owner

Yeah - I think it's safer to leave that alone at present. A useful cleanup in G+1 maybe?

@xhaggi Collaborator
xhaggi added a note

Okay I'll add a separate PR so it is not lost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
if (m_playerController->OnAction(action))
return true;
}
View
1  xbmc/input/ButtonTranslator.cpp
@@ -242,6 +242,7 @@ static const ActionMapping actions[] =
{"playpvr" , ACTION_PVR_PLAY},
{"playpvrtv" , ACTION_PVR_PLAY_TV},
{"playpvrradio" , ACTION_PVR_PLAY_RADIO},
+ {"record" , ACTION_RECORD},
// Mouse actions
{"leftclick" , ACTION_MOUSE_LEFT_CLICK},
Something went wrong with that request. Please try again.