[mythtv] [PATCH] MediaMonitor data and MythVideo support

Xavier Hervy maxpower44 at tiscali.fr
Thu Jul 1 12:36:14 EDT 2004


Xavier Hervy wrote:

> Xavier Hervy wrote:
> 
>> J. Donavan Stanley wrote:
>>
>>> Xavier Hervy wrote:
>>>
>>>> J. Donavan Stanley wrote:
>>>>
>>>>>
>>>>> As it turns out, the only disks I stick in my machines are either 
>>>>> DVDs or Music CDs so the current handlers work well enough for me.  
>>>>> I tried to plan ahead to make it fairly easy to extend this, it's 
>>>>> just not been on my radar.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Media handler is not enougth. for example (in my patch) when you try 
>>>> to play a movie on a cd, mythvideo ask for cd , but when i insert 
>>>> it, mythvideo is closed and open a new time.
>>>
>>>
>>>
>>>
>>>
>>> How about adding the notion of a "currentHandler" to the 
>>> Mediamonitor?  That way the notification system could do something 
>>> like "If I found a handler and it's not the same handler as is 
>>> currently active then fire the event"..
>>>
>>> This would take care of quite a few "isms" I've seen..
>>
>>
>>
>> create a QMediaEvent send by mediamonitor
>>
>> MyDialog::contentsMediaChangeEvent( QMediaEvent *me )
>> {
>>      //if the event interest my dialog then
>>      if (me->MediaType == MEDIATYPE_DATA)
>>          // do something
>>      else
>>         MythDialog::contentsMediaChangeEvent( me );
>> }
>>
>> and  MythDialog implement like this
>> MythDialog::contentsMediaChangeEvent( QMediaEvent *me )
>> {
>>     // nobody catch this event then run appropriate mediahandler
>>
>> }
>>
>> Xavier
>>
>>
> Or simply create a virtual function in MythDialog like this :
> bool MythDialog::onMediaEvent(MythMediaDevice * mediadevice)
> {
>      return false;
> }
> 
> Then mediamonitor can made something like that :
> bool iscatched = gContext->GetCurrentWindow()->onMediaEvent(mymedia);
> if (!iscaatched){
>     //run mediahandler like before
> }
> 
> And a specific dialog can do that, example with VideoTree
> 
> bool VideoTree::onMediaEvent(MythMediaDevice * mediaevent){
>    emit slotMediaEvent(mediadevice);
>    return true;
> }
> 
> with slot :
> VideoTree::slotMediaEvent(MythMediaDevice * mediadevice){
>    //here do what i should do with mediadevice
> }
> 
> any comment about that ?
> 
> Xavier
> 

I try this :
QWidget * activewindow = qApp->activeWindow();

if (activewindow)
    if (MythDialog * mythActiveWindow
          = dynamic_cast<MythDialog*>(activewindow))
      cout << "Myth activewindow " <<mythActiveWindow->name() << endl;
    else if (QDialog * mythActiveWindow
             = dynamic_cast<QDialog*>(activewindow))
      cout << "QDialog activewindow " <<mythActiveWindow->name() << endl;

to get the active window, but the result is always like this :
QDialog activewindow unnamed

What is strange is that activeWindow is a QDialog and the name always 
"unnamed". if someone know how to get the active MythDialog, can he tell 
me ?

Xavier



More information about the mythtv-dev mailing list