author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 09:15:16 +0300 | |
branch | RCL_3 |
changeset 10 | 68d3b337861b |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the tools applications of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
#ifndef QVFBPROTOCOL_H |
|
42 |
#define QVFBPROTOCOL_H |
|
43 |
||
44 |
#include <QImage> |
|
45 |
#include <QVector> |
|
46 |
#include <QColor> |
|
47 |
||
48 |
QT_BEGIN_NAMESPACE |
|
49 |
||
50 |
class QVFbKeyProtocol; |
|
51 |
class QVFbMouseProtocol; |
|
52 |
class QVFbViewProtocol : public QObject |
|
53 |
{ |
|
54 |
Q_OBJECT |
|
55 |
public: |
|
56 |
QVFbViewProtocol(int display_id, QObject *parent = 0); |
|
57 |
||
58 |
virtual ~QVFbViewProtocol(); |
|
59 |
||
60 |
int id() const { return mDisplayId; } |
|
61 |
||
62 |
void sendKeyboardData(QString unicode, int keycode, |
|
63 |
int modifiers, bool press, bool repeat); |
|
64 |
void sendMouseData(const QPoint &pos, int buttons, int wheel); |
|
65 |
||
66 |
virtual int width() const = 0; |
|
67 |
virtual int height() const = 0; |
|
68 |
virtual int depth() const = 0; |
|
69 |
virtual int linestep() const = 0; |
|
70 |
virtual int numcols() const = 0; |
|
71 |
virtual QVector<QRgb> clut() const = 0; |
|
72 |
virtual unsigned char *data() const = 0; |
|
73 |
virtual int brightness() const = 0; |
|
74 |
||
75 |
virtual void setRate(int) {} |
|
76 |
public slots: |
|
77 |
virtual void flushChanges(); |
|
78 |
||
79 |
signals: |
|
80 |
void displayDataChanged(const QRect &); |
|
81 |
void displayEmbedRequested(WId windowId); |
|
82 |
||
83 |
protected: |
|
84 |
virtual QVFbKeyProtocol *keyHandler() const = 0; |
|
85 |
virtual QVFbMouseProtocol *mouseHandler() const = 0; |
|
86 |
||
87 |
private: |
|
88 |
int mDisplayId; |
|
89 |
}; |
|
90 |
||
91 |
class QVFbKeyProtocol |
|
92 |
{ |
|
93 |
public: |
|
94 |
QVFbKeyProtocol(int display_id) : mDisplayId(display_id) {} |
|
95 |
virtual ~QVFbKeyProtocol() {} |
|
96 |
||
97 |
int id() const { return mDisplayId; } |
|
98 |
||
99 |
virtual void sendKeyboardData(QString unicode, int keycode, |
|
100 |
int modifiers, bool press, bool repeat) = 0; |
|
101 |
||
102 |
private: |
|
103 |
int mDisplayId; |
|
104 |
}; |
|
105 |
||
106 |
class QVFbMouseProtocol |
|
107 |
{ |
|
108 |
public: |
|
109 |
QVFbMouseProtocol(int display_id) : mDisplayId(display_id) {} |
|
110 |
virtual ~QVFbMouseProtocol() {} |
|
111 |
||
112 |
int id() const { return mDisplayId; } |
|
113 |
||
114 |
virtual void sendMouseData(const QPoint &pos, int buttons, int wheel) = 0; |
|
115 |
||
116 |
private: |
|
117 |
int mDisplayId; |
|
118 |
}; |
|
119 |
||
120 |
/* since there is very little variation in input protocols defaults are |
|
121 |
provided */ |
|
122 |
||
123 |
class QVFbKeyPipeProtocol : public QVFbKeyProtocol |
|
124 |
{ |
|
125 |
public: |
|
126 |
QVFbKeyPipeProtocol(int display_id); |
|
127 |
~QVFbKeyPipeProtocol(); |
|
128 |
||
129 |
void sendKeyboardData(QString unicode, int keycode, |
|
130 |
int modifiers, bool press, bool repeat); |
|
131 |
||
132 |
QString pipeName() const { return fileName; } |
|
133 |
private: |
|
134 |
int fd; |
|
135 |
QString fileName; |
|
136 |
}; |
|
137 |
||
138 |
class QVFbMousePipe: public QVFbMouseProtocol |
|
139 |
{ |
|
140 |
public: |
|
141 |
QVFbMousePipe(int display_id); |
|
142 |
~QVFbMousePipe(); |
|
143 |
||
144 |
void sendMouseData(const QPoint &pos, int buttons, int wheel); |
|
145 |
||
146 |
QString pipeName() const { return fileName; } |
|
147 |
protected: |
|
148 |
int fd; |
|
149 |
QString fileName; |
|
150 |
}; |
|
151 |
||
152 |
class QTimer; |
|
153 |
class QVFbMouseLinuxTP : public QObject, public QVFbMousePipe |
|
154 |
{ |
|
155 |
Q_OBJECT |
|
156 |
public: |
|
157 |
QVFbMouseLinuxTP(int display_id); |
|
158 |
~QVFbMouseLinuxTP(); |
|
159 |
||
160 |
void sendMouseData(const QPoint &pos, int buttons, int wheel); |
|
161 |
||
162 |
protected slots: |
|
163 |
void repeatLastPress(); |
|
164 |
||
165 |
protected: |
|
166 |
void writeToPipe(const QPoint &pos, ushort pressure); |
|
167 |
QPoint lastPos; |
|
168 |
QTimer *repeater; |
|
169 |
}; |
|
170 |
||
171 |
QT_END_NAMESPACE |
|
172 |
||
173 |
#endif |