author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 22 Apr 2010 16:15:11 +0300 | |
branch | RCL_3 |
changeset 14 | 8c4229025c0b |
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 |
||
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 |
||
52 |
QT_BEGIN_NAMESPACE |
|
53 |
||
54 |
class QImage; |
|
55 |
class QTimer; |
|
56 |
class QAnimationWriter; |
|
57 |
struct QVFbHeader; |
|
58 |
class QVFbViewProtocol; |
|
59 |
class QX11EmbedContainer; |
|
60 |
||
61 |
class QVFbAbstractView : |
|
62 |
#ifdef QVFB_USE_GLWIDGET |
|
63 |
public QGLWidget |
|
64 |
#else |
|
65 |
public QWidget |
|
66 |
#endif |
|
67 |
{ |
|
68 |
Q_OBJECT |
|
69 |
public: |
|
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 |
||
99 |
public 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 |
||
113 |
class QVFbView : public QVFbAbstractView |
|
114 |
{ |
|
115 |
Q_OBJECT |
|
116 |
public: |
|
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 |
||
147 |
public 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 |
||
162 |
protected slots: |
|
163 |
void refreshDisplay(const QRect &); |
|
164 |
||
165 |
protected: |
|
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 |
||
183 |
private: |
|
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 |
||
212 |
QT_END_NAMESPACE |
|
213 |
||
214 |
#endif |