From ce3329047d378a14006ce74ec273ac59e3375303 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 12 May 2010 19:42:27 +0200 Subject: initial import of latest svn version --- src/util/vncClientThread.h | 114 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/util/vncClientThread.h (limited to 'src/util/vncClientThread.h') 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 +#include + +extern "C" +{ +#include +} + +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 _eventQueue; + + QImage _img; + QSize _clientSize; + + bool _connected; + +}; + +#endif /* VNCCLIENTTHREAD_H_ */ -- cgit v1.2.3-55-g7522