forked from svdm/ChumbyBrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chumbyknobhandler.h
36 lines (28 loc) · 923 Bytes
/
chumbyknobhandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2011 Stefan A. van der Meer
// See "LICENSE" file included with source code for terms and conditions.
#ifndef CHUMBYKNOBHANDLER_H
#define CHUMBYKNOBHANDLER_H
#include <QObject>
// Reads events from sockets specific to the Chumby, in order to send keypress
// events to its parent object.
//
// The QKeyEvents are:
// Qt::Key_Home for the top button on the device;
// Qt::Key_Up when rotating the wheel button upwards;
// Qt::Key_Down when rotating the wheel button downwards.
class ChumbyKnobHandler : public QObject
{
Q_OBJECT
public:
ChumbyKnobHandler(QObject *parent=0);
~ChumbyKnobHandler();
private slots:
// Read from wheel button socket
void readWheel();
private:
// Generate key event for wheel rotation and send to parent.
void handleWheelEvent(int rotation);
// Socket identifiers
static int fdevice_wheel;
};
#endif // CHUMBYKNOBHANDLER_H