[mythtv] [PATCH] Add transcode to OSD menu

Joseph A. Caputo jcaputo1 at comcast.net
Tue Apr 27 13:05:41 EDT 2004


On Monday 26 April 2004 11:57, Joseph A. Caputo wrote:
> On Sunday 25 April 2004 19:18, Dan Morphis wrote:
> > Yup :-)  All you did was add it to the tree, you didn't add any
> > code to handle it :-)
> >
> > Do a find for "else if (action == "TOGGLEPIPMODE")" and add you
> > code to that section to call the function that normally gets called
> > when you press "X".  DoQueueTranscode() is the method I believe.
>
> Hmmm, I don't like that... wouldn't it be cleaner to have a single
> code path to handle actions?  Having a single path to handle this
> might also make it possible to have the OSD menu configurable by an
> XML file...
>
> If there are no arguments against it, I may start working on a patch
> to achieve this...
>
> -JAC

OK, I took a look at this and here's what I propose:

- Split TV:ProcessKeypress into 2 functions:

	void TV::ProcessKeypress (QKeyEvent *)
	{
		- keep existing code up to the point where
		"TranslateKeyPress" is called.  Split subsequent code off
		into new function (below)
	}

	bool TV::ProcessAction ( const QString & action )
	{
		- code cut from ProcessKeypress.
		- return value of "handled" variable
	}

	void TV::TreeMenuSelected (OSDListTreeType *tree, OSDGenericTree *item)
	{
		- keep existing code up to item->getAction()
		- call ProcessAction ()
		- set 'hidetree' to return value of ProcessAction
	}


... this should enable us to avoid duplicating code for actions that can 
be accessed via multiple code paths.  It means that you won't have to 
put in a new "if ( action == "NEWACTION" )" line specifically to handle 
an existing action that has been added to the OSD menu.

Also, since OSD menu actions will be handled by common existing code, we 
could potentially remove the hard-coded "BuildOSDMenuTree" code and 
instead read an XML file describing the OSD menu tree, its levels & 
actions.

What say ye (Isaac/anyone)?  I think I might be able to work on this 
within the next week.

-JAC


More information about the mythtv-dev mailing list