Skip to content

Commit

Permalink
Cleanup VNC platform plugins debug messages
Browse files Browse the repository at this point in the history
There were many development debug statements still intact, so now they
have been removed.  Some Debug messages were turned into Warnings when
it makes sense to warn the end user of something.  The rest of the
useful debug messages were converted to be in the qt.qpa.vnc logging
catagory.

Change-Id: I8e9525f02794ab5eccd4c8fcbc2b1f7c9c25b482
Reviewed-by: Laszlo Agocs <[email protected]>
  • Loading branch information
nezticle committed Jun 28, 2016
1 parent adf6bd9 commit 8d67ce3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/plugins/platforms/vnc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class QVncIntegrationPlugin : public QPlatformIntegrationPlugin

QPlatformIntegration* QVncIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
QT_VNC_DEBUG() << "loading vnc plugin" << system;
if (!system.compare(QLatin1String("vnc"), Qt::CaseInsensitive))
return new QVncIntegration(paramList);

Expand Down
13 changes: 8 additions & 5 deletions src/plugins/platforms/vnc/qvnc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@
#include <arpa/inet.h>
#endif

#include <QtCore/QDebug>

QT_BEGIN_NAMESPACE

Q_LOGGING_CATEGORY(lcVnc, "qt.qpa.vnc");

QVncDirtyMap::QVncDirtyMap(QVncScreen *screen)
: screen(screen), bytesPerPixel(0), numDirty(0)
{
Expand Down Expand Up @@ -456,7 +460,7 @@ void QRfbRawEncoder::write()
// create a region from the dirty rects and send the region's merged rects.
// ### use the tile map again
QRegion rgn = client->dirtyRegion();
QT_VNC_DEBUG() << "QRfbRawEncoder::write()" << rgn;
qCDebug(lcVnc) << "QRfbRawEncoder::write()" << rgn;
// if (map) {
// for (int y = 0; y < map->mapHeight; ++y) {
// for (int x = 0; x < map->mapWidth; ++x) {
Expand Down Expand Up @@ -622,10 +626,9 @@ void QVncServer::init()
{
serverSocket = new QTcpServer(this);
if (!serverSocket->listen(QHostAddress::Any, m_port))
qDebug() << "QVncServer could not connect:" << serverSocket->errorString();
qWarning() << "QVncServer could not connect:" << serverSocket->errorString();
else
QT_VNC_DEBUG("QVncServer created on port %d", m_port);
QT_VNC_DEBUG() << "running in thread" << thread() << QThread::currentThread();
qWarning("QVncServer created on port %d", m_port);

connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection()));

Expand Down Expand Up @@ -654,7 +657,7 @@ void QVncServer::newConnection()

dirtyMap()->reset();

QT_VNC_DEBUG() << "new Connection" << thread();
qCDebug(lcVnc) << "new Connection from: " << clientSocket->localAddress();

qvnc_screen->setPowerState(QPlatformScreen::PowerStateOn);
}
Expand Down
10 changes: 3 additions & 7 deletions src/plugins/platforms/vnc/qvnc_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,17 @@
#ifndef QVNC_P_H
#define QVNC_P_H

#include <QtCore/qdebug.h>
#if 0
#define QT_VNC_DEBUG if (1) {} else qDebug
#else
#define QT_VNC_DEBUG qDebug
#endif

#include "qvncscreen.h"

#include <QtCore/QLoggingCategory>
#include <QtCore/qbytearray.h>
#include <QtCore/qvarlengtharray.h>
#include <qpa/qplatformcursor.h>

QT_BEGIN_NAMESPACE

Q_DECLARE_LOGGING_CATEGORY(lcVnc)

class QTcpSocket;
class QTcpServer;

