No subject


Tue May 30 07:28:35 UTC 2006


a logical identifier, so if it begins with 'ir', I simply send a
KeyPress and KeyRelease event like below, so this logical identifier
ends up in the handler.

            QKeyEvent keyp( QEvent::KeyPress, 0, 0, 0, lke->getLircText( ) );
            QKeyEvent keyr( QEvent::KeyRelease, 0, 0, 0, lke->getLircText( ) );
            QObject *key_target = getTarget(keyp);
            if (!key_target)
            {
                QApplication::sendEvent( this, &keyp );
                QApplication::sendEvent( this, &keyr );
            }
            else
            {
                QApplication::sendEvent( key_target, &keyp );
                QApplication::sendEvent( key_target, &keyr );
            }

Then, we reach the MythMainWindow::TranslateKeyPress( ) routine in
which we receive the logical identifier. I test for that checking if
key( ) == 0, ascii( ) == 0 and if the text( ) starts with 'ir', it
attempts to retrieve the mapping correctly using that string, in stead
of the keycode.

The BindKey routine also had to be modified a bit -- this currently
accepts stuff like "Left,<" but should also accept "Left,<,irLeft". As
'irXXXX' arent't known keysequences, that routine had to be modified a
bit, splitting the string up into tokens, and processing each token in
turn.

Of course, for this all to work, I had to change the AddMapping /
GetMapping routines to accept QStrings, [actually created new
routines, overloading the old routines to the new ones] and thus also
change the QMap definition for the keycontext action-lists (an integer
can't store, say 'irGREEN', or 'irMENU'.) That was basically the
biggest change.

It works, definitely needs some cleaning up, but it works.

I do seriously wonder however, whether QT really doesn't mind that I
abuse the 'txt' member of the QKeyEvent in such a way, it could break
various other stuff I'm not aware of (in MythTV as well for that
matter).

Cheers,
NG


More information about the mythtv-dev mailing list