From c22a2b47bbd955caf25109b276c823b94f2a7c81 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Mon, 21 Jul 2014 23:51:00 +0200 Subject: Correct indenting by tabs --- src/server/mainwindow/mainwindow.cpp | 346 +++++++++++++++++------------------ 1 file changed, 173 insertions(+), 173 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 9dee65b..7f59191 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -556,22 +556,22 @@ void MainWindow::onSessionNameUpdate() */ void MainWindow::startVncServerIfNecessary(int from) { - Client* os = getClientFromId(_streamingSource); - Client* ns = getClientFromId(from); + Client* os = getClientFromId(_streamingSource); + Client* ns = getClientFromId(from); // if there is a server running which is not "from" stop it. - if (os != NULL && _streamingSource != from) - os->stopVncServer(); + if (os != NULL && _streamingSource != from) + os->stopVncServer(); - // Set new streaming source - _streamingSource = from; + // Set new streaming source + _streamingSource = from; - // If streaming source is already active avoid a restart - if (ns != NULL) { - if (ns->isActiveVncServer()) - this->onVncServerStateChange(ns); + // If streaming source is already active avoid a restart + if (ns != NULL) { + if (ns->isActiveVncServer()) + this->onVncServerStateChange(ns); else // Could not take shortcut, (re)start VNC server on source - ns->startVncServer(); + ns->startVncServer(); } } @@ -598,30 +598,30 @@ void MainWindow::onButtonTutorToAll() QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); else if (_clientFrames.size() == 1) QMessageBox::critical(this, tr("Projection"), sStrNoDestAv); - else - { - DisableButtons(); - - if (_mode != Mode::Broadcast) - { - // Set all clients as watchers - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) - (*it)->client()->setWatcher(true); - } - } - else // If this mode is already active - { - // Stop reset everything - reset(); - _mode = Mode::None; - return; - } - - _mode = Mode::Broadcast; - startVncServerIfNecessary(getTutorFrame()->client()->id()); - } + else + { + DisableButtons(); + + if (_mode != Mode::Broadcast) + { + // Set all clients as watchers + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) + (*it)->client()->setWatcher(true); + } + } + else // If this mode is already active + { + // Stop reset everything + reset(); + _mode = Mode::None; + return; + } + + _mode = Mode::Broadcast; + startVncServerIfNecessary(getTutorFrame()->client()->id()); + } } /***************************************************************************//** @@ -637,30 +637,30 @@ void MainWindow::onButtonStudentToAll() QMessageBox::critical(this, tr("Projection"), sStrSourceNdef); if (getSelectedFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrSourceOffline); - else - { - DisableButtons(); - - if (_mode != Mode::Broadcast) - { - // Set all clients as watchers - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) - (*it)->client()->setWatcher(true); - } - } - else // If this mode is already active - { - // Stop reset everything - reset(); - _mode = Mode::None; - return; - } - - _mode = Mode::Broadcast; - startVncServerIfNecessary(getSelectedFrame()->client()->id()); - } + else + { + DisableButtons(); + + if (_mode != Mode::Broadcast) + { + // Set all clients as watchers + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) + (*it)->client()->setWatcher(true); + } + } + else // If this mode is already active + { + // Stop reset everything + reset(); + _mode = Mode::None; + return; + } + + _mode = Mode::Broadcast; + startVncServerIfNecessary(getSelectedFrame()->client()->id()); + } } /***************************************************************************//** @@ -681,37 +681,37 @@ void MainWindow::onButtonTutorToStudent() QMessageBox::critical(this, tr("Projection"), sStrDestOffline); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); - else - { - DisableButtons(); - - // If this is the first call in this mode clear the watchers - if (_mode != Mode::Multicast) - { - // _watchers.clear(); - for (QList::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())) - if (getClientFromId(getSelectedFrame()->client()->id())->isWatcher()) - { - // _watchers.remove(to->id()); - getClientFromId(getSelectedFrame()->client()->id())->setWatcher(false); - } - else // list "to" as watcher - { - // _watchers.insert(to->id(), to); - getClientFromId(getSelectedFrame()->client()->id())->setWatcher(true); - } - - _mode = Mode::Multicast; - startVncServerIfNecessary(getTutorFrame()->client()->id()); - } + else + { + DisableButtons(); + + // If this is the first call in this mode clear the watchers + if (_mode != Mode::Multicast) + { + // _watchers.clear(); + for (QList::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())) + if (getClientFromId(getSelectedFrame()->client()->id())->isWatcher()) + { + // _watchers.remove(to->id()); + getClientFromId(getSelectedFrame()->client()->id())->setWatcher(false); + } + else // list "to" as watcher + { + // _watchers.insert(to->id(), to); + getClientFromId(getSelectedFrame()->client()->id())->setWatcher(true); + } + + _mode = Mode::Multicast; + startVncServerIfNecessary(getTutorFrame()->client()->id()); + } } /***************************************************************************//** @@ -732,33 +732,33 @@ void MainWindow::onButtonStudentToTutor() QMessageBox::critical(this, tr("Projection"), sStrSourceOffline); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); - else{ - DisableButtons(); - - if (_mode != Mode::Unicast) - { - // If this is the first run in this mode set the tutor as watcher - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - if ((*it)->client() != NULL) - (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); - _mode = Mode::Unicast; - } - else - { - // If this mode is already active and the current source is selected, stop the streaming. - if (getSelectedFrame()->client()->id() == _streamingSource ) - { - // Stop reset everything - _mode = Mode::None; - reset(); - return; - } - // If another client is selected solely the current streaming source shall be changed. - // This should be handled by startVncServerIfNecessary(...). - } - - startVncServerIfNecessary(getSelectedFrame()->client()->id()); - } + else{ + DisableButtons(); + + if (_mode != Mode::Unicast) + { + // If this is the first run in this mode set the tutor as watcher + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ((*it)->client() != NULL) + (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); + _mode = Mode::Unicast; + } + else + { + // If this mode is already active and the current source is selected, stop the streaming. + if (getSelectedFrame()->client()->id() == _streamingSource ) + { + // Stop reset everything + _mode = Mode::None; + reset(); + return; + } + // If another client is selected solely the current streaming source shall be changed. + // This should be handled by startVncServerIfNecessary(...). + } + + startVncServerIfNecessary(getSelectedFrame()->client()->id()); + } } @@ -779,33 +779,33 @@ void MainWindow::onButtonStudentToTutorExclusive() QMessageBox::critical(this, tr("Projection"), sStrSourceOffline); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); - else - { - DisableButtons(); - - if (_mode != Mode::LockedUnicast) - { - // If this is the first run in this mode set the tutor as watcher - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - if ((*it)->client() != NULL) - (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); - _mode = Mode::LockedUnicast; - } - else - { - // If this mode is already active and the current source is selected, stop the streaming. - if (getSelectedFrame()->client()->id() == _streamingSource ) - { - // Stop reset everything - _mode = Mode::None; - reset(); - return; - } - // If another client is selected solely the current streaming source shall be changed. - // This should be handled by startVncServerIfNecessary(...). - } - - startVncServerIfNecessary(getSelectedFrame()->client()->id()); + else + { + DisableButtons(); + + if (_mode != Mode::LockedUnicast) + { + // If this is the first run in this mode set the tutor as watcher + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ((*it)->client() != NULL) + (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); + _mode = Mode::LockedUnicast; + } + else + { + // If this mode is already active and the current source is selected, stop the streaming. + if (getSelectedFrame()->client()->id() == _streamingSource ) + { + // Stop reset everything + _mode = Mode::None; + reset(); + return; + } + // If another client is selected solely the current streaming source shall be changed. + // This should be handled by startVncServerIfNecessary(...). + } + + startVncServerIfNecessary(getSelectedFrame()->client()->id()); } } @@ -1117,40 +1117,40 @@ void MainWindow::onVncServerStateChange(Client* client) */ void MainWindow::onVncClientStateChange(Client* client) { - if (client != NULL) + if (client != NULL) { // VNC Client stopped -> remove from watchers - if (!client->isActiveVncClient()){ + if (!client->isActiveVncClient()){ if (getClientFromId(client->id()) != NULL) getClientFromId(client->id())->setWatcher(false); - /* - * If noboody is watching the multicast stop VNC server - * If the past connection of this client is not the current - * _streamingSource then the manager has to have stopped it - * already. This is necessary for the race condition when a server - * is stopped and another started at the same time, since the new - * server would be killed if all client disconnect before any of - * the new connect. - */ - if (client->projectionSource() == _streamingSource) - { - bool noWatchers = true; - for (QList::iterator it(_clientFrames.begin()); - it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL) - { - if ((*it)->client()->isWatcher()) - noWatchers = false; - } - } - if (noWatchers && _mode != Mode::Broadcast) - { - Client* c = getClientFromId(_streamingSource); - if (c != NULL) - c->stopVncServer(); - } + /* + * If noboody is watching the multicast stop VNC server + * If the past connection of this client is not the current + * _streamingSource then the manager has to have stopped it + * already. This is necessary for the race condition when a server + * is stopped and another started at the same time, since the new + * server would be killed if all client disconnect before any of + * the new connect. + */ + if (client->projectionSource() == _streamingSource) + { + bool noWatchers = true; + for (QList::iterator it(_clientFrames.begin()); + it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL) + { + if ((*it)->client()->isWatcher()) + noWatchers = false; + } + } + if (noWatchers && _mode != Mode::Broadcast) + { + Client* c = getClientFromId(_streamingSource); + if (c != NULL) + c->stopVncServer(); + } } } } -- cgit v1.2.3-55-g7522