diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index cf2fe85..e3b7952 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -75,6 +75,7 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : connect(ui->action_TutorToStudent, SIGNAL(triggered()), this, SLOT(onButtonTutorToStudent())); connect(ui->action_StopProjection, SIGNAL(triggered()), this, SLOT(onButtonStopProjection())); connect(ui->action_SetAsTutor, SIGNAL(triggered()), this, SLOT(onButtonSetAsTutor())); + connect(ui->action_SetAsTutor, SIGNAL(triggered()), this, SLOT(onButtonStopProjection())); connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool))); // Clicking the session name label shows the edit field for it connect(_sessionNameLabel, SIGNAL(clicked()), this, SLOT(onSessionNameClick())); @@ -634,17 +635,26 @@ void MainWindow::onButtonExit() void MainWindow::onButtonSetAsTutor() { bool selected = false; + ConnectionFrame *oldTutor = NULL; + bool changedTutor = false; for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { selected = (*it)->selected(); - if ((*it)->isTutor()) + if (!selected && (*it)->isTutor()) + { + oldTutor = (*it); (*it)->setTutor(false); - if (selected) + } + if (selected && ((*it)->client() != NULL)) { // This frame is marked to be Tutor. (*it)->setTutor(true); + changedTutor = true; } } + if (!changedTutor && oldTutor != NULL) { + oldTutor->setTutor(true); + } } void MainWindow::onClientConnected(Client* client) @@ -715,7 +725,7 @@ void MainWindow::onClientAuthenticated(Client* client) for (int i = 0; i < _tutorList.size(); i++) { // Check if client is possible tutor - if (client->computerId()== _tutorList[i]) + if (client->computerId() == _tutorList[i]) { isTutor = true; break; |