Refactor code quite heavily.
[qzeecontrol] / qml / QZeeControl / ZeeRemoteControl.qml
1 /*
2  *  Copyright 2012 Ruediger Gad
3  *
4  *  This file is part of QZeeControl.
5  *
6  *  QZeeControl is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  QZeeControl is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with QZeeControl.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 import QtQuick 1.1
21 import qzeecontrol 1.0
22
23 BtConnector{
24     id: zeeRemoteControl
25
26     /*
27      * Keybindings
28      */
29     property string keyBindingA
30     property string keyBindingB
31     property string keyBindingC
32     property string keyBindingD
33
34     property string keyBindingUp
35     property string keyBindingDown
36     property string keyBindingLeft
37     property string keyBindingRight
38
39 //      Examples on how to use these old signals.
40 //        onStickMoved: {
41 //            console.log("Stick moved. x: " + x + " y: " + y)
42 //        }
43 //        onButtonsChanged: {
44 //            console.log("Buttons changed. A: " + a + " B: " + b + " C: " + c + " D: " + d)
45 //        }
46
47     /*
48      * Do the actual keyboard interaction.
49      */
50     onAChanged: xtstAdapter.sendKey(keyBindingA, val);
51     onBChanged: xtstAdapter.sendKey(keyBindingB, val);
52     onCChanged: xtstAdapter.sendKey(keyBindingC, val);
53     onDChanged: xtstAdapter.sendKey(keyBindingD, val);
54
55     onUpChanged: xtstAdapter.sendKey(keyBindingUp, val)
56     onDownChanged: xtstAdapter.sendKey(keyBindingDown, val)
57     onLeftChanged: xtstAdapter.sendKey(keyBindingLeft, val)
58     onRightChanged: xtstAdapter.sendKey(keyBindingRight, val)
59 }
60
61