diff options
author | Björn Hagemeister | 2014-06-02 15:24:10 +0200 |
---|---|---|
committer | Björn Hagemeister | 2014-06-02 15:24:10 +0200 |
commit | 43a9ed4776d6036b71de487a0a4b22a395ba457b (patch) | |
tree | a175330f5b6c881b9524608f8397fddba3857caf /src/server/mainwindow/mainwindow.cpp | |
parent | Merge branch 'master' of git.openslx.org:pvs2 (diff) | |
download | pvs2-43a9ed4776d6036b71de487a0a4b22a395ba457b.tar.gz pvs2-43a9ed4776d6036b71de487a0a4b22a395ba457b.tar.xz pvs2-43a9ed4776d6036b71de487a0a4b22a395ba457b.zip |
Put Check if manager is running on machine into method.
If student2tutor_exclusive is running, the manager running machine is not locked now.
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 7279869..590d5ab 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -276,6 +276,21 @@ void MainWindow::tellClientCurrentSituation(Client* client) client->lockScreen(true); } +/***************************************************************************//** + * Checks if client and manager runs on same machine. + * @param client + * @return Return true, if pvsmanager is running on client. + */ +bool MainWindow::isManagerMachine(Client* client) +{ + foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) + if (address != QHostAddress(QHostAddress::LocalHost) + && client != NULL + && client->ip() == address.toString()) + return true; + return false; +} + /* * Overridden methods */ @@ -626,15 +641,9 @@ void MainWindow::onButtonLock(bool checked) for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { // Check if client is Tutor or the manager is also running on this machine. - bool isManagerMachine = false; - foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) - if (address != QHostAddress(QHostAddress::LocalHost) - && (*it)->client() != NULL - && (*it)->client()->ip() == address.toString()) - isManagerMachine = true; - - if ((*it)->client() == NULL || isManagerMachine) - continue; // Don't lock the tutor or the manager running machine. + bool isManager = isManagerMachine((*it)->client()); + if ((*it)->client() == NULL || isManager) + continue; (*it)->client()->lockScreen(checked); } } @@ -874,7 +883,8 @@ void MainWindow::onVncServerStateChange(Client* client) else { // Lock others and stop their clients - (*it)->client()->lockScreen(_mode == Mode::LockedMulticast); + bool isManager = isManagerMachine((*it)->client()); + (*it)->client()->lockScreen(_mode == Mode::LockedMulticast && isManager != true); (*it)->client()->stopVncClient(); } } |