blob: 6893135e5908a31cfbdb8727cd6d1a16006b967e (
plain) (
tree)
|
|
/**
*
* VNCConnection
*
* The VNCConnection and the VNCConnectInfo are the Classes containing the information about the vnc-connections.
* While the VNCConnectInfo just holds the information about the token and password / parameters given on
* create time of a new connection, the connection itself contains the C-Object from the vnc library and is
* maintained by the PVSConnectionManger.
*/
#ifndef _VNCCONNECTION_H_
#define _VNCCONNECTION_H_
extern "C"
{
#include <rfb/rfbclient.h>
}
#include <QtGui>
#include "../util/vncClientThread.h"
#include <src/gui/connectionFrame.h>
#include <iostream>
#include <QtCore/QObject>
#define PROFILE
#include <src/util/timeUtil.h>
class VNCConnection; // forward declaration
class ConnectionFrame;
class PVSConnectionManager;
class VNCConnectInfo
{
//Q_OBJECT
public:
VNCConnectInfo(); //Constructor
VNCConnectInfo(int newCount, char** newArgs, QString pass = ""); // Constructor with instant information feed
~VNCConnectInfo();
void setArguments(int newCount, char** newArgs, QString pass = ""); // (re)feed of information
int getCount(); // returns count
bool pwSet()
{
return passwordSupplied;
}; // returns wether a password was set or not
char ** getArguments(); // returns pointer to an array of char arrays holding the given arguments
QString getPassword(); // returns (if given) the password
private:
char** arguments;
bool passwordSupplied;
QString password;
int count;
};
class VNCConnection : public QObject
{
Q_OBJECT
public:
VNCConnection(QString newPass = ""); // Constructor
~VNCConnection();
bool initClient(VNCConnectInfo* newConInfo); // initiates the connection based on the information given with the VNCConnectInfo object
void reInitClientWithQuality(int quality);
bool isOK(); // returns true if not dead, false otherwise
bool viewOnly();
void setDead(); // marks the connection for removal
void clear(); // does internal cleanup
void setFrame(ConnectionFrame* newFrame); // sets the given frame as its own
ConnectionFrame* getFrame(); // if present, returns the frame
static char* getPassword(rfbClient* client); // is called if a rfbclient-object asks for a password and starts the upward chain to ask for a password
QString getPassword(); // bad overload, since it returns the stored password (if any was given)
QString getHost()
{
return _host;
}
bool getPWSet(); // returns true if a password was given, false otherwise
//Glib::RefPtr<Gdk::Pixbuf> getBuffer();
bool getBusy() { return busy; }
QString getDesktopName();
VNCClientThread* getVNCClientThread();
Q_SIGNALS:
void finished();
private:
VNCClientThread *thread;
ConnectionFrame* myFrame;
QImage img;
QString password, stringHost, _host, _port;
bool pwSet;
bool first;
bool view_only;
bool overSized;
float ratio;
bool busy;
bool locked;
QString _desktopName;
};
#endif
|