summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index d1974ab..32613f9 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -101,6 +101,7 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool)));
connect(ui->action_Help, SIGNAL(triggered()), this, SLOT(onButtonHelp()));
+
/* Stuff for the button lock */
_buttonLockTimer = new QTimer(this);
_buttonLockTimer->setSingleShot(true);
@@ -276,6 +277,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
*/
@@ -647,15 +663,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);
}
}
@@ -709,7 +719,6 @@ void MainWindow::onButtonSetAsTutor()
*/
void MainWindow::onClientConnected(Client* client)
{
- qDebug("ListenServer told MainWindow about new connection");
connect(client, SIGNAL(authenticating(Client*, ClientLogin*)), this, SLOT(onClientAuthenticating(Client*, ClientLogin*)));
connect(client, SIGNAL(authenticated(Client*)), this, SLOT(onClientAuthenticated(Client*)));
}
@@ -726,7 +735,6 @@ void MainWindow::onClientConnected(Client* client)
*/
void MainWindow::onClientAuthenticating(Client* client, ClientLogin* request)
{
- qDebug("onClientAuthenticating - Slot was called.");
disconnect(client, SIGNAL(authenticating(Client*, ClientLogin*)), this, SLOT(onClientAuthenticating(Client*, ClientLogin*)));
if (!request->accept) // Another receiver of that signal already rejected the client, so nothing to do
return;
@@ -774,7 +782,6 @@ void MainWindow::onClientAuthenticating(Client* client, ClientLogin* request)
*/
void MainWindow::onClientAuthenticated(Client* client)
{
- qDebug("Entering onClientAuthenticated - Slot.");
disconnect(client, SIGNAL(authenticated(Client*)), this, SLOT(onClientAuthenticated(Client*)));
connect(client, SIGNAL(vncServerStateChange(Client*)), this, SLOT(onVncServerStateChange(Client*)), Qt::QueuedConnection);
connect(client, SIGNAL(vncClientStateChange(Client*)), this, SLOT(onVncClientStateChange(Client*)), Qt::QueuedConnection);
@@ -903,7 +910,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();
}
}