summaryrefslogtreecommitdiffstats
path: root/src/client/vnc/vncwindow.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-02-08 16:48:29 +0100
committerSimon Rettberg2016-02-08 16:48:29 +0100
commitde708185c77aa451682fa96fbca4dcc6c8091c44 (patch)
treee925e32649545dad8a4e373326da9314b4f1dd28 /src/client/vnc/vncwindow.cpp
parent[client] Remove jpeg quality debug message (diff)
downloadpvs2-de708185c77aa451682fa96fbca4dcc6c8091c44.tar.gz
pvs2-de708185c77aa451682fa96fbca4dcc6c8091c44.tar.xz
pvs2-de708185c77aa451682fa96fbca4dcc6c8091c44.zip
[*] Use thumbnail on vnc viewer window until connection is up
Diffstat (limited to 'src/client/vnc/vncwindow.cpp')
-rw-r--r--src/client/vnc/vncwindow.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp
index 53877e1..f18fadc 100644
--- a/src/client/vnc/vncwindow.cpp
+++ b/src/client/vnc/vncwindow.cpp
@@ -93,7 +93,7 @@ void VncWindow::draw(const int x, const int y, const int w, const int h)
* @param caption caption of window (only visible if not running in fullscreen mode)
* @param clientId the ID of the client we're connecting to (echoed back to server, not used locally)
*/
-void VncWindow::open(const QString& host, int port, const QString& passwd, bool ro, bool fullscreen, const QString& caption, const int clientId)
+void VncWindow::open(const QString& host, int port, const QString& passwd, bool ro, bool fullscreen, const QString& caption, const int clientId, const QByteArray& rawThumb)
{
this->terminateVncThread();
_clientId = clientId;
@@ -108,6 +108,8 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
setAttribute(Qt::WA_OpaquePaintEvent);
+ _remoteThumb.loadFromData(rawThumb);
+
if (fullscreen)
{
setWindowFlags(Qt::WindowStaysOnTopHint);
@@ -121,6 +123,7 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
showNormal();
}
+ this->repaint();
this->show();
_vncWorker->setTargetSize(this->size());
@@ -170,6 +173,7 @@ void VncWindow::onUpdateImage(const int x, const int y, const int w, const int h
*/
void VncWindow::onProjectionStarted()
{
+ _remoteThumb = QPixmap();
if (_tcpTimeoutTimer != 0) {
killTimer(_tcpTimeoutTimer);
_tcpTimeoutTimer = 0;
@@ -233,8 +237,27 @@ void VncWindow::timerEvent(QTimerEvent *event)
*/
void VncWindow::paintEvent(QPaintEvent *event)
{
- const QRect &r = event->rect();
- this->draw(r.left(), r.top(), r.width(), r.height());
+ if (_vncWorker == NULL || !_vncWorker->isConnected())
+ {
+ QPainter painter(this);
+ if (!_remoteThumb.isNull() && _remoteThumb.height() > 0)
+ {
+ painter.drawPixmap(0, 0, this->width(), this->height(), _remoteThumb);
+ }
+ 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
+ {
+ const QRect &r = event->rect();
+ this->draw(r.left(), r.top(), r.width(), r.height());
+ }
event->accept();
}
@@ -245,5 +268,10 @@ void VncWindow::paintEvent(QPaintEvent *event)
*/
void VncWindow::resizeEvent(QResizeEvent* event)
{
- _vncWorker->setTargetSize(event->size());
+ if (_vncWorker != NULL)
+ {
+ _vncWorker->setTargetSize(event->size());
+ }
+ this->repaint();
}
+