Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

keypressEvent improvement: Add actionEvent in mythuitype class

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


xavier.hervy at bluebottle

Nov 23, 2008, 3:43 AM

Post #1 of 2 (988 views)
Permalink
keypressEvent improvement: Add actionEvent in mythuitype class

Hi,

I would like to modify keypressEvent in mythui to make use of a new
public method "actionEvent" in mythuitype as below :
virtual bool keyPressEvent(QKeyEvent *);

Here is a example of implementation with mythuibutton:

bool MythUIButton::actionEvent(QString action)
{
if (action == "SELECT")
{
if (!IsEnabled())
return false;

if (m_Pushed)
UnPush();
else
Push();
}
else
handled = false;
}

bool MythUIButton::keyPressEvent(QKeyEvent *e)
{
QStringList actions;
bool handled = false;
GetMythMainWindow()->TranslateKeyPress("Global", e, actions);

for (int i = 0; i < actions.size() && !handled; i++)
{
QString action = actions[i];
handled = true;

handled = actionEvent(action);
}

return handled;
}

This would allow the network protocol to use action instead of key to
send command to the frontend, preventing to break any client using the
network control protocol when the default key binding is modified by the
user.
The telnet interface could easily implement :
action SELECT to send an action to the frontend.

This is a minor change but on a lot of file which is why I like to have
a feedback before doing any patch (especially from stuart).

Regqrds,
Xavier
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


xavier.hervy at bluebottle

Nov 23, 2008, 3:47 AM

Post #2 of 2 (820 views)
Permalink
Re: keypressEvent improvement: Add actionEvent in mythuitype class [In reply to]

I forgot the return value for actionEvent

bool MythUIButton::actionEvent(QString action)
{
bool handled = false;
if (action == "SELECT")
{
if (!IsEnabled())
return false;

if (m_Pushed)
UnPush();
else
Push();
}
else
handled = false;
return handled;
}

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.