diff options
author | Manuel Schneider | 2014-07-22 20:05:35 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-07-22 20:05:35 +0200 |
commit | 18803183017954b651ec716a09abd0355c6c88cd (patch) | |
tree | 559c18d7c84b05a1a7b1cfcb226acaa96f0cdc29 /src/server/mainwindow/mainwindow.cpp | |
parent | Fix TutorToStudent can't toggle bug. (diff) | |
download | pvs2-18803183017954b651ec716a09abd0355c6c88cd.tar.gz pvs2-18803183017954b651ec716a09abd0355c6c88cd.tar.xz pvs2-18803183017954b651ec716a09abd0355c6c88cd.zip |
Again fix oneclick-source-change-lock-bug. Note to myself: Never ever violate DRY again. NEVER!
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
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<ConnectionFrame*>::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<ConnectionFrame*>::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<ConnectionFrame*>::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()); } } |