summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsole.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-01-10 17:17:12 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 12:12:17 +0100
commitdb51ffc0d1fbce85fd542403812fab8783c53e3c (patch)
tree2e7a051dbf6701b477e4c19de014a44dbaf84c37 /src/plugins/platforms/windows/qwindowsole.cpp
parenta5c288ea5675a382edf0b3ecae42f461a22a7303 (diff)
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 <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsole.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsole.cpp42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/plugins/platforms/windows/qwindowsole.cpp b/src/plugins/platforms/windows/qwindowsole.cpp
index 0cea691f39..5c5dbf9cfe 100644
--- a/src/plugins/platforms/windows/qwindowsole.cpp
+++ b/src/plugins/platforms/windows/qwindowsole.cpp
@@ -80,14 +80,11 @@ QWindowsOleDataObject::QWindowsOleDataObject(QMimeData *mimeData) :
CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT)),
performedEffect(DROPEFFECT_NONE)
{
- if (QWindowsContext::verboseOLE)
- qDebug("%s '%s'", __FUNCTION__, qPrintable(mimeData->formats().join(QStringLiteral(", "))));
+ qCDebug(lcQpaMime) << __FUNCTION__ << mimeData->formats();
}
QWindowsOleDataObject::~QWindowsOleDataObject()
{
- if (QWindowsContext::verboseOLE)
- qDebug("%s", __FUNCTION__);
}
void QWindowsOleDataObject::releaseQt()
@@ -143,10 +140,10 @@ QWindowsOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
{
HRESULT hr = ResultFromScode(DATA_E_FORMATETC);
- if (QWindowsContext::verboseOLE) {
+ if (lcQpaMime().isDebugEnabled()) {
wchar_t buf[256] = {0};
GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
- qDebug("%s CF = %d : %s", __FUNCTION__, pformatetc->cfFormat, qPrintable(QString::fromWCharArray(buf)));
+ qCDebug(lcQpaMime) <<__FUNCTION__ << "CF = " << pformatetc->cfFormat << QString::fromWCharArray(buf);
}
if (data) {
@@ -156,11 +153,10 @@ QWindowsOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
hr = ResultFromScode(S_OK);
}
- if (QWindowsContext::verboseOLE) {
+ if (QWindowsContext::verbose > 1) {
wchar_t buf[256] = {0};
GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
- qDebug("%s CF = %d : %s returns 0x%x", __FUNCTION__, pformatetc->cfFormat,
- qPrintable(QString::fromWCharArray(buf)), int(hr));
+ qCDebug(lcQpaMime) <<__FUNCTION__ << "CF = " << pformatetc->cfFormat << " returns 0x" << int(hr) << dec;
}
return hr;
@@ -177,16 +173,16 @@ QWindowsOleDataObject::QueryGetData(LPFORMATETC pformatetc)
{
HRESULT hr = ResultFromScode(DATA_E_FORMATETC);
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s", __FUNCTION__);
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__;
if (data) {
const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter();
hr = mc.converterFromMime(*pformatetc, data) ?
ResultFromScode(S_OK) : ResultFromScode(S_FALSE);
}
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s returns 0x%x", __FUNCTION__, int(hr));
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__ << " returns 0x" << hex << int(hr);
return hr;
}
@@ -200,8 +196,8 @@ QWindowsOleDataObject::GetCanonicalFormatEtc(LPFORMATETC, LPFORMATETC pformatetc
STDMETHODIMP
QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL fRelease)
{
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s", __FUNCTION__);
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__;
HRESULT hr = ResultFromScode(E_NOTIMPL);
@@ -213,8 +209,8 @@ QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL
ReleaseStgMedium(pMedium);
hr = ResultFromScode(S_OK);
}
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s returns 0x%x", __FUNCTION__, int(hr));
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__ << " returns 0x" << hex << int(hr);
return hr;
}
@@ -222,8 +218,8 @@ QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL
STDMETHODIMP
QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc)
{
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s", __FUNCTION__);
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__;
if (!data)
return ResultFromScode(DATA_E_FORMATETC);
@@ -285,8 +281,8 @@ QWindowsOleDataObject::EnumDAdvise(LPENUMSTATDATA FAR*)
QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs) :
m_dwRefs(1), m_nIndex(0), m_isNull(false)
{
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s", __FUNCTION__);
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__;
m_lpfmtetcs.reserve(fmtetcs.count());
for (int idx = 0; idx < fmtetcs.count(); ++idx) {
LPFORMATETC destetc = new FORMATETC();
@@ -303,8 +299,8 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs)
QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<LPFORMATETC> &lpfmtetcs) :
m_dwRefs(1), m_nIndex(0), m_isNull(false)
{
- if (QWindowsContext::verboseOLE > 1)
- qDebug("%s", __FUNCTION__);
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaMime) << __FUNCTION__;
m_lpfmtetcs.reserve(lpfmtetcs.count());
for (int idx = 0; idx < lpfmtetcs.count(); ++idx) {
LPFORMATETC srcetc = lpfmtetcs.at(idx);