From ee41007d0f1ada7019d830960eea7d79df35fa0a Mon Sep 17 00:00:00 2001 From: Björn Hagemeister Date: Tue, 22 Apr 2014 18:10:02 +0200 Subject: Fixed, that inactive Client can be manually choosen as Tutor. --- src/server/mainwindow/mainwindow.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') 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::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; -- cgit v1.2.3-55-g7522