Closed kevkha closed 9 years ago
What OS do you use?
I will target Ubuntu first but would like to have this feature working cross platform. Is it possible?
yes, It just could have issues on Mac OS X That's why I asked.
to enable handling keyboard events you have to add focus: true;
to Qml item
focus: true;
Keys.onPressed: {
console.log( event.key );
}
I do have focus: true;
set. When I map keys on keyboard work but not from remote control. Nothing get printed out. Per http://doc.qt.digia.com/qt-maemo/qt.html I tried to add
#include Qt>to main.cpp but still no joy.
Hm, I don't know how remote control works. Where I can read about it? btw, we use Qt 5, so better read docs related to this version, not Qt 4 - it could be very different in some aspects.
Maybe you have to translate signals from remote control to key press by yourself? If yes, I could give you some hints about how to emulate keyboard events.
Yes, please assist. I think that's what I lack of. In Ubuntu we can use irw to get the key name and code and use xdotool for keys mapping. Do you know such tool like irw for Windows?
no, didn't ever work with remote controls. But hear about http://winlirc.sourceforge.net/
So, when you will find the way to get events from IR within c++ code - you could emulate keyboard events as it was done there: https://github.com/RSATom/WebChimera/blob/master/src/Mac/Chimera_Mac.mm#L400 (it's part of WebChimera plugin for Mac)
I did some diggings and found this old post http://forum.qt.io/topic/611/how-to-generate-an-event-to-esc-escape-f1-and-such-keys/14 which discussed about mapping RC keys. My C++ skill is very rusty and not sure how to start from here. Can you help on sample class? Thanks.
It seems there are two parts in this task:
how to do second part I gave link above. About first part - look this http://prdownloads.sourceforge.net/lirc/xirw-0.4.2.tar.bz2
Thank you. I used irw to retrieve codes and commands in Ubuntu
000000037ff07be9 00 KEY_PLAY mceusb 000000037ff07be7 00 KEY_PAUSE mceusb 000000037ff07be4 00 KEY_AGAIN mceusb 000000037ff07be5 00 KEY_NEXT mceusb 000000037ff07be6 00 KEY_STOP mceusb 000000037ff07bdc 00 KEY_BACK mceusb
If I am going to hard code this in c++ for QmlVlc does that mean another user with a different IR can't control the program because the commands might be different? What is the best approach for the program to work with any IR control? Is that when mapping with irexec or xirw come into play?
If I am going to hard code this in c++ for QmlVlc does that mean another user with a different IR can't control the program because the commands might be different?
I think it's very possible, but don't sure.
Is that when mapping with irexec or xirw come into play?
I think, yes.
Ok thanks. I will give it a try. It would be nice to have a library for standard IR control in QmlVlc. Are you planning to add this feature in the near future?
No, I don't plan it, but it worth to think about it.
I have good news. I use a different IR branded Rosewill RRC-126 (MCE fully compatible) and it works out of the box for both Windows and Ubuntu. There is no need to add IR c++ code. I only used the same QML Qt.Key_* mentioned above. I'm happy with this result. Thanks again.
How do you get IR commands from WinLIRC in your application? over sockets?
I'm not using WinLIRC at all. None of the devices suit with my USB IR so I could not get a config.cf created. In qml I just use.
FocusScope { id: mainScope focus: true Keys.onPressed: { //vlc control if ( (event.key === Qt.Key_MediaPlay) || (event.key === Qt.Key_Key_MediaPause) || (event.key === Qt.Key_Play) || (event.key === Qt.Key_Pause) ) { event.accepted = true; controlRect.visible = !controlRect.visible; vlcPlayer.togglePause(); //DEBUG console.log("Key " + event.key + " detected"); } } }
What USB IR do you use? Rosewill RRC-126? Did you install any software for it?
Yes, the RRC-126. I did not install any software. The driver is taken care by the OS (Windows 7).
Hm... interesting, didn't know Widows has drivers for IR controls.
It seems all signal translation made inside driver, so application just get it as keyboard key presses. Then it will work for all IR controls supported by supplied by Windows drivers.
Yeah I was thinking of the hard way. I should add Qt.Key_Space to cover keyboard. You may close this issue. Thanks.
Hi Sergey,
Can you provide guidance to use a remote control in Qt QML with your library? I tried below and with Qt.Key_Play and Qt.Key_Pause but nothing seems to work.
Thanks in advance.
Example: