diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-01-10 17:17:12 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-22 12:12:17 +0100 |
commit | db51ffc0d1fbce85fd542403812fab8783c53e3c (patch) | |
tree | 2e7a051dbf6701b477e4c19de014a44dbaf84c37 /src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | |
parent | a5c288ea5675a382edf0b3ecae42f461a22a7303 (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/qwindowsdialoghelpers.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 8ebfd018d0..2abfb426cc 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -422,8 +422,7 @@ void eatMouseMove() ; if (msg.message == WM_MOUSEMOVE) PostMessage(msg.hwnd, msg.message, 0, msg.lParam); - if (QWindowsContext::verboseDialogs) - qDebug("%s triggered=%d" , __FUNCTION__, msg.message == WM_MOUSEMOVE); + qCDebug(lcQpaDialogs) << __FUNCTION__ << "triggered=" << (msg.message == WM_MOUSEMOVE); } } // namespace QWindowsDialogs @@ -558,12 +557,10 @@ private: void QWindowsDialogThread::run() { - if (QWindowsContext::verboseDialogs) - qDebug(">%s" , __FUNCTION__); + qCDebug(lcQpaDialogs) << '>' << __FUNCTION__; m_dialog->exec(m_owner); deleteLater(); - if (QWindowsContext::verboseDialogs) - qDebug("<%s" , __FUNCTION__); + qCDebug(lcQpaDialogs) << '<' << __FUNCTION__; } template <class BaseClass> @@ -579,9 +576,9 @@ bool QWindowsDialogHelperBase<BaseClass>::show(Qt::WindowFlags, } else { m_ownerWindow = 0; } - if (QWindowsContext::verboseDialogs) - qDebug("%s modal=%d modal supported? %d native=%p parent=%p" , - __FUNCTION__, modal, supportsNonModalDialog(parent), m_nativeDialog.data(), m_ownerWindow); + qCDebug(lcQpaDialogs) << __FUNCTION__ << "modal=" << modal + << " modal supported? " << supportsNonModalDialog(parent) + << "native=" << m_nativeDialog.data() << "owner" << m_ownerWindow; if (!modal && !supportsNonModalDialog(parent)) return false; // Was it changed in-between? if (!ensureNativeDialog()) @@ -665,8 +662,7 @@ void QWindowsDialogHelperBase<BaseClass>::hide() template <class BaseClass> void QWindowsDialogHelperBase<BaseClass>::exec() { - if (QWindowsContext::verboseDialogs) - qDebug("%s" , __FUNCTION__); + qCDebug(lcQpaDialogs) << __FUNCTION__; stopTimer(); if (QWindowsNativeDialogBase *nd = nativeDialog()) { nd->exec(m_ownerWindow); @@ -956,8 +952,7 @@ bool QWindowsNativeFileDialogBase::init(const CLSID &clsId, const IID &iid) qErrnoWarning("IFileDialog::Advise failed"); return false; } - if (QWindowsContext::verboseDialogs) - qDebug("%s %p %p cookie=%lu" , __FUNCTION__, m_fileDialog, m_dialogEvents, m_cookie); + qCDebug(lcQpaDialogs) << __FUNCTION__ << m_fileDialog << m_dialogEvents << m_cookie; return true; } @@ -1008,14 +1003,12 @@ QString QWindowsNativeFileDialogBase::directory() const void QWindowsNativeFileDialogBase::doExec(HWND owner) { - if (QWindowsContext::verboseDialogs) - qDebug(">%s on %p", __FUNCTION__, (void *)owner); + qCDebug(lcQpaDialogs) << '>' << __FUNCTION__; // Show() blocks until the user closes the dialog, the dialog window // gets a WM_CLOSE or the parent window is destroyed. const HRESULT hr = m_fileDialog->Show(owner); QWindowsDialogs::eatMouseMove(); - if (QWindowsContext::verboseDialogs) - qDebug("<%s returns 0x%lx", __FUNCTION__, hr); + qCDebug(lcQpaDialogs) << '<' << __FUNCTION__ << " returns " << hex << hr; if (hr == S_OK) { emit accepted(); } else { @@ -1045,10 +1038,8 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QF flags |= FOS_FILEMUSTEXIST | FOS_ALLOWMULTISELECT; break; } - if (QWindowsContext::verboseDialogs) - qDebug().nospace() - << __FUNCTION__ << " mode=" << mode << " options" - << options << " results in 0x" << flags; + qCDebug(lcQpaDialogs) << __FUNCTION__ << " mode=" << mode << " options" + << options << " results in 0x" << flags; if (FAILED(m_fileDialog->SetOptions(flags))) qErrnoWarning("%s: SetOptions() failed", __FUNCTION__); @@ -1352,8 +1343,7 @@ void QWindowsNativeFileDialogBase::close() // IFileDialog::Close() does not work unless invoked from a callback. // Try to find the window and send it a WM_CLOSE in addition. const HWND hwnd = findDialogWindow(m_title); - if (QWindowsContext::verboseDialogs) - qDebug() << __FUNCTION__ << "closing" << hwnd; + qCDebug(lcQpaDialogs) << __FUNCTION__ << "closing" << hwnd; if (hwnd && IsWindowVisible(hwnd)) PostMessageW(hwnd, WM_CLOSE, 0, 0); #endif // !Q_OS_WINCE @@ -1617,8 +1607,7 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog() void QWindowsFileDialogHelper::setDirectory(const QUrl &directory) { - if (QWindowsContext::verboseDialogs) - qDebug("%s %s" , __FUNCTION__, qPrintable(directory.toString())); + qCDebug(lcQpaDialogs) << __FUNCTION__ << directory.toString(); m_data.setDirectory(directory); if (hasNativeDialog()) @@ -1632,8 +1621,7 @@ QUrl QWindowsFileDialogHelper::directory() const void QWindowsFileDialogHelper::selectFile(const QUrl &fileName) { - if (QWindowsContext::verboseDialogs) - qDebug("%s %s" , __FUNCTION__, qPrintable(fileName.toString())); + qCDebug(lcQpaDialogs) << __FUNCTION__ << fileName.toString(); if (hasNativeDialog()) // Might be invoked from the QFileDialog constructor. nativeFileDialog()->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists @@ -1646,8 +1634,7 @@ QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const void QWindowsFileDialogHelper::setFilter() { - if (QWindowsContext::verboseDialogs) - qDebug("%s" , __FUNCTION__); + qCDebug(lcQpaDialogs) << __FUNCTION__; } void QWindowsFileDialogHelper::selectNameFilter(const QString &filter) @@ -2039,8 +2026,6 @@ void QWindowsNativeColorDialog::doExec(HWND owner) typedef BOOL (WINAPI *ChooseColorWType)(LPCHOOSECOLORW); CHOOSECOLOR chooseColor; - if (QWindowsContext::verboseDialogs) - qDebug() << '>' << __FUNCTION__ << " on " << owner; ZeroMemory(&chooseColor, sizeof(chooseColor)); chooseColor.lStructSize = sizeof(chooseColor); chooseColor.hwndOwner = owner; @@ -2069,8 +2054,6 @@ void QWindowsNativeColorDialog::doExec(HWND owner) for (int c= 0; c < customColorCount; ++c) qCustomColors[c] = COLORREFToQColor(m_customColors[c]).rgb(); emit accepted(); - if (QWindowsContext::verboseDialogs) - qDebug() << '<' << __FUNCTION__ << *m_color; } else { emit rejected(); } |