summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-05-20 13:56:36 +0200
committerManuel Schneider2014-05-20 13:56:36 +0200
commit04e16a2d5e914475010085e6f3c012e7ef6382b6 (patch)
tree3bfaf8a06661a046b0c6f71903ca613ea6795314 /src/server/mainwindow/mainwindow.cpp
parentMerge unicast implemetations into one. (diff)
downloadpvs2-04e16a2d5e914475010085e6f3c012e7ef6382b6.tar.gz
pvs2-04e16a2d5e914475010085e6f3c012e7ef6382b6.tar.xz
pvs2-04e16a2d5e914475010085e6f3c012e7ef6382b6.zip
Reduce code
* Reduce code of prepareForProjection (broadcast part) * Make toolbar icons 48x48 px (were too large for standard windowsize)
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp51
1 files changed, 13 insertions, 38 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 175d2fa..08ce7d0 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -439,53 +439,28 @@ bool MainWindow::isValidClient(Client* client)
*/
void MainWindow::broadcast(Client *from)
{
- for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
- if ((*it)->client() != NULL && !(**it).isTutor())
- (*it)->client()->setProjectionSource(false);
-
// Projection source is never allowed to be an active VNC viewer
if (from->isActiveVncClient())
- {
- qDebug("From is active client, stopping...");
from->stopVncClient();
+
+ // 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);
}
- from->setDesiredProjectionSource(0);
- qDebug("Broadcast requested...");
+ from->setDesiredProjectionSource(0);
from->setProjectionSource(true);
- // Set desired projection source on all clients
+ // Set desired projection source on all clients, if not "from" or oflline
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
- {
- Client *c = (**it).client();
- if (c == NULL || c->id() == from->id())
- continue; // Self or offline
- c->setDesiredProjectionSource(from->id());
- }
+ if ((*it)->client() != NULL && (*it)->client()->id() != from->id())
+ (*it)->client()->setDesiredProjectionSource(from->id());
- if (from->isActiveVncServer())
- {
- // From is already active, if there is at least one active client, assume it is not
- // shutting down, so we can directly tell the new client to connect to it
- qDebug("Source is already running a VNC server....");
- for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
- {
- Client *c = (**it).client();
- if (c == NULL || c->id() == from->id())
- continue; // Self or offline
- if (c->currentProjectionSource() != from->id())
- continue; // Other client
- // Yep :-)
- qDebug("Reusing because of active client");
- this->onVncServerStateChange(from);
- return;
- }
- qDebug("But no active client found....");
- }
- // Could not take shortcut, (re)start VNC server on source
- qDebug("Starting VNC server on source machine");
- from->startVncServer();
- return;
+ if (from->isActiveVncServer()) // From is already active
+ this->onVncServerStateChange(from);
+ else // Could not take shortcut, (re)start VNC server on source
+ from->startVncServer();
}