diff options
author | Sebastian | 2010-05-12 19:42:27 +0200 |
---|---|---|
committer | Sebastian | 2010-05-12 19:42:27 +0200 |
commit | ce3329047d378a14006ce74ec273ac59e3375303 (patch) | |
tree | 782430f270b4c7aca1b35d5b7813518e3797c555 /src/pvs.h | |
download | pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.gz pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.xz pvs-ce3329047d378a14006ce74ec273ac59e3375303.zip |
initial import of latest svn version
Diffstat (limited to 'src/pvs.h')
-rw-r--r-- | src/pvs.h | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/src/pvs.h b/src/pvs.h new file mode 100644 index 0000000..4b1e29e --- /dev/null +++ b/src/pvs.h @@ -0,0 +1,146 @@ +/* + # Copyright (c) 2009 - 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 PVSCLIENT_H_ +#define PVSCLIENT_H_ + +#include <QtCore> +#include <X11/Xlib.h> +#include <X11/cursorfont.h> +#include <signal.h> + +#include "setup.h" +#include "src/core/pvsChatClient.h" +#include "src/core/pvsChatMsg.h" +#include "src/net/pvsServerConnection.h" +#include "src/version.h" +#include "src/util/consoleLogger.h" +#include "src/util/clientGUIUtils.h" + + +class PVSServiceDiscovery; +class PVSDiscoveredServer; + +/** + * PVSClient + * base class for the pool video switch client + */ +class PVS: public QObject +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.openslx.pvs") + +public: + PVS(); + ~PVS(); + + void loadCommands(); ///< not inherited, just named like the virtual methods of other net objects + void onCommand(PVSMsg cmdMessage); ///< not inherited, just named like the virtual methods of other net objects + void onLogin(PVSMsg cmdMessage); ///< not inherited, just named like the virtual methods of other net objects + void onDaemonCommand(PVSMsg cmdMessage); ///< not inherited, just named like the virtual methods of other net objects + void onMessage(PVSMsg cmdMessage); + + void securityUnlock() + { + unlock(); + } + ; ///< public forward to the unlock method + void stop(); ///< stop the client + + void setScriptPath(QString path); ///< vnc-start related + + void onConnected(QString name); + void onDisconnected(); + + void connectToHost(PVSDiscoveredServer* server, QString passwd); + void UpdateChatClients(PVSChatMsg chatCommand); + void chat_receive(PVSChatMsg msg); + + void guiAddHost(QString host); + void guiDelHost(QString host); + +public Q_SLOTS: + void start(); + void quit(); + void chat_send(QString nick_to, QString nick_from, QString msg); + QString chat_getNickname(); + QStringList chat_getNicknames(); + void fileChanged(const QString& path); + void pvsConnect(QString host, QString passwd); + void pvsDisconnect(); + QString isConnected(); + QStringList getAvailableHosts(); + QString getIpByNick(QString nick); + +Q_SIGNALS: + void project(QString host, int port, QString passwd, bool fullscreen, + bool smoothTransformation, int quality); + void unproject(); + void chat_receive(QString nick_from, QString nick_to, QString msg); + void chat_client_add(QString nick); + void chat_client_remove(QString nick); + void showMessage(QString title, QString msg, bool useDialog = false); + void connected(QString host); + void disconnected(); + void addHost(QString host); + void delHost(QString host); + +protected: + + void timerEvent(QTimerEvent *event); + +private: + + // own + bool allowExists(); ///< whether the .allow file exists + bool getVNCAllow(); ///< whether vnc-connections to this client are allowed + void readPolicyFiles(); ///< pars the policy files + + + // pvs features and related + bool lock(); ///< lock this client (blankscreen etc) + bool lock_inputs(); ///< lock this client mouse&keyboard only + bool unlock(); ///< remove the lock on this client + + bool _locked; ///< are we locked? + QString _lockMsg; ///< message to display while we're locked + bool _vncAllowed; ///< whether vncConnections to this client are allowed (dup?) + BlankScreen *_blankScreen;///< obhject to blank the screen + + QFileSystemWatcher* _notify; ///< used to get notifies about file changes + //vnc-server + QString _vncScriptPath; ///< path to the vnc script file + QString _vncScriptName; ///< name of the vnc script file + int _vncPort; ///< port to use for the vnc-server (also gets send to the pvsServer) + QString _vncPassword; ///< password to use for the vnc-server (also gets send to the pvsServer) - viewonly password + QString _vncRwPassword; ///< password to use for the vnc-server (also gets send to the pvsServer) - read-write password + + bool gotVNCScript(); ///< whether we got a vnc script + int bootVNC(); ///< init the password and port, then call the startVNCScript() method + int startVNCScript(int port, QString pass, QString rwpass); ///< start the vnc server (via script) + int stopVNCScript(); ///< stop the vnc server (via script) + static void signalHandler(int signal); //handles posix signals + + PVSServerConnection* _pvsServerConnection; ///< our tcp connection object to the pvsserver + + QSettings _settings; + + PVSServiceDiscovery *_sdClient; + + PVSChatClient *_chat; + + bool _vncRequested; ///< did pvsmgr request our screen? + + int _timerLockTest; + int _timerLockDelay; + +}; +#endif /* PVSCLIENT_H_ */ |