summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/accessible
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/accessible')
-rw-r--r--src/plugins/platforms/windows/accessible/accessible.pri4
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp10
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp47
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp25
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h7
5 files changed, 33 insertions, 60 deletions
diff --git a/src/plugins/platforms/windows/accessible/accessible.pri b/src/plugins/platforms/windows/accessible/accessible.pri
index 08a37a4733..e26c6614e2 100644
--- a/src/plugins/platforms/windows/accessible/accessible.pri
+++ b/src/plugins/platforms/windows/accessible/accessible.pri
@@ -8,10 +8,10 @@ HEADERS += \
$$PWD/qwindowsaccessibility.h \
$$PWD/comutils.h
-!win32-g++*: {
+!mingw: {
SOURCES += $$PWD/iaccessible2.cpp
HEADERS += $$PWD/iaccessible2.h
include(../../../../3rdparty/iaccessible2/iaccessible2.pri)
}
-win32-g++*: LIBS *= -luuid \ No newline at end of file
+mingw: LIBS *= -luuid \ No newline at end of file
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 66ed9d85dc..7f2ed86404 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -59,10 +59,10 @@ HRESULT STDMETHODCALLTYPE AccessibleApplication::QueryInterface(REFIID id, LPVOI
{
*iface = 0;
if (id == IID_IUnknown) {
- accessibleDebug("AccessibleApplication::QI(): IID_IUnknown");
+ qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IUnknown";
*iface = (IUnknown*)this;
} else if (id == IID_IAccessibleApplication) {
- accessibleDebug("AccessibleApplication::QI(): IID_IAccessibleApplication");
+ qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IAccessibleApplication";
*iface = static_cast<IAccessibleApplication*>(this);
}
@@ -476,7 +476,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_uniqueID(long *outUniqueID)
if (!accessible)
return E_FAIL;
- accessibleDebug("uniqueID: %08x", id);
+ qCDebug(lcQpaAccessibility) << "uniqueID: " << showbase << hex << id;
*outUniqueID = (long)id;
return int(id) < 0 ? S_OK : S_FALSE;
@@ -841,7 +841,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_cellAt( long row, long colu
*cell = QWindowsAccessibility::wrap(qtCell);
}
}
- accessibleDebug("found cell? %p", *cell);
+ qCDebug(lcQpaAccessibility) << "found cell? " << *cell;
return *cell ? S_OK : S_FALSE;
}
@@ -1574,7 +1574,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic
return E_POINTER;
Q_UNUSED(guidService);
*iface = 0;
- accessibleDebug("QWindowsIA2Accessible::QS(): %s", IIDToString(riid).constData());
+ qCDebug(lcQpaAccessibility) << "QWindowsIA2Accessible::QS(): " << IIDToString(riid);
if (guidService == IID_IAccessible) {
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
index 885bc37cff..307f2fc3bb 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
@@ -100,6 +100,25 @@ QWindowsAccessibility::QWindowsAccessibility()
{
}
+// Retrieve sound name by checking the icon property of a message box
+static inline QString messageBoxAlertSound(const QObject *messageBox)
+{
+ enum MessageBoxIcon { // Keep in sync with QMessageBox::Icon
+ Information = 1,
+ Warning = 2,
+ Critical = 3
+ };
+ switch (messageBox->property("icon").toInt()) {
+ case Information:
+ return QStringLiteral("SystemAsterisk");
+ case Warning:
+ return QStringLiteral("SystemExclamation");
+ case Critical:
+ return QStringLiteral("SystemHand");
+ }
+ return QString();
+}
+
void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
QString soundName;
@@ -113,32 +132,8 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
break;
case QAccessible::Alert:
- {
- /* ### FIXME
-#ifndef QT_NO_MESSAGEBOX
- QMessageBox *mb = qobject_cast<QMessageBox*>(o);
- if (mb) {
- switch (mb->icon()) {
- case QMessageBox::Warning:
- soundName = QLatin1String("SystemExclamation");
- break;
- case QMessageBox::Critical:
- soundName = QLatin1String("SystemHand");
- break;
- case QMessageBox::Information:
- soundName = QLatin1String("SystemAsterisk");
- break;
- default:
- break;
- }
- } else
-#endif // QT_NO_MESSAGEBOX
-*/
- {
- soundName = QLatin1String("SystemAsterisk");
- }
-
- }
+ soundName = event->object()->inherits("QMessageBox") ?
+ messageBoxAlertSound(event->object()) : QStringLiteral("SystemAsterisk");
break;
default:
break;
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 7c7c33616e..bda806d102 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -185,23 +185,10 @@ HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Skip(unsigned long celt)
return S_OK;
}
-#ifndef QT_NO_DEBUG
-bool debug_accessibility()
-{
- static int debugging = -1;
- if (debugging == -1)
- debugging = qgetenv("QT_DEBUG_ACCESSIBILITY").toInt();
- return !!debugging;
-}
-#endif
-
#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface)
{
- QString str;
- QDebug dbg(&str);
- dbg << iface << QLatin1String(funcName);
- accessibleDebug("%s", qPrintable(str));
+ qCDebug(lcQpaAccessibility) << iface << funcName;
}
#endif
@@ -216,10 +203,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::QueryInterface(REFIID id, LPVO
QByteArray strIID = IIDToString(id);
if (!strIID.isEmpty()) {
- QString ss;
- QDebug dbg(&ss);
- dbg << accessibleInterface();
- accessibleDebug("QWindowsIA2Accessible::QI() - IID:%s, iface:%s ", strIID.constData(), qPrintable(ss));
+ qCDebug(lcQpaAccessibility) << "QWindowsIA2Accessible::QI() - IID:"
+ << strIID << ", iface:" << accessibleInterface();
}
if (id == IID_IUnknown) {
*iface = (IUnknown*)(IDispatch*)this;
@@ -1059,7 +1044,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BS
}
*pszValue = 0;
- accessibleDebug("return S_FALSE");
+ qCDebug(lcQpaAccessibility) << "return S_FALSE";
return S_FALSE;
}
@@ -1198,7 +1183,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
Q_ASSERT(platform);
*phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
- accessibleDebug("QWindowsAccessible::GetWindow(): %p", *phwnd);
+ qCDebug(lcQpaAccessibility) << "QWindowsAccessible::GetWindow(): " << *phwnd;
return S_OK;
}
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
index 5b8d08d3c8..43482da4be 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
@@ -59,13 +59,6 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_OUTPUT)
-bool debug_accessibility();
-# define accessibleDebug !debug_accessibility() ? (void)0 : qDebug
-#else
-# define accessibleDebug while (false) qDebug
-#endif
-
#ifndef QT_NO_DEBUG_OUTPUT
#define DEBUG_SHOW_ATCLIENT_COMMANDS
#endif