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
42#ifndef QVFBVIEW_H
43#define QVFBVIEW_H
44
45//#ifdef QT_NO_OPENGL
46#include <QWidget>
47//#else
48//#define QVFB_USE_GLWIDGET
49//#include <QGLWidget>
50//#endif
51
52QT_BEGIN_NAMESPACE
53
54class QImage;
55class QTimer;
56class QAnimationWriter;
57struct QVFbHeader;
58class QVFbViewProtocol;
59class QX11EmbedContainer;
60
61class QVFbAbstractView :
62#ifdef QVFB_USE_GLWIDGET
63 public QGLWidget
64#else
65 public QWidget
66#endif
67{
68 Q_OBJECT
69public:
70 enum Rotation { Rot0, Rot90, Rot180, Rot270 };
71 enum PixelFormat { DefaultFormat, GrayscaleFormat, RGBFormat, ARGBFormat };
72 QVFbAbstractView( QWidget *parent = 0);
73 virtual ~QVFbAbstractView();
74
75 virtual int displayId() const = 0;
76 virtual int displayWidth() const = 0;
77 virtual int displayHeight() const = 0;
78 virtual int displayDepth() const = 0;
79 virtual PixelFormat displayFormat() const { return DefaultFormat; }
80 virtual bool rgbSwapped() const { return false; }
81 virtual Rotation displayRotation() const = 0;
82
83 virtual void setGamma(double gr, double gg, double gb) = 0;
84 virtual double gammaRed() const = 0;
85 virtual double gammaGreen() const = 0;
86 virtual double gammaBlue() const = 0;
87 virtual void getGamma(int i, QRgb& rgb) = 0;
88
89 virtual bool touchScreenEmulation() const = 0;
90 virtual bool lcdScreenEmulation() const = 0;
91 virtual int rate() = 0;
92 virtual bool animating() const = 0;
93 virtual QImage image() const = 0;
94 virtual void setRate(int) = 0;
95
96 virtual double zoomH() const = 0;
97 virtual double zoomV() const = 0;
98
99public slots:
100 virtual void setTouchscreenEmulation( bool ) = 0;
101 virtual void setLcdScreenEmulation( bool ) = 0;
102 virtual void setZoom( double, double ) = 0;
103 virtual void setRotation(Rotation) = 0;
104 virtual void startAnimation( const QString& ) = 0;
105 virtual void stopAnimation() = 0;
106 virtual void skinKeyPressEvent( int code, const QString& text, bool autorep=FALSE ) = 0;
107 virtual void skinKeyReleaseEvent( int code, const QString& text, bool autorep=FALSE ) = 0;
108 virtual void setViewFormat(PixelFormat) {}
109 virtual void setRgbSwapped( bool ) {};
110 virtual void embedDisplay(WId) {}
111};
112
113class QVFbView : public QVFbAbstractView
114{
115 Q_OBJECT
116public:
117 QVFbView(int id, int w, int h, int d, Rotation r, QWidget *parent = 0);
118 virtual ~QVFbView();
119
120 int displayId() const;
121 int displayWidth() const;
122 int displayHeight() const;
123 int displayDepth() const;
124 PixelFormat displayFormat() const;
125 bool rgbSwapped() const { return rgb_swapped; }
126 Rotation displayRotation() const;
127
128 bool touchScreenEmulation() const { return emulateTouchscreen; }
129 bool lcdScreenEmulation() const { return emulateLcdScreen; }
130 int rate() { return refreshRate; }
131 bool animating() const { return !!animation; }
132 QImage image() const;
133
134 void setGamma(double gr, double gg, double gb);
135 double gammaRed() const { return gred; }
136 double gammaGreen() const { return ggreen; }
137 double gammaBlue() const { return gblue; }
138 void getGamma(int i, QRgb& rgb);
139 void skinMouseEvent(QMouseEvent *e);
140
141 double zoomH() const { return hzm; }
142 double zoomV() const { return vzm; }
143
144 QSize sizeHint() const;
145 void setRate(int);
146
147public slots:
148 void setTouchscreenEmulation(bool);
149 void setLcdScreenEmulation(bool);
150 void setZoom(double, double);
151 void setRotation(Rotation);
152 void startAnimation(const QString&);
153 void stopAnimation();
154 void skinKeyPressEvent(int code, const QString& text, bool autorep=FALSE);
155 void skinKeyReleaseEvent(int code, const QString& text, bool autorep=FALSE);
156 void setViewFormat(PixelFormat);
157 void setRgbSwapped(bool b) { rgb_swapped = b; }
158#ifdef Q_WS_X11
159 void embedDisplay(WId id);
160#endif
161
162protected slots:
163 void refreshDisplay(const QRect &);
164
165protected:
166 QImage getBuffer(const QRect &r, int &leading) const;
167 void drawScreen(const QRect &r);
168 void sendMouseData(const QPoint &pos, int buttons, int wheel);
169 void sendKeyboardData(QString unicode, int keycode, int modifiers,
170 bool press, bool repeat);
171 //virtual bool eventFilter(QObject *obj, QEvent *e);
172 virtual void paintEvent(QPaintEvent *pe);
173 virtual void contextMenuEvent(QContextMenuEvent *e);
174 virtual void mousePressEvent(QMouseEvent *e);
175 virtual void mouseDoubleClickEvent(QMouseEvent *e);
176 virtual void mouseReleaseEvent(QMouseEvent *e);
177 virtual void mouseMoveEvent(QMouseEvent *e);
178 virtual void wheelEvent(QWheelEvent *e);
179 virtual void keyPressEvent(QKeyEvent *e);
180 virtual void keyReleaseEvent(QKeyEvent *e);
181 virtual bool event(QEvent *event);
182
183private:
184 void setDirty(const QRect&);
185 int viewdepth; // "faked" depth
186 PixelFormat viewFormat;
187 bool rgb_swapped;
188 int rsh;
189 int gsh;
190 int bsh;
191 int rmax;
192 int gmax;
193 int bmax;
194 int contentsWidth;
195 int contentsHeight;
196 double gred, ggreen, gblue;
197 QRgb* gammatable;
198
199 int refreshRate;
200 QAnimationWriter *animation;
201 double hzm,vzm;
202 QVFbViewProtocol *mView;
203 bool emulateTouchscreen;
204 bool emulateLcdScreen;
205 Rotation rotation;
206
207#ifdef Q_WS_X11
208 QX11EmbedContainer *embedContainer;
209#endif
210};
211
212QT_END_NAMESPACE
213
214#endif
215

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