Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
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
48QT_BEGIN_NAMESPACE
49
50class QVFbKeyProtocol;
51class QVFbMouseProtocol;
52class QVFbViewProtocol : public QObject
53{
54 Q_OBJECT
55public:
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) {}
76public slots:
77 virtual void flushChanges();
78
79signals:
80 void displayDataChanged(const QRect &);
81 void displayEmbedRequested(WId windowId);
82
83protected:
84 virtual QVFbKeyProtocol *keyHandler() const = 0;
85 virtual QVFbMouseProtocol *mouseHandler() const = 0;
86
87private:
88 int mDisplayId;
89};
90
91class QVFbKeyProtocol
92{
93public:
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
102private:
103 int mDisplayId;
104};
105
106class QVFbMouseProtocol
107{
108public:
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
116private:
117 int mDisplayId;
118};
119
120/* since there is very little variation in input protocols defaults are
121 provided */
122
123class QVFbKeyPipeProtocol : public QVFbKeyProtocol
124{
125public:
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; }
133private:
134 int fd;
135 QString fileName;
136};
137
138class QVFbMousePipe: public QVFbMouseProtocol
139{
140public:
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; }
147protected:
148 int fd;
149 QString fileName;
150};
151
152class QTimer;
153class QVFbMouseLinuxTP : public QObject, public QVFbMousePipe
154{
155 Q_OBJECT
156public:
157 QVFbMouseLinuxTP(int display_id);
158 ~QVFbMouseLinuxTP();
159
160 void sendMouseData(const QPoint &pos, int buttons, int wheel);
161
162protected slots:
163 void repeatLastPress();
164
165protected:
166 void writeToPipe(const QPoint &pos, ushort pressure);
167 QPoint lastPos;
168 QTimer *repeater;
169};
170
171QT_END_NAMESPACE
172
173#endif
174

Warning: That file was not part of the compilation database. It may have many parsing errors.