Pool Video Switch v2
Software video switch for distributed remote display in a lecture environment
vncwindow.h
Go to the documentation of this file.
1 /*
2  # Copyright (c) 2009, 2010 - OpenSLX Project, Computer Center University of
3  # Freiburg
4  #
5  # This program is free software distributed under the GPL version 2.
6  # See http://openslx.org/COPYING
7  #
8  # If you have any feedback please consult http://openslx.org/feedback and
9  # send your suggestions, praise, or complaints to feedback@openslx.org
10  #
11  # General information about OpenSLX can be found at http://openslx.org/
12  */
13 
14 #ifndef CLIENTVNCVIEWER_H_
15 #define CLIENTVNCVIEWER_H_
16 
17 #include <QSharedPointer>
18 #include <QWidget>
19 #include <QPixmap>
20 
21 class VncThread;
22 class QPainter;
23 class QImage;
24 
25 class VncWindow : public QWidget
26 {
27  Q_OBJECT
28 
29 public:
30  VncWindow(QWidget *parent = 0);
31  virtual ~VncWindow();
32 
33 protected slots:
34  void onUpdateImage(const int x, const int y, const int w, const int h);
35  void onProjectionStarted();
36  void onProjectionStopped();
37  void timer_moveToTop();
38  void deleteVncThread();
39 
40 public slots:
41  void open(const QString& host, int port, const QString& passwd, bool ro, bool fullscreen, const QString& caption, const int clientId, const QByteArray& rawThumb);
42 
43 signals:
44  void running(const bool isRunning, const int clientId);
45 
46 protected:
47  void paintEvent(QPaintEvent *event);
48  void resizeEvent(QResizeEvent*) { this->update(); }
49  void closeEvent(QCloseEvent *e);
50  void timerEvent(QTimerEvent *event);
51  void keyReleaseEvent(QKeyEvent *event);
52 
53 private:
56  bool _viewOnly;
58  int _clientId;
61  QPixmap _remoteThumb;
62  QSize _remoteSize;
63  QSize _desiredSize;
64 
65  void draw(const int x, const int y, const int w, const int h);
66  void terminateVncThread();
67  bool calcScaling(const QImage *remote);
68 
69 };
70 
71 #endif /* CLIENTVNCVIEWER_H_ */
void draw(const int x, const int y, const int w, const int h)
Draws given part of the current VNC frame buffer to the window.
Definition: vncwindow.cpp:97
void timerEvent(QTimerEvent *event)
Called when a Qt timer fires.
Definition: vncwindow.cpp:332
int _dstStepX
Definition: vncwindow.h:54
bool _multiScreen
Definition: vncwindow.h:57
virtual ~VncWindow()
void closeEvent(QCloseEvent *e)
Called by Qt if the window is requested to be closed.
Definition: vncwindow.cpp:242
void onProjectionStarted()
Triggered by _vncWorker after successfully connecting to the VNC server.
Definition: vncwindow.cpp:288
VncThread - communicate with VNC server, scale image if necessary.
Definition: vncthread.h:36
int _dstStepY
Definition: vncwindow.h:54
bool calcScaling(const QImage *remote)
When using image scaling, calc matching pixel borders for both resolutions to prevent artifacts throu...
Definition: vncwindow.cpp:147
void terminateVncThread()
Terminates the vnc worker thread and stops all related timers.
Definition: vncwindow.cpp:63
int _srcStepY
Definition: vncwindow.h:54
VncThread * _vncWorker
Definition: vncwindow.h:55
int _srcStepX
Definition: vncwindow.h:54
int _tcpTimeoutTimer
Definition: vncwindow.h:60
int _clientId
Definition: vncwindow.h:58
void resizeEvent(QResizeEvent *)
Definition: vncwindow.h:48
void running(const bool isRunning, const int clientId)
void paintEvent(QPaintEvent *event)
Called by Qt when a part of the window should be redrawn.
Definition: vncwindow.cpp:356
QSize _remoteSize
Definition: vncwindow.h:62
void keyReleaseEvent(QKeyEvent *event)
Called when user releases a pressed key and the window has focus.
Definition: vncwindow.cpp:379
void deleteVncThread()
Definition: vncwindow.cpp:83
VncWindow(QWidget *parent=0)
Definition: vncwindow.cpp:42
QSize _desiredSize
Definition: vncwindow.h:63
QPixmap _remoteThumb
Definition: vncwindow.h:61
bool _viewOnly
Definition: vncwindow.h:56
void onUpdateImage(const int x, const int y, const int w, const int h)
Triggered by imageUpdate signal from the _vncWorker thread telling that the given region of the image...
Definition: vncwindow.cpp:264
void onProjectionStopped()
Triggered by _vncWorker when the connection to the VNC server is lost.
Definition: vncwindow.cpp:305
int _redrawTimer
Definition: vncwindow.h:59
void open(const QString &host, int port, const QString &passwd, bool ro, bool fullscreen, const QString &caption, const int clientId, const QByteArray &rawThumb)
Show the VNC client window and connect to the given VNC server.
Definition: vncwindow.cpp:186
void timer_moveToTop()
Definition: vncwindow.cpp:311