summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Schneider2014-05-22 12:27:16 +0200
committerManuel Schneider2014-05-22 12:27:16 +0200
commitdfe1328006193f2ad5013cecb9e4c3558cad6a2d (patch)
tree65df0d59c26ba99d6f74a0e928caf23441106367
parentFix mitstake in rewrite 58646932664b6ab9014a410dc75dd443fb4f58b9 (diff)
downloadpvs2-dfe1328006193f2ad5013cecb9e4c3558cad6a2d.tar.gz
pvs2-dfe1328006193f2ad5013cecb9e4c3558cad6a2d.tar.xz
pvs2-dfe1328006193f2ad5013cecb9e4c3558cad6a2d.zip
Refactor ambigious projectionsSoure to BroadcastSource
-rw-r--r--src/server/mainwindow/mainwindow.cpp16
-rw-r--r--src/server/net/client.cpp2
-rw-r--r--src/server/net/client.h6
-rw-r--r--src/server/net/listenserver.cpp4
4 files changed, 14 insertions, 14 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index b194528..5059516 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -446,11 +446,11 @@ void MainWindow::broadcast(Client *from)
// Tell all clients to listen to server
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it){
if ((*it)->client() != NULL)
- (*it)->client()->setProjectionSource(false);
+ (*it)->client()->setBroadcastSource(false);
}
from->setDesiredProjectionSource(0);
- from->setProjectionSource(true);
+ from->setBroadcastSource(true);
// Set desired projection source on all clients, if not "from" or oflline
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
@@ -481,7 +481,7 @@ void MainWindow::unicast(Client *from, Client *to, bool blockOthers)
to->stopVncServer();
from->setDesiredProjectionSource(0);
- to->setProjectionSource(false);
+ to->setBroadcastSource(false);
to->setDesiredProjectionSource(from->id());
if (from->isActiveVncServer()) // From is already active
@@ -607,7 +607,7 @@ void MainWindow::onButtonStopProjection()
if (c == NULL)
continue;
c->setDesiredProjectionSource(0);
- c->setProjectionSource(false);
+ c->setBroadcastSource(false);
}
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
@@ -813,7 +813,7 @@ void MainWindow::onClientAuthenticated(Client* client)
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
{
Client *c = (**it).client();
- if (c != NULL && c != client && c->isActiveVncServer() && c->isProjectionSource())
+ if (c != NULL && c != client && c->isActiveVncServer() && c->isBroadcastSource())
{
client->startVncClient(c);
client->setDesiredProjectionSource(c->id());
@@ -842,7 +842,7 @@ void MainWindow::onVncServerStateChange(Client* client)
continue; // Offline or self
if (c->currentProjectionSource() == client->id())
continue; // Already watching this client
- if (c->desiredProjectionSource() != client->id() && !client->isProjectionSource())
+ if (c->desiredProjectionSource() != client->id() && !client->isBroadcastSource())
continue; // Not interested
c->startVncClient(client);
}
@@ -852,9 +852,9 @@ void MainWindow::onVncServerStateChange(Client* client)
// VNC server stopped on some client or failed to start - reset local pending projection information
// If at least one other client seemed to be waiting for this client's screen, pop up a message
// on the console
- bool wasInterested = client->isProjectionSource();
+ bool wasInterested = client->isBroadcastSource();
//qDebug() << "On VNC stop:" << client->ip() << "was projection source:" << wasInterested;
- client->setProjectionSource(false);
+ client->setBroadcastSource(false);
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
{
Client *c = (**it).client();
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 67b25b2..70a1783 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -21,7 +21,7 @@ Client::Client(QSslSocket* socket) : _socket(socket)
assert(socket != NULL);
_authed = 0;
_desiredProjectionSource = 0;
- _isProjectionSource = false;
+ _isBroadcastSource = false;
_currentProjectionSource = 0;
_vncPort = 0;
_activeVncClient = false;
diff --git a/src/server/net/client.h b/src/server/net/client.h
index c148e76..198b213 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -49,10 +49,10 @@ public:
// To be replaced by states
inline const bool isActiveVncClient() const { return _activeVncClient; }
inline const bool isActiveVncServer() const { return _vncPort > 0; }
- inline const bool isProjectionSource() const { return _isProjectionSource; }
+ inline const bool isBroadcastSource() const { return _isBroadcastSource; }
// Setters
- inline void setProjectionSource(bool enable) { _isProjectionSource = enable; }
+ inline void setBroadcastSource(bool enable) { _isBroadcastSource = enable; }
inline void setDesiredProjectionSource(int source) { _desiredProjectionSource = source; }
inline void setTutor(bool enable){ _isTutor = enable; }
@@ -83,7 +83,7 @@ private:
int _timerIdAuthTimeout, _timerPingTimeout;
int _id; // this client's unique id
int _desiredProjectionSource;
- bool _isProjectionSource; // Tells whether this client is currently the VNC broadcast source.
+ bool _isBroadcastSource; // Tells whether this client is currently the VNC broadcast source.
int _currentProjectionSource;
QString _vncRwPass, _vncRoPass;
int _vncPort; // VNCserver state. Greater 0 -> active on this port. Equals 0 -> no server.
diff --git a/src/server/net/listenserver.cpp b/src/server/net/listenserver.cpp
index c8392df..8eb3750 100644
--- a/src/server/net/listenserver.cpp
+++ b/src/server/net/listenserver.cpp
@@ -19,7 +19,7 @@ ListenServer::~ListenServer()
{
_server.close();
for (int i = 0; i < _clients.size(); ++i)
- _clients[i]->deleteLater();
+ _clients[i]->deleteLater(); // TODO are there nullptrs?
}
/*
@@ -41,7 +41,7 @@ void ListenServer::newClientConnection()
sock->deleteLater();
continue;
}
- Client* client = new Client(sock);
+ Client* client = new Client(sock); // TODO: what happens with disconnected clients
_clients.append(client); // create new client class and add to list
emit newClient(client);
}