summaryrefslogtreecommitdiffstats
path: root/src/client/vnc/vncserver.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-09-29 15:40:18 +0200
committerChristian Klinger2016-09-29 15:40:18 +0200
commit3d82bfc698165bb20f3c38d42f2b77ab855c1edf (patch)
tree2c170bcdd5c89259bb0b530fa11fdfe701c99850 /src/client/vnc/vncserver.cpp
parentadded an information dialog that displays ip and hostname. (diff)
downloadpvs2-3d82bfc698165bb20f3c38d42f2b77ab855c1edf.tar.gz
pvs2-3d82bfc698165bb20f3c38d42f2b77ab855c1edf.tar.xz
pvs2-3d82bfc698165bb20f3c38d42f2b77ab855c1edf.zip
astyle.
Diffstat (limited to 'src/client/vnc/vncserver.cpp')
-rw-r--r--src/client/vnc/vncserver.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/client/vnc/vncserver.cpp b/src/client/vnc/vncserver.cpp
index aa7a89e..9d647f0 100644
--- a/src/client/vnc/vncserver.cpp
+++ b/src/client/vnc/vncserver.cpp
@@ -41,20 +41,19 @@ static QString makePassword(int len = 10)
/***************************************************************************//**
* @brief Ugly hack to get an el-cheapo platform independent sleep
*/
-struct Sleeper : public QThread
-{
+struct Sleeper : public QThread {
static void msleep(unsigned long msecs) { QThread::msleep(msecs); }
};
/***************************************************************************//**
* @brief VncServer::VncServer
*/
-VncServer::VncServer() : _process(NULL), _port(0), _timerId(0){}
+VncServer::VncServer() : _process(NULL), _port(0), _timerId(0) {}
/***************************************************************************//**
* @brief VncServer::~VncServer
*/
-VncServer::~VncServer(){}
+VncServer::~VncServer() {}
/***************************************************************************//**
* @brief VncServer::start
@@ -62,8 +61,7 @@ VncServer::~VncServer(){}
void VncServer::start()
{
// Keep things clean
- if (_process != NULL)
- {
+ if (_process != NULL) {
disconnect(_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)));
disconnect(_process, SIGNAL(finished(int)), this, SLOT(onFinished(int)));
}
@@ -77,8 +75,7 @@ void VncServer::start()
QFile pwhandle(pwfile);
if (pwhandle.exists())
pwhandle.remove();
- if (!pwhandle.open(QIODevice::WriteOnly))
- {
+ if (!pwhandle.open(QIODevice::WriteOnly)) {
qDebug() << "Could not open " << pwfile << " for writing";
emit started(0, _ropass, _rwpass);
return;
@@ -112,9 +109,9 @@ void VncServer::start()
args << "-clip";
QString rect;
rect = QString::number(primaryRect.width())
- + "x" + QString::number(primaryRect.height())
- + "+" + QString::number(primaryRect.x())
- + "+" + QString::number(primaryRect.y());
+ + "x" + QString::number(primaryRect.height())
+ + "+" + QString::number(primaryRect.x())
+ + "+" + QString::number(primaryRect.y());
args << rect;
qDebug() << "Arguments are: " << args;
@@ -126,8 +123,7 @@ void VncServer::start()
*/
void VncServer::stop()
{
- if (_timerId != 0)
- {
+ if (_timerId != 0) {
killTimer(_timerId);
_timerId = 0;
}
@@ -178,24 +174,20 @@ void VncServer::timerEvent(QTimerEvent *event)
*/
void VncServer::onStdOut()
{
- if (_process == NULL)
- {
+ if (_process == NULL) {
qDebug("VncServer::onStdOut() called in bad state.");
return;
}
QByteArray data(_process->readAllStandardOutput());
qDebug() << "x11vnc: " << data;
- if (_port <= 0)
- {
+ if (_port <= 0) {
const int pos = data.indexOf("PORT=", 0);
- if (pos != -1)
- {
+ if (pos != -1) {
_port = atoi(data.constData() + pos + 5);
qDebug() << "Got VNC port " << _port << ", ro " << _ropass << ", rw " << _rwpass;
emit started(_port, _ropass, _rwpass);
// Kill error timer, but only if port seemed valid
- if (_timerId != 0 && _port > 0)
- {
+ if (_timerId != 0 && _port > 0) {
killTimer(_timerId);
_timerId = 0;
}
@@ -208,8 +200,7 @@ void VncServer::onStdOut()
*/
void VncServer::onStdErr()
{
- if (_process == NULL)
- {
+ if (_process == NULL) {
qDebug("VncServer::onStdErr() called in bad state.");
return;
}