summaryrefslogtreecommitdiffstats
path: root/src/server/net
diff options
context:
space:
mode:
authorManuel Schneider2014-07-21 21:19:22 +0200
committerManuel Schneider2014-07-21 22:41:56 +0200
commit5f310d3e0147532d734135771bafcb51a2f501ad (patch)
tree1c385a581c220316d1d33b2fcd4f731574edf40c /src/server/net
parentMerge branch 'master' of git.openslx.org:pvs2 (diff)
downloadpvs2-5f310d3e0147532d734135771bafcb51a2f501ad.tar.gz
pvs2-5f310d3e0147532d734135771bafcb51a2f501ad.tar.xz
pvs2-5f310d3e0147532d734135771bafcb51a2f501ad.zip
Rename modes. Move code in slots to avoid unnecessary branching. Give the client more information about past progjectionSource
Diffstat (limited to 'src/server/net')
-rw-r--r--src/server/net/client.cpp10
-rw-r--r--src/server/net/client.h7
2 files changed, 10 insertions, 7 deletions
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 584b254..dd61b45 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -21,7 +21,8 @@ Client::Client(QSslSocket* socket) : _socket(socket)
{
assert(socket != NULL);
_authed = 0;
- _currentProjectionSource = 0;
+ _projectionSource = 0;
+ _isActiveVncClient = false;
_vncPort = 0;
_isTutor = false;
_locked = false;
@@ -193,13 +194,14 @@ void Client::handleMsg()
if (_fromClient.getFieldString("ENABLED").toInt() != 0)
{
qDebug() << "Client " << _name << " started its VNC client (watching " << projectionSource << ")";
- _currentProjectionSource = projectionSource;
+ _projectionSource = projectionSource;
+ _isActiveVncClient = true;
emit vncClientStateChange(this);
}
else
{
qDebug() << "Client " << _name << " stopped its VNC client (watched " << projectionSource << ")";
- _currentProjectionSource = 0;
+ _isActiveVncClient = false;
emit vncClientStateChange(this);
}
emit stateChanged();
@@ -304,7 +306,7 @@ void Client::startVncClient(const Client * const to)
/******************************************************************************/
void Client::stopVncClient()
{
- if (_currentProjectionSource != 0) {
+ if (_isActiveVncClient) {
NetworkMessage msg;
msg.setField(_ID, _VNCCLIENT);
sendMessage(msg);
diff --git a/src/server/net/client.h b/src/server/net/client.h
index 6872959..c4afd16 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -33,8 +33,8 @@ public:
inline const QString& host() const { return _host; }
inline const QString ip() const { return _socket->peerAddress().toString(); }
inline const int id() const { return _id; }
- inline const int currentProjectionSource() const { return _currentProjectionSource; }
- inline const bool isActiveVncClient() const { return _currentProjectionSource > 0; }
+ inline const int projectionSource() const { return _projectionSource; }
+ inline const bool isActiveVncClient() const { return _isActiveVncClient; }
inline const bool isActiveVncServer() const { return _vncPort > 0; }
inline const bool isLocked() const { return _locked; }
inline const bool isWatcher() const { return _isWatcher; }
@@ -65,7 +65,8 @@ private:
int _id; // this client's unique id
QString _vncRwPass, _vncRoPass;
int _vncPort; // VNCserver state. Greater 0 -> active on this port. Equals 0 -> no server.
- int _currentProjectionSource; // VNCclient state. indicating that the client is displaying a remote screen via VNC
+ int _projectionSource; // VNCclient state. The source the client was or is connected to (depends on _isActiveVncClient)
+ bool _isActiveVncClient; // VNCclient state. indicating that the client is displaying a remote screen via VNC
bool _isTutor; // Flag indicating that the client has been set as a tutor
bool _isWatcher; // Flag indicates that the client should watch to VNC Server.