[mythtv] Guide to write a plugin?

Josh Lefler joshlefler at leflerinc.com
Fri Oct 13 15:49:43 UTC 2006


Josh Lefler
Lefler, Inc.




Henrik Gammelmark wrote:
> Josh Lefler wrote:
>   
>> <snip>
>> Josh Lefler wrote:
>>     
>>>> Henrik,
>>>>
>>>> I recently wrote my first plugin for myth (Ticket #2482) and had much 
>>>> the same dilemma as you when I got started. Here are a few bits of 
>>>> information that made the process easier for me:
>>>>
>>>>     
>>>>         
>> <snip>
>>     
>>> Thank you very much for your reply. A few more questions:
>>>
>>> How do I go about compiling the thing? I should end up with what? A .so 
>>> file? And where do I place this? With what filename?
>>>   
>>>       
>> <snip>
>>     
>
> Thanks, it was pretty straight-forward, given your explanation. I now 
> have a .so file, and added a menu item for it, able to display a blank 
> screen.
>
>   
>>> Regarding the UI xml file, does it need to have a specific name, or do I 
>>> reference it from within my code?
>>>
>>>   
>>>       
>> You pass in a portion of the filename. Specifically, anything before the 
>> "ui.xml". I do this on line 46 of main.cpp in my plugin.
>>     
>
> I am trying to make a single gui in a XML file, and got it to load 
> without errors. However, the screen is entirely blank.
>
> I have a few <font>'s, and a single <container> with an <image> and a 
> <textarea> in it, but neither are displayed.
>
> How do I use these containers etc, and how do they relate? One container 
> per page? Are they hidden by default?
>
> What do I need to do in the code to make it work? Do I need to do 
> anything? ;)
>
> Any pointers to how this gui thing is organized would be helpful.
>   
I'm by no means an expert in this topic, but I'll try to give you a few 
pointers.

The second parameter you pass to MythThemedDialog is the windowName of 
the window to display. You then define this window in XML and put all of 
the objects that should reside within it between its opening and closing 
tags. Basically, you can have any number of "screens" in 1 file by 
putting each of them within their own <window> tag and telling 
MythThemedDialog which one to use for the current screen.

You can put other objects in containers to help keep them organized, but 
I don't think its strictly necessary. I believe I have one textbox 
outside of a container on my GUI and it works fine. I'd start by making 
sure all of your objects are within a <window> tag and that you are 
passing the name of that window tag properly to MythThemedDialog. See 
lines 128-130 in my moviesui.cpp and lines 3 and 140 in my movies-ui.xml 
to see what I mean.
>   
>>> Do you know anything about the i18n folder, containing translations? Is 
>>> that for internal use only, or does mythtv choose the translation etc 
>>> somehow?
>>>
>>>   
>>>       
>> The i18n folder is for translations - but I haven't implemented it yet 
>> so can't help ya much there.
>>     
>>> Sorry if I'm asking dumb questions, I haven't yet figured out how things 
>>> play together.
>>>       
>
> I'm skipping that one for now, then
>
>   
>> I asked a lot of dumb questions when I was getting started, and Anduin, 
>> Isaac (chutt), xris, etc. were very helpful.. just happy to be able to 
>> return the favor in an indirect sort of way.
>>     
>>> / Henrik
>>>   
>>>       
>>>> Henrik Gammelmark wrote:
>>>>     
>>>>         
>>>>> I have looked around on mythtv.org, but I cannot seem to find any 
>>>>> documentation / howtos / turorials / faqs on how to build a simple 
>>>>> plugin for MythTV.
>>>>>
>>>>> Does anyone know of any such guide or at least some sort of 
>>>>> documentation to use? For starters I wish to create simple Hello World 
>>>>> plugin that appears in the main menu, and responds to a keystroke (or 
>>>>> lirc key) by doing something useless.
>>>>>
>>>>> In #mythtv @ Freenode, I was told that there is no such guide or sample 
>>>>> plugin, and the best way to go about it, is study an existing plugin. So 
>>>>> I started taking apart mythweather, but I quickly got stuck.
>>>>>
>>>>> Any pointers would be helpful - what is the bare minimum of code 
>>>>> required to accomplish the above task, and also, what is the build 
>>>>> procedure? I never used qmake before, and I'm not sure I understand what 
>>>>> it does.
>>>>>
>>>>> Thank you very much in advance
>>>>>
>>>>> / Henrik
>>>>> _______________________________________________
>>>>>           
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20061013/556c61eb/attachment.htm 


More information about the mythtv-dev mailing list