diff options
| author | Sebastian | 2010-05-12 19:42:27 +0200 |
|---|---|---|
| committer | Sebastian | 2010-05-12 19:42:27 +0200 |
| commit | ce3329047d378a14006ce74ec273ac59e3375303 (patch) | |
| tree | 782430f270b4c7aca1b35d5b7813518e3797c555 /src/util/vncClientThread.h | |
| download | pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.gz pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.xz pvs-ce3329047d378a14006ce74ec273ac59e3375303.zip | |
initial import of latest svn version
Diffstat (limited to 'src/util/vncClientThread.h')
| -rw-r--r-- | src/util/vncClientThread.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/util/vncClientThread.h b/src/util/vncClientThread.h new file mode 100644 index 0000000..10980b8 --- /dev/null +++ b/src/util/vncClientThread.h @@ -0,0 +1,114 @@ +/* + # Copyright (c) 2009, 2010 - OpenSLX Project, Computer Center University of + # Freiburg + # + # This program is free software distributed under the GPL version 2. + # See http://openslx.org/COPYING + # + # If you have any feedback please consult http://openslx.org/feedback and + # send your suggestions, praise, or complaints to feedback@openslx.org + # + # General information about OpenSLX can be found at http://openslx.org/ + */ + +#ifndef VNCCLIENTTHREAD_H_ +#define VNCCLIENTTHREAD_H_ + +#include <QtCore> +#include <QtGui/QImage> + +extern "C" +{ +#include <rfb/rfbclient.h> +} + +class SomeEvent +{ +public: + virtual ~SomeEvent(); + + virtual void fire(rfbClient*) = 0; +}; + +class KeyEvent : public SomeEvent +{ +public: + KeyEvent(int key, int pressed) + : _key(key), _pressed(pressed) {} + + void fire(rfbClient*); + +private: + int _key; + int _pressed; +}; + +class PointerEvent : public SomeEvent +{ +public: + PointerEvent(int x, int y, int buttonMask) + : _x(x), _y(y), _buttonMask(buttonMask) {} + + void fire(rfbClient*); + +private: + int _x; + int _y; + int _buttonMask; +}; + +class VNCClientThread: public QThread +{ + Q_OBJECT + +public: + VNCClientThread(QString host, int port, QString passwd, int quality, int updatefreq = 0); + ~VNCClientThread(); + + void run(); + QImage getImage(); + QSize getSize(); + int getUpdatefreq(); + void setUpdatefreq(int updatefreq); + QString getDesktopName(); + void mouseEvent(int x, int y, int buttonMask); + void keyEvent(int key, bool pressed); + bool isConnected() + { + return _connected; + } + + + static void updateImage(rfbClient *client, int x, int y, int w, int h); + static char* passwdHandler(rfbClient *client); + static rfbBool frameBufferHandler(rfbClient *client); + //rfbClient* getRfbClient(); + + bool terminate; + + int const static HIGH = 0; + int const static MEDIUM = 1; + int const static LOW = 2; + +Q_SIGNALS: + void imageUpdated(int x, int y, int w, int h); + +private: + rfbClient *_client; + uint8_t *_frameBuffer; + + QString _host; + int _port; + QString _passwd; + int _quality; + int _updatefreq; + QQueue<SomeEvent* > _eventQueue; + + QImage _img; + QSize _clientSize; + + bool _connected; + +}; + +#endif /* VNCCLIENTTHREAD_H_ */ |
