From 18803183017954b651ec716a09abd0355c6c88cd Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Tue, 22 Jul 2014 20:05:35 +0200 Subject: Again fix oneclick-source-change-lock-bug. Note to myself: Never ever violate DRY again. NEVER! --- src/server/mainwindow/mainwindow.cpp | 40 ++++++++++++++---------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 7fb8674..e021515 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -737,10 +737,9 @@ void MainWindow::onButtonStudentToTutor() // Unset all clients desired sources. Except the tutors desired source, this has to be the selecteds frame for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - if ((*it)->client() != NULL){ + if ((*it)->client() != NULL) (*it)->client()->setDesiredProjectionSource(getTutorFrame()->client()->id() == (*it)->client()->id() ? getSelectedFrame()->client()->id():NO_SOURCE); - qDebug() << "ID" <<(*it)->client()->id() << "ds" << (*it)->client()->desiredProjectionSource() <<"ps"<< (*it)->client()->projectionSource(); -} + DisableButtons(); _mode = Mode::Unicast; startVncServerIfNecessary(getSelectedFrame()->client()->id()); @@ -767,31 +766,22 @@ void MainWindow::onButtonStudentToTutorExclusive() 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) - // Unset all but tutors desired projection, which is student - (*it)->client()->setDesiredProjectionSource(getTutorFrame()->client()->id() == (*it)->client()->id() ? getSelectedFrame()->client()->id():NO_SOURCE); - _mode = Mode::LockedUnicast; - } - else + // If this is not the first run in this mode and the current source is selected, stop the streaming. + if (_mode == Mode::Unicast && getSelectedFrame()->client()->id() == _streamingSource) { - // 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(...). + // Stop reset everything + _mode = Mode::None; + reset(); + return; } + // Unset all clients desired sources. Except the tutors desired source, this has to be the selecteds frame + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ((*it)->client() != NULL) + (*it)->client()->setDesiredProjectionSource(getTutorFrame()->client()->id() == (*it)->client()->id() ? getSelectedFrame()->client()->id():NO_SOURCE); + + DisableButtons(); + _mode = Mode::LockedUnicast; startVncServerIfNecessary(getSelectedFrame()->client()->id()); } } -- cgit v1.2.3-55-g7522