From db51ffc0d1fbce85fd542403812fab8783c53e3c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 10 Jan 2014 17:17:12 +0100 Subject: Port Windows QPA plugin to new logger API. Introduce logging categories and change most debug statements to qCDebug(). Retrieve the filter rules from the environment variable QT_QPA_VERBOSE (should be removed once the logging framework offers a more convenient way of configuring). Replace the old per-category variables controlling verboseness of the output by a single variable which can be set on the command line. Change-Id: Iae55ecdb0e150efd165b7d3e90b371f72853f194 Reviewed-by: Joerg Bornemann --- .../platforms/windows/qwindowsbackingstore.cpp | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsbackingstore.cpp') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 0e0d10284b..1dd22c620b 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -61,14 +61,12 @@ QT_BEGIN_NAMESPACE QWindowsBackingStore::QWindowsBackingStore(QWindow *window) : QPlatformBackingStore(window) { - if (QWindowsContext::verboseBackingStore) - qDebug() << __FUNCTION__ << this << window; + qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window; } QWindowsBackingStore::~QWindowsBackingStore() { - if (QWindowsContext::verboseBackingStore) - qDebug() << __FUNCTION__ << this; + qCDebug(lcQpaBackingStore) << __FUNCTION__ << this; } QPaintDevice *QWindowsBackingStore::paintDevice() @@ -83,8 +81,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, Q_ASSERT(window); const QRect br = region.boundingRect(); - if (QWindowsContext::verboseBackingStore > 1) - qDebug() << __FUNCTION__ << window << offset << br; + if (QWindowsContext::verbose > 1) + qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window << offset << br; QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window); #ifndef Q_OS_WINCE @@ -128,12 +126,12 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, #endif // Write image for debug purposes. - if (QWindowsContext::verboseBackingStore > 2) { + if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) { static int n = 0; const QString fileName = QString::fromLatin1("win%1_%2.png"). arg(rw->winId()).arg(n++); m_image->image().save(fileName); - qDebug() << "Wrote " << m_image->image().size() << fileName; + qCDebug(lcQpaBackingStore) << "Wrote " << m_image->image().size() << fileName; } } @@ -141,12 +139,10 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) { if (m_image.isNull() || m_image->image().size() != size) { #ifndef QT_NO_DEBUG_OUTPUT - if (QWindowsContext::verboseBackingStore) { - QDebug nsp = qDebug().nospace(); - nsp << __FUNCTION__ << ' ' << rasterWindow()->window() - << ' ' << size << ' ' << region; - if (!m_image.isNull()) - nsp << " from: " << m_image->image().size(); + if (QWindowsContext::verbose && lcQpaBackingStore().isDebugEnabled()) { + qCDebug(lcQpaBackingStore) + << __FUNCTION__ << ' ' << rasterWindow()->window() << ' ' << size << ' ' << region + << " from: " << (m_image.isNull() ? QSize() : m_image->image().size()); } #endif QImage::Format format = QWindowsNativeImage::systemFormat(); @@ -188,8 +184,8 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) void QWindowsBackingStore::beginPaint(const QRegion ®ion) { - if (QWindowsContext::verboseBackingStore > 1) - qDebug() << __FUNCTION__; + if (QWindowsContext::verbose > 1) + qCDebug(lcQpaBackingStore) <<__FUNCTION__ << region; if (m_image->image().hasAlphaChannel()) { QPainter p(&m_image->image()); -- cgit v1.2.3