summaryrefslogtreecommitdiffstats
path: root/src/client/vnc/vncwindow.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/vncwindow.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/vncwindow.cpp')
-rw-r--r--src/client/vnc/vncwindow.cpp49
1 files changed, 16 insertions, 33 deletions
diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp
index f18fadc..818b22f 100644
--- a/src/client/vnc/vncwindow.cpp
+++ b/src/client/vnc/vncwindow.cpp
@@ -41,19 +41,17 @@ VncWindow::~VncWindow()
*/
void VncWindow::terminateVncThread()
{
- if(_vncWorker == NULL)
+ if (_vncWorker == NULL)
return;
_vncWorker->blockSignals(true);
_vncWorker->stop();
_vncWorker = NULL;
- if(_redrawTimer != 0)
- {
+ if (_redrawTimer != 0) {
killTimer(_redrawTimer);
_redrawTimer = 0;
}
- if(_tcpTimeoutTimer != 0)
- {
+ if (_tcpTimeoutTimer != 0) {
killTimer(_tcpTimeoutTimer);
_tcpTimeoutTimer = 0;
}
@@ -101,8 +99,8 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
connect(_vncWorker, SIGNAL(projectionStopped()), this, SLOT(onProjectionStopped()), Qt::QueuedConnection);
connect(_vncWorker, SIGNAL(projectionStarted()), this, SLOT(onProjectionStarted()), Qt::QueuedConnection);
connect(_vncWorker, SIGNAL(imageUpdated(const int, const int, const int, const int)), this,
- SLOT(onUpdateImage(const int, const int, const int, const int)),
- Qt::QueuedConnection);
+ SLOT(onUpdateImage(const int, const int, const int, const int)),
+ Qt::QueuedConnection);
setWindowTitle(caption);
@@ -110,15 +108,12 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
_remoteThumb.loadFromData(rawThumb);
- if (fullscreen)
- {
+ if (fullscreen) {
setWindowFlags(Qt::WindowStaysOnTopHint);
showFullScreen();
activateWindow();
raise();
- }
- else
- {
+ } else {
resize(800, 600);
showNormal();
}
@@ -207,23 +202,18 @@ void VncWindow::onProjectionStopped()
*/
void VncWindow::timerEvent(QTimerEvent *event)
{
- if (event->timerId() == _redrawTimer)
- {
+ if (event->timerId() == _redrawTimer) {
killTimer(_redrawTimer);
_redrawTimer = 0;
if (this->isVisible())
this->repaint();
- }
- else if (event->timerId() == _tcpTimeoutTimer)
- {
+ } else if (event->timerId() == _tcpTimeoutTimer) {
killTimer(_tcpTimeoutTimer);
_tcpTimeoutTimer = 0;
- if (_vncWorker != NULL && !_vncWorker->isConnected())
- {
+ if (_vncWorker != NULL && !_vncWorker->isConnected()) {
this->close();
}
- }
- else
+ } else
killTimer(event->timerId());
}
@@ -237,24 +227,18 @@ void VncWindow::timerEvent(QTimerEvent *event)
*/
void VncWindow::paintEvent(QPaintEvent *event)
{
- if (_vncWorker == NULL || !_vncWorker->isConnected())
- {
+ if (_vncWorker == NULL || !_vncWorker->isConnected()) {
QPainter painter(this);
- if (!_remoteThumb.isNull() && _remoteThumb.height() > 0)
- {
+ if (!_remoteThumb.isNull() && _remoteThumb.height() > 0) {
painter.drawPixmap(0, 0, this->width(), this->height(), _remoteThumb);
- }
- else
- {
+ } else {
painter.fillRect(event->rect(), QColor(60, 63, 66));
}
QFontInfo fi = painter.fontInfo();
painter.setPen(QColor(200, 100, 10));
painter.setFont(QFont(fi.family(), 28, fi.weight(), fi.italic()));
painter.drawText(this->contentsRect(), Qt::AlignCenter, tr("Connecting..."));
- }
- else
- {
+ } else {
const QRect &r = event->rect();
this->draw(r.left(), r.top(), r.width(), r.height());
}
@@ -268,8 +252,7 @@ void VncWindow::paintEvent(QPaintEvent *event)
*/
void VncWindow::resizeEvent(QResizeEvent* event)
{
- if (_vncWorker != NULL)
- {
+ if (_vncWorker != NULL) {
_vncWorker->setTargetSize(event->size());
}
this->repaint();