/* # 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_ */