summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorBjörn Hagemeister2014-06-03 16:30:02 +0200
committerBjörn Hagemeister2014-06-03 16:30:02 +0200
commit1e77797ab3ffaf617bfc1150129196a8153dda4c (patch)
tree693c069d5dd88cf83fc167b743f97f5514bddf2d /src/server/mainwindow/mainwindow.cpp
parentMerge branch 'master' of git.openslx.org:pvs2 (diff)
downloadpvs2-1e77797ab3ffaf617bfc1150129196a8153dda4c.tar.gz
pvs2-1e77797ab3ffaf617bfc1150129196a8153dda4c.tar.xz
pvs2-1e77797ab3ffaf617bfc1150129196a8153dda4c.zip
Removed _watchers List.
Set flag in client.h _isWatcher with getter and setter, and controlling the watchers over this value.
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp63
1 files changed, 52 insertions, 11 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index d0487d4..58da462 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -270,7 +270,8 @@ void MainWindow::tellClientCurrentSituation(Client* client)
client->lockScreen(true);
if (_mode == Mode::Broadcast){
- _watchers.insert(client->id(), client);
+ // _watchers.insert(client->id(), client);
+ client->setWatcher(true);
client->startVncClient(_streamingSource);
}
else if (_mode == Mode::LockedMulticast)
@@ -491,21 +492,40 @@ void MainWindow::changeProjection(Client *from, Mode mode, Client *to)
{
// Set all clients as watchers
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
+ {
if ((*it)->client() != NULL && (*it)->client() != _streamingSource)
- _watchers.insert((*it)->client()->id(), (*it)->client());
+ {
+ // _watchers.insert((*it)->client()->id(), (*it)->client());
+ (*it)->client()->setWatcher(true);
+ }
+ }
}
else // mode != Mode::Broadcast
{
// If this is the first call in this mode clear the watchers
if ((mode == Mode::LockedMulticast && _mode != Mode::LockedMulticast)
|| (mode == Mode::Multicast && _mode != Mode::Multicast))
- _watchers.clear();
+ {
+ // _watchers.clear();
+ for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
+ {
+ if ((*it)->client() != NULL)
+ (*it)->client()->setWatcher(false);
+ }
+ }
// If "to" already watches "from" stop it
- if (_watchers.contains(to->id()))
- _watchers.remove(to->id());
+ // if (_watchers.contains(to->id()))
+ if (getClientFromId(to->id())->isWatcher())
+ {
+ // _watchers.remove(to->id());
+ getClientFromId(to->id())->setWatcher(false);
+ }
else // list "to" as watcher
- _watchers.insert(to->id(), to);
+ {
+ // _watchers.insert(to->id(), to);
+ getClientFromId(to->id())->setWatcher(true);
+ }
}
// Set the mode
@@ -890,7 +910,8 @@ void MainWindow::onVncServerStateChange(Client* client)
// Ignore offline clients
if ( (*it)->client() != NULL)
{
- if (_watchers.contains((*it)->client()->id()))
+ // if (_watchers.contains((*it)->client()->id()))
+ if (getClientFromId((*it)->client()->id())->isWatcher())
{
// Unlock destination and connect VNCclient
(*it)->client()->lockScreen(false);
@@ -915,8 +936,16 @@ void MainWindow::onVncServerStateChange(Client* client)
else
{
// VNC server stopped on some client or failed to start - reset local pending projection information
- foreach (Client *c, _watchers) {
- c->stopVncClient();
+ // foreach (Client *c, _watchers) {
+ // c->stopVncClient();
+ // }
+ for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
+ {
+ if ((*it)->client() != NULL)
+ {
+ if ((*it)->client()->isWatcher())
+ (*it)->client()->stopVncClient();
+ }
}
}
}
@@ -931,10 +960,22 @@ void MainWindow::onVncClientStateChange(Client* client)
{
// VNC Client stopped -> remove from watchers
if (!client->isActiveVncClient()){
- _watchers.remove(client->id());
+ // _watchers.remove(client->id());
+ getClientFromId(client->id())->setWatcher(false);
// If noboody is watching the multicast stop VNC server
- if (_watchers.isEmpty() && _mode != Mode::Broadcast)
+ // if (_watchers.isEmpty() && _mode != Mode::Broadcast)
+ // _streamingSource->stopVncServer();
+ bool noWatchers = true;
+ for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
+ {
+ if ((*it)->client() != NULL)
+ {
+ if ((*it)->client()->isWatcher())
+ noWatchers = false;
+ }
+ }
+ if (noWatchers && _mode != Mode::Broadcast)
_streamingSource->stopVncServer();
}
}