summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/net/serverconnection.cpp18
-rw-r--r--src/client/toolbar/toolbar.cpp2
-rw-r--r--src/client/vnc/vncserver.cpp17
-rw-r--r--src/server/net/client.cpp2
-rw-r--r--src/server/net/client.h26
5 files changed, 52 insertions, 13 deletions
diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp
index 530701d..afc43aa 100644
--- a/src/client/net/serverconnection.cpp
+++ b/src/client/net/serverconnection.cpp
@@ -34,9 +34,9 @@ ServerConnection::ServerConnection(const QString& host, const quint16 port, cons
);
qDebug("Connecting to %s on port %d", host.toUtf8().data(), (int)port);
_socket->connectToHostEncrypted(host, port);
- _timerId = startTimer(4000);
+ _timerId = startTimer(600000);// TODO(manuel): Debuging purposes
_lastData = QDateTime::currentMSecsSinceEpoch() + PING_TIMEOUT_MS;
- _timerConnectionCheck = startTimer(5000);
+ _timerConnectionCheck = startTimer(600000);// TODO(manuel): Debuging purposes
// Connect the vnc start/stop signal to this class, so we can tell the server about successful vnc server startup
connect(VncServer::instance(), SIGNAL(started(int, QString&, QString&)), this, SLOT(onVncServerStartStop(int, QString&, QString&)));
}
@@ -189,7 +189,19 @@ void ServerConnection::handleMsg()
y = 18;
else if (y > 300)
y = 300;
- QPixmap desktop(QPixmap::grabWindow(QApplication::desktop()->winId()).scaled(
+
+ // Get rect of primary screen
+ int primary = QApplication::desktop()->primaryScreen();
+ QRect primaryRect = QApplication::desktop()->availableGeometry(primary);
+
+ QPixmap desktop(
+ QPixmap::grabWindow(
+ QApplication::desktop()->winId(),
+ primaryRect.x(),
+ primaryRect.y(),
+ primaryRect.width(),
+ primaryRect.height()
+ ).scaled(
x, y,
Qt::KeepAspectRatio,
Qt::SmoothTransformation));
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index f016680..34dafd5 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -35,7 +35,7 @@ void Toolbar::setupMenu()
{
_menu = new QMenu(this);
// setup actions
- _acnDisconnect = new QAction(tr("&Connect"), this);
+ _acnDisconnect = new QAction(tr("Set &session ID"), this);
//_acnDisconnect->setEnabled(false);
_acnQuit = new QAction(tr("&Quit"), this);
diff --git a/src/client/vnc/vncserver.cpp b/src/client/vnc/vncserver.cpp
index 8c1469a..3eca952 100644
--- a/src/client/vnc/vncserver.cpp
+++ b/src/client/vnc/vncserver.cpp
@@ -5,7 +5,10 @@
* Author: sr
*/
+
+#include <QApplication>
#include <QProcess>
+#include <QDesktopWidget>
#include "vncserver.h"
#include "../util/util.h"
@@ -96,6 +99,20 @@ void VncServer::start()
args << "-shared";
args << "-repeat";
args << "-autoport" << QString::number(54112);
+
+ // Get rect of primary screen
+ int primary = QApplication::desktop()->primaryScreen();
+ QRect primaryRect = QApplication::desktop()->availableGeometry(primary);
+
+ // Tell x11vnc to just use primary screen
+ args << "-clip";
+ QString rect;
+ rect = QString::number(primaryRect.width())
+ + "x" + QString::number(primaryRect.height())
+ + "+" + QString::number(primaryRect.x())
+ + "+" + QString::number(primaryRect.y());
+ args << rect;
+
qDebug() << "Arguments are: " << args;
_process->start("x11vnc",
args,
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 5283246..412ee10 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -45,7 +45,7 @@ Client::Client(QSslSocket* socket) :
_toClient.writeMessage(_socket);
// give client 3 seconds to complete handshake
_timerIdAuthTimeout = startTimer(3000);
- _timerPingTimeout = startTimer(5000);
+ _timerPingTimeout = startTimer(600000); // for debugging purposes 10min
_pingTimeout = QDateTime::currentMSecsSinceEpoch() + PING_TIMEOUT_MS;
}
diff --git a/src/server/net/client.h b/src/server/net/client.h
index cce653e..2de631d 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -33,22 +33,32 @@ private:
NetworkMessage _toClient, _fromClient;
int _timerIdAuthTimeout, _timerDelete, _timerPingTimeout;
- int _id; // this client's unique id
-
- // If this client should be projected to from another client, the other client's id is set here. 0 otherwise.
- // This is not currently used and it is questionable if this makes sense, as it might just be confusing if
- // several groups students watch different other students.
- // Also, visualizing such a situation in the GUI in a meaningful way would be hard.
+ // this client's unique id
+ int _id;
+
+ // If this client should be projected to from another client, the other
+ // client's id is set here. 0 otherwise. This is not currently used and it is
+ // questionable if this makes sense, as it might just be confusing if several
+ // groups students watch different other students. Also, visualizing such a
+ // situation in the GUI in a meaningful way would be hard.
int _desiredProjectionSource;
- // This boolean tells whether this client is currently the VNC broadcast source. This
- // version only allows "one to all others" setups
+
+ // This boolean tells whether this client is currently the VNC broadcast
+ // source. This version only allows "one to all others" setups
bool _isProjectionSource;
int _currentProjectionSource;
QString _vncRwPass, _vncRoPass;
+
+ // Indicates the state of the client. The clients acts as VNC server if this
+ // port is set. If this value is less than or equal to 0 ist is no server.
int _vncPort;
+
+ // Flag indicating that the client is displaying a remote screen via VNC
bool _activeVncClient;
+
+ // Flag indicating that the hab been set as a tutor
bool _isTutor;
void handleMsg();