diff options
author | Manuel Schneider | 2014-05-20 13:43:42 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-05-20 13:43:42 +0200 |
commit | 1526cebc2f276b2451319b8676aab3fd78ec2d72 (patch) | |
tree | 8a35a24be62e4f4863fd8ca8e0940bcc444b87fb /src/server/mainwindow/mainwindow.cpp | |
parent | Reduce codebase (diff) | |
download | pvs2-1526cebc2f276b2451319b8676aab3fd78ec2d72.tar.gz pvs2-1526cebc2f276b2451319b8676aab3fd78ec2d72.tar.xz pvs2-1526cebc2f276b2451319b8676aab3fd78ec2d72.zip |
Merge unicast implemetations into one.
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 56 |
1 files changed, 9 insertions, 47 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 05cefe5..175d2fa 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -488,57 +488,14 @@ void MainWindow::broadcast(Client *from) return; } -/***************************************************************************//** - * @brief unicast - * @param from - * @param to - */ -void MainWindow::unicast(Client *from, Client *to) -{ - // Projection source is never allowed to be an active VNC viewer - if (from->isActiveVncClient()) - { - qDebug("From is active client, stopping..."); - from->stopVncClient(); - } - from->setDesiredProjectionSource(0); - - to->setProjectionSource(false); - - if (to->isActiveVncServer()) // TODO aint this not alway the - { - if (to->currentProjectionSource() == from->id()) // TODO SHALL to->VNCSERVER NOT BE CLOSED? - return; // Nothing to do - to->stopVncServer(); - } - to->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 - for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - { - Client *c = (**it).client(); - if (c == NULL || c->id() == from->id()) - continue; - if (c->currentProjectionSource() != from->id()) - continue; - // Yep :-) - this->onVncServerStateChange(from); - return; - } - } - // Could not take shortcut, (re)start VNC server on source - from->startVncServer(); -} /***************************************************************************//** - * @brief unicastExlusive + * @brief MainWindow::unicast * @param from * @param to + * @param blockOthers */ -void MainWindow::unicastExlusive(Client *from, Client *to) +void MainWindow::unicast(Client *from, Client *to, bool blockOthers) { // Projection source is never allowed to be an active VNC viewer if (from->isActiveVncClient()) @@ -556,6 +513,11 @@ void MainWindow::unicastExlusive(Client *from, Client *to) this->onVncServerStateChange(from); else // Could not take shortcut, (re)start VNC server on source from->startVncServer(); + + if (blockOthers){ + // TODO: REDESIGN TO FIT THE REQUIREMENTS + } + } /***************************************************************************//** @@ -653,7 +615,7 @@ void MainWindow::onButtonStudentToTutorExclusive() else if (_tutorFrame->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); else - unicastExlusive(_tutorFrame->client(), _selectedFrame->client()); + unicast(_tutorFrame->client(), _selectedFrame->client(), true); } |