Expand Down
29 changes: 14 additions & 15 deletions src/plugins/platforms/vnc/qvncclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void QVncClient::convertPixels(char *dst, const char *src, int count) const
}
default: {
r = g = b = 0;
qDebug("QVNCServer: don't support %dbpp display", screendepth);
qWarning("QVNCServer: don't support %dbpp display", screendepth);
return;
}
}
Expand Down Expand Up @@ -233,7 +233,7 @@ void QVncClient::convertPixels(char *dst, const char *src, int count) const
((pixel & 0x000000ff) << 24));
break;
default:
qDebug("Cannot handle %d bpp client", m_pixelFormat.bitsPerPixel);
qWarning("Cannot handle %d bpp client", m_pixelFormat.bitsPerPixel);
}
} else { // QSysInfo::ByteOrder == QSysInfo::LittleEndian
switch (m_pixelFormat.bitsPerPixel) {
Expand All @@ -248,7 +248,7 @@ void QVncClient::convertPixels(char *dst, const char *src, int count) const
((pixel & 0x000000ff) << 24));
break;
default:
qDebug("Cannot handle %d bpp client",
qWarning("Cannot handle %d bpp client",
m_pixelFormat.bitsPerPixel);
break;
}
Expand All @@ -260,7 +260,7 @@ void QVncClient::convertPixels(char *dst, const char *src, int count) const

void QVncClient::readClient()
{
QT_VNC_DEBUG() << "readClient" << m_state;
qCDebug(lcVnc) << "readClient" << m_state;
switch (m_state) {
case Disconnected:

Expand All @@ -270,7 +270,7 @@ void QVncClient::readClient()
char proto[13];
m_clientSocket->read(proto, 12);
proto[12] = '\0';
QT_VNC_DEBUG("Client protocol version %s", proto);
qCDebug(lcVnc, "Client protocol version %s", proto);
if (!strcmp(proto, "RFB 003.008\n")) {
m_protocolVersion = V3_8;
} else if (!strcmp(proto, "RFB 003.007\n")) {
Expand Down Expand Up @@ -392,7 +392,7 @@ void QVncClient::readClient()
break;

default:
qDebug("QVNC cannot drive depth %d", m_server->screen()->depth());
qWarning("QVNC cannot drive depth %d", m_server->screen()->depth());
discardClient();
return;
}
Expand All @@ -416,7 +416,7 @@ void QVncClient::readClient()
setPixelFormat();
break;
case FixColourMapEntries:
qDebug("Not supported: FixColourMapEntries");
qWarning("Not supported: FixColourMapEntries");
m_handleMsg = false;
break;
case SetEncodings:
Expand All @@ -435,7 +435,7 @@ void QVncClient::readClient()
clientCutText();
break;
default:
qDebug("Unknown message type: %d", (int)m_msgType);
qWarning("Unknown message type: %d", (int)m_msgType);
m_handleMsg = false;
}
}
Expand Down Expand Up @@ -496,7 +496,7 @@ void QVncClient::setPixelFormat()
char buf[3];
m_clientSocket->read(buf, 3); // just padding
m_pixelFormat.read(m_clientSocket);
QT_VNC_DEBUG("Want format: %d %d %d %d %d %d %d %d %d %d",
qCDebug(lcVnc, "Want format: %d %d %d %d %d %d %d %d %d %d",
int(m_pixelFormat.bitsPerPixel),
int(m_pixelFormat.depth),
int(m_pixelFormat.bigEndian),
Expand All @@ -508,7 +508,7 @@ void QVncClient::setPixelFormat()
int(m_pixelFormat.greenShift),
int(m_pixelFormat.blueShift));
if (!m_pixelFormat.trueColor) {
qDebug("Can only handle true color clients");
qWarning("Can only handle true color clients");
discardClient();
}
m_handleMsg = false;
Expand Down Expand Up @@ -552,12 +552,12 @@ void QVncClient::setEncodings()
qint32 enc;
m_clientSocket->read((char *)&enc, sizeof(qint32));
enc = ntohl(enc);
QT_VNC_DEBUG("QVncServer::setEncodings: %d", enc);
qCDebug(lcVnc, "QVncServer::setEncodings: %d", enc);
switch (enc) {
case Raw:
if (!m_encoder) {
m_encoder = new QRfbRawEncoder(this);
QT_VNC_DEBUG("QVncServer::setEncodings: using raw");
qCDebug(lcVnc, "QVncServer::setEncodings: using raw");
}
break;
case CopyRect:
Expand All @@ -579,7 +579,6 @@ void QVncClient::setEncodings()
break;
case Cursor:
m_supportCursor = true;
qDebug() << "client side cursor supported.";
m_server->screen()->enableClientCursor(this);
break;
case DesktopSize:
Expand All @@ -595,13 +594,13 @@ void QVncClient::setEncodings()

if (!m_encoder) {
m_encoder = new QRfbRawEncoder(this);
QT_VNC_DEBUG("QVncServer::setEncodings: fallback using raw");
qCDebug(lcVnc, "QVncServer::setEncodings: fallback using raw");
}
}

void QVncClient::frameBufferUpdateRequest()
{
QT_VNC_DEBUG() << "FramebufferUpdateRequest";
qCDebug(lcVnc) << "FramebufferUpdateRequest";
QRfbFrameBufferUpdateRequest ev;

if (ev.read(m_clientSocket)) {
Expand Down
3 changes: 0 additions & 3 deletions src/plugins/platforms/vnc/qvncscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ bool QVncScreen::initialize()
}
}


QFbScreen::initializeCompositor();
QT_VNC_DEBUG() << "QVncScreen::init" << geometry();

switch (depth()) {
case 32:
Expand All @@ -112,7 +110,6 @@ bool QVncScreen::initialize()
QRegion QVncScreen::doRedraw()
{
QRegion touched = QFbScreen::doRedraw();
QT_VNC_DEBUG() << "qvncscreen::doRedraw()" << touched.rectCount();

if (touched.isEmpty())
return touched;
Expand Down

0 comments on commit 8d67ce3

Please sign in to comment.