summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorChristian Klinger2016-09-27 15:38:39 +0200
committerChristian Klinger2016-09-27 15:38:39 +0200
commit1f6493e319016f8c375b62f2109ee57f5cea828d (patch)
treeac1635d23eaaf7090f6cc21767536ddcc9c76dae /src/client
parentclients in exam-mode no longer send a screenshot. Also some refactoring. (diff)
downloadpvs2-1f6493e319016f8c375b62f2109ee57f5cea828d.tar.gz
pvs2-1f6493e319016f8c375b62f2109ee57f5cea828d.tar.xz
pvs2-1f6493e319016f8c375b62f2109ee57f5cea828d.zip
Implemented 'majority vote' to determine the toolbar options.
clients in exam-mode are also displayed differently.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/clientapp/clientapp.cpp3
-rw-r--r--src/client/net/serverconnection.cpp17
2 files changed, 18 insertions, 2 deletions
diff --git a/src/client/clientapp/clientapp.cpp b/src/client/clientapp/clientapp.cpp
index 3d2dba1..f177d44 100644
--- a/src/client/clientapp/clientapp.cpp
+++ b/src/client/clientapp/clientapp.cpp
@@ -1,6 +1,6 @@
#include "clientapp.h"
-ClientApp::ClientApp(int& argc, char** argv) : QApplication(argc, argv), _connectionMode(ConnectionMode::None) {
+ClientApp::ClientApp(int& argc, char** argv) : QApplication(argc, argv), _connectionMode(ConnectionMode::None), _examMode(false) {
/* some values */
setOrganizationName("openslx");
setOrganizationDomain("openslx.org");
@@ -32,6 +32,7 @@ ClientApp::ClientApp(int& argc, char** argv) : QApplication(argc, argv), _connec
void ClientApp::parseParameters() {
for (QString a : arguments()) {
if (a == "--exam-mode") {
+ qDebug() << "setting exam-mode to true";
_examMode = true;
} else if (a == "--auto") {
_connectionMode = ConnectionMode::Auto;
diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp
index 3ff16bf..418e13c 100644
--- a/src/client/net/serverconnection.cpp
+++ b/src/client/net/serverconnection.cpp
@@ -153,6 +153,9 @@ void ServerConnection::handleMsg()
_toServer.setField(_ID, _LOGIN);
_toServer.setField("HOST", QHostInfo::localHostName());
_toServer.setField("NAME", QString(user));
+ qDebug() << "logging into manager, exam mode is " << clientApp->isExamMode();
+ _toServer.setField(_EXAMMODE, clientApp->isExamMode() ? __TRUE : __FALSE);
+ /* TODO: (Question) Why is this here not using sendMessage() ? */
qDebug("Sending login request!");
if (_toServer.writeMessage(_socket))
{
@@ -182,7 +185,11 @@ void ServerConnection::handleMsg()
if (id == _THUMB)
{
if (clientApp->isExamMode()) {
- qDebug() << "denied request for screenshot (exam mode)";
+ /* but we still have to send a message, to reset the timeout timer of the server */
+ QByteArray emptyArray;
+ _toServer.setField(_ID, _THUMB);
+ _toServer.setField(_IMG, emptyArray);
+ sendMessage(_toServer);
return;
}
int x = _fromServer.getFieldString(_X).toInt();
@@ -240,6 +247,10 @@ void ServerConnection::handleMsg()
} // message VNCSERVER - start local vncserver
else if (id == _VNCSERVER)
{
+ if (clientApp->isExamMode()) {
+ qDebug() << "denied request for vnc server (exam mode)";
+ return;
+ }
const bool enable = (_fromServer.getFieldString("ENABLE").toInt() != 0);
if (enable)
{
@@ -253,6 +264,10 @@ void ServerConnection::handleMsg()
}
else if (id == _VNCCLIENT)
{
+ if (clientApp->isExamMode()) {
+ qDebug() << "denied request for vnc projection (exam mode)";
+ return;
+ }
const QString host(_fromServer.getFieldString("HOST"));
const int port = _fromServer.getFieldString("PORT").toInt();
if (host.isEmpty() || port <= 0)