From 8d67ce3c6f6e8a89ebf640b7722c5812f3d80615 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 21 Jun 2016 14:43:21 +0200 Subject: [PATCH] Cleanup VNC platform plugins debug messages 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 --- src/plugins/platforms/vnc/main.cpp | 1 - src/plugins/platforms/vnc/qvnc.cpp | 13 +++++++---- src/plugins/platforms/vnc/qvnc_p.h | 10 +++----- src/plugins/platforms/vnc/qvncclient.cpp | 29 ++++++++++++------------ src/plugins/platforms/vnc/qvncscreen.cpp | 3 --- 5 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index 1a8c1eeb63..6ee8bf1ec6 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -53,7 +53,6 @@ public: 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); diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp index 743888258e..b3613cf18f 100644 --- a/src/plugins/platforms/vnc/qvnc.cpp +++ b/src/plugins/platforms/vnc/qvnc.cpp @@ -52,8 +52,12 @@ #include #endif +#include + QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcVnc, "qt.qpa.vnc"); + QVncDirtyMap::QVncDirtyMap(QVncScreen *screen) : screen(screen), bytesPerPixel(0), numDirty(0) { @@ -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) { @@ -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())); @@ -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); } diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h index cdc49c030a..1c44cd1569 100644 --- a/src/plugins/platforms/vnc/qvnc_p.h +++ b/src/plugins/platforms/vnc/qvnc_p.h @@ -40,21 +40,17 @@ #ifndef QVNC_P_H #define QVNC_P_H -#include -#if 0 -#define QT_VNC_DEBUG if (1) {} else qDebug -#else -#define QT_VNC_DEBUG qDebug -#endif - #include "qvncscreen.h" +#include #include #include #include QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcVnc) + class QTcpSocket; class QTcpServer; diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp index 55bef8c13e..a932861d87 100644 --- a/src/plugins/platforms/vnc/qvncclient.cpp +++ b/src/plugins/platforms/vnc/qvncclient.cpp @@ -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; } } @@ -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) { @@ -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; } @@ -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: @@ -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")) { @@ -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; } @@ -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: @@ -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; } } @@ -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), @@ -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; @@ -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: @@ -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: @@ -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)) { diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index 532b9225da..6d117c62bf 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -83,9 +83,7 @@ bool QVncScreen::initialize() } } - QFbScreen::initializeCompositor(); - QT_VNC_DEBUG() << "QVncScreen::init" << geometry(); switch (depth()) { case 32: @@ -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;