VncThread - communicate with VNC server, scale image if necessary.
More...
#include "vncthread.h"
|
int static const | HIGH = 0 |
|
int static const | MEDIUM = 1 |
|
int static const | LOW = 2 |
|
|
static void | updateImage (rfbClient *client, int x, int y, int w, int h) |
| Callback for the vnc client lib: A part of the frame buffer has changed. More...
|
|
static char * | passwdHandler (rfbClient *client) |
| Callback for the vnc client lib: The VNC server is requesting a password. More...
|
|
static rfbBool | frameBufferHandler (rfbClient *client) |
| Callback for the vnc client lib: The size of the remote screen has been changed, so we're supposed to reallocate the local frame buffer. More...
|
|
VncThread - communicate with VNC server, scale image if necessary.
As this class is derived from QThread and overrides the run() method, it does not have an event-loop. Do NOT try to add any slots to it. It will NOT be able to receive signals. Emitting signals is fine though.
Definition at line 36 of file vncthread.h.
VncThread::VncThread |
( |
QString |
host, |
|
|
int |
port, |
|
|
QString |
passwd, |
|
|
int |
quality |
|
) |
| |
Initialize this VNC client connection worker thread.
- Parameters
-
host | The IP address of the VNC server we're going to connect to |
port | The port of the VNC server |
passwd | The password of the VNC server |
quality | The desired quality level for the VNC stream |
Definition at line 34 of file vncthread.cpp.
VncThread::~VncThread |
( |
| ) |
|
|
override |
void VncThread::calcScaling |
( |
| ) |
|
|
private |
void VncThread::emitStarted |
( |
| ) |
|
|
private |
rfbBool VncThread::frameBufferHandler |
( |
rfbClient * |
client | ) |
|
|
staticprivate |
Callback for the vnc client lib: The size of the remote screen has been changed, so we're supposed to reallocate the local frame buffer.
- Parameters
-
client | Struct representing the connection to the server. |
- Returns
- true (signaling the vnc client that we successfully allocated a buffer)
Definition at line 188 of file vncthread.cpp.
QString VncThread::getDesktopName |
( |
| ) |
const |
Get name of the VNC server's desktop.
- Returns
- Name of the remote desktop
Definition at line 139 of file vncthread.cpp.
const QSharedPointer<QImage>& VncThread::getFrameBuffer |
( |
| ) |
|
|
inline |
void VncThread::imageUpdated |
( |
const int |
x, |
|
|
const int |
y, |
|
|
const int |
w, |
|
|
const int |
h |
|
) |
| |
|
signal |
bool VncThread::isConnected |
( |
| ) |
const |
|
inline |
char * VncThread::passwdHandler |
( |
rfbClient * |
client | ) |
|
|
staticprivate |
Callback for the vnc client lib: The VNC server is requesting a password.
- Parameters
-
client | Struct representing the connection to the server. |
- Returns
- A strdup()ed copy of the password we'll try to connect with. The memory if free()d by the vnc client library.
Definition at line 175 of file vncthread.cpp.
void VncThread::processImageUpdate |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
private |
Handle update of an area of the VNC framebuffer.
Will do any scaling if necessary and then emit the imageUpdated signal, so the VncWindow knows that it needs to redraw.
- Parameters
-
x | X offset of the area in the framebuffer that changed |
y | Y offset of the area in the framebuffer that changed |
w | width of the area in the framebuffer that changed |
h | height of the area in the framebuffer that changed |
Definition at line 156 of file vncthread.cpp.
void VncThread::projectionStarted |
( |
| ) |
|
|
signal |
void VncThread::projectionStopped |
( |
| ) |
|
|
signal |
Worker thread's mainloop, connecting to the VNC server and handling the connection.
The vnc client library is written in a blocking manner, so we just do everything in our own thread and just hand over the image updates to the vnc client window, which resides in the application's main thread.
This thread checks if the vnc window signaled us to stop and if so, it deletes itself. This means that you should never delete this thread from anywhere. Just call VncThread::stop() and wait for it to delete itself.
Definition at line 71 of file vncthread.cpp.
void VncThread::updateImage |
( |
rfbClient * |
client, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
staticprivate |
Callback for the vnc client lib: A part of the frame buffer has changed.
That means we have to apply scaling if necessary, and then cause the vnc window to redraw the corresponding area.
- Parameters
-
client | Struct representing the connection to the server. |
x | X offset of the area in the framebuffer that changed |
y | Y offset of the area in the framebuffer that changed |
w | width of the area in the framebuffer that changed |
h | height of the area in the framebuffer that changed |
Definition at line 263 of file vncthread.cpp.
rfbClient* VncThread::_client |
|
private |
volatile bool VncThread::_connected {} |
|
private |
QSharedPointer<QImage> VncThread::_img |
|
private |
QString VncThread::_passwd |
|
private |
volatile bool VncThread::_run |
|
private |
int static const VncThread::HIGH = 0 |
|
static |
int static const VncThread::LOW = 2 |
|
static |
int static const VncThread::MEDIUM = 1 |
|
static |
The documentation for this class was generated from the following files: