From 2903db8b4ce77f5ff36da7c3c8fb43337881598f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 27 May 2012 03:47:28 +0200 Subject: [PATCH] Remove the QFactoryInterface dependency from accessible plugins QFactoryInterface is not needed anymore and will get removed soon. Change-Id: Ib2806200b1a7f4a45d62e2b556380946ef68f585 Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible.cpp | 2 +- src/gui/accessible/qaccessiblebridge.cpp | 19 +---- src/gui/accessible/qaccessiblebridge.h | 10 +-- src/gui/accessible/qaccessibleplugin.cpp | 18 +--- src/gui/accessible/qaccessibleplugin.h | 10 +-- .../accessible/qplatformaccessibility_qpa.cpp | 4 +- src/plugins/accessible/widgets/main.cpp | 83 ------------------- 7 files changed, 11 insertions(+), 135 deletions(-) diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index ec02086d74..7fc01c7555 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -582,7 +582,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) return iface; } #ifndef QT_NO_LIBRARY - if (QAccessibleInterface * iface = qLoadPlugin1(loader(), cn, object)) + if (QAccessibleInterface * iface = qLoadPlugin1(loader(), cn, object)) return iface; #endif mo = mo->superClass(); diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp index d6d0796701..e0780f0680 100644 --- a/src/gui/accessible/qaccessiblebridge.cpp +++ b/src/gui/accessible/qaccessiblebridge.cpp @@ -108,17 +108,15 @@ QT_BEGIN_NAMESPACE \inmodule QtWidgets Writing an accessibility bridge plugin is achieved by subclassing - this base class, reimplementing the pure virtual functions keys() - and create(), and exporting the class with the - Q_EXPORT_PLUGIN2() macro. + this base class, reimplementing the pure virtual function create(), + and exporting the class with the Q_PLUGIN_METADATA() macro. \sa QAccessibleBridge, QAccessiblePlugin, {How to Create Qt Plugins} */ /*! Constructs an accessibility bridge plugin with the given \a - parent. This is invoked automatically by the Q_EXPORT_PLUGIN2() - macro. + parent. This is invoked automatically by the plugin loader. */ QAccessibleBridgePlugin::QAccessibleBridgePlugin(QObject *parent) : QObject(parent) @@ -137,17 +135,6 @@ QAccessibleBridgePlugin::~QAccessibleBridgePlugin() } -/*! - \fn QStringList QAccessibleBridgePlugin::keys() const - - Returns the list of keys this plugins supports. - - These keys must be the names of the bridges that this - plugin provides. - - \sa create() -*/ - /*! \fn QAccessibleBridge *QAccessibleBridgePlugin::create(const QString &key) diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h index 80830bd01c..5910c6b126 100644 --- a/src/gui/accessible/qaccessiblebridge.h +++ b/src/gui/accessible/qaccessiblebridge.h @@ -63,23 +63,15 @@ public: virtual void notifyAccessibilityUpdate(QAccessibleEvent *event) = 0; }; -struct Q_GUI_EXPORT QAccessibleBridgeFactoryInterface : public QFactoryInterface -{ - virtual QAccessibleBridge *create(const QString& name) = 0; -}; - #define QAccessibleBridgeFactoryInterface_iid "org.qt-project.Qt.QAccessibleBridgeFactoryInterface" -Q_DECLARE_INTERFACE(QAccessibleBridgeFactoryInterface, QAccessibleBridgeFactoryInterface_iid) -class Q_GUI_EXPORT QAccessibleBridgePlugin : public QObject, public QAccessibleBridgeFactoryInterface +class Q_GUI_EXPORT QAccessibleBridgePlugin : public QObject { Q_OBJECT - Q_INTERFACES(QAccessibleBridgeFactoryInterface:QFactoryInterface) public: explicit QAccessibleBridgePlugin(QObject *parent = 0); ~QAccessibleBridgePlugin(); - virtual QStringList keys() const = 0; virtual QAccessibleBridge *create(const QString &key) = 0; }; diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/gui/accessible/qaccessibleplugin.cpp index c2fe9c7a7a..6b6f9348fd 100644 --- a/src/gui/accessible/qaccessibleplugin.cpp +++ b/src/gui/accessible/qaccessibleplugin.cpp @@ -58,16 +58,15 @@ QT_BEGIN_NAMESPACE \ingroup accessibility Writing an accessibility plugin is achieved by subclassing this - base class, reimplementing the pure virtual functions keys() and - create(), and exporting the class with the Q_EXPORT_PLUGIN2() - macro. + base class, reimplementing the pure virtual function create(), + and exporting the class with the Q_PLUGIN_METADATA() macro. \sa QAccessibleBridgePlugin, {How to Create Qt Plugins} */ /*! Constructs an accessibility plugin with the given \a parent. This - is invoked automatically by the Q_EXPORT_PLUGIN2() macro. + is invoked automatically by the plugin loader. */ QAccessiblePlugin::QAccessiblePlugin(QObject *parent) : QObject(parent) @@ -84,17 +83,6 @@ QAccessiblePlugin::~QAccessiblePlugin() { } -/*! - \fn QStringList QAccessiblePlugin::keys() const - - Returns the list of keys this plugin supports. - - These keys must be the class names that this plugin provides - an accessibility implementation for. - - \sa create() -*/ - /*! \fn QAccessibleInterface *QAccessiblePlugin::create(const QString &key, QObject *object) diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h index 275e9ea753..8bec59ae16 100644 --- a/src/gui/accessible/qaccessibleplugin.h +++ b/src/gui/accessible/qaccessibleplugin.h @@ -55,25 +55,17 @@ QT_BEGIN_NAMESPACE class QStringList; class QAccessibleInterface; -struct Q_GUI_EXPORT QAccessibleFactoryInterface : public QFactoryInterface -{ - virtual QAccessibleInterface* create(const QString &key, QObject *object) = 0; -}; - #define QAccessibleFactoryInterface_iid "org.qt-project.Qt.QAccessibleFactoryInterface" -Q_DECLARE_INTERFACE(QAccessibleFactoryInterface, QAccessibleFactoryInterface_iid) class QAccessiblePluginPrivate; -class Q_GUI_EXPORT QAccessiblePlugin : public QObject, public QAccessibleFactoryInterface +class Q_GUI_EXPORT QAccessiblePlugin : public QObject { Q_OBJECT - Q_INTERFACES(QAccessibleFactoryInterface:QFactoryInterface) public: explicit QAccessiblePlugin(QObject *parent = 0); ~QAccessiblePlugin(); - virtual QStringList keys() const = 0; virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0; }; diff --git a/src/gui/accessible/qplatformaccessibility_qpa.cpp b/src/gui/accessible/qplatformaccessibility_qpa.cpp index 36fba10ac4..dba5475995 100644 --- a/src/gui/accessible/qplatformaccessibility_qpa.cpp +++ b/src/gui/accessible/qplatformaccessibility_qpa.cpp @@ -118,13 +118,13 @@ void QPlatformAccessibility::initialize() typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; const PluginKeyMap keyMap = bridgeloader()->keyMap(); - QAccessibleBridgeFactoryInterface *factory = 0; + QAccessibleBridgePlugin *factory = 0; int i = -1; const PluginKeyMapConstIterator cend = keyMap.constEnd(); for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { if (it.key() != i) { i = it.key(); - factory = qobject_cast(bridgeloader()->instance(i)); + factory = qobject_cast(bridgeloader()->instance(i)); } if (factory) if (QAccessibleBridge *bridge = factory->create(it.value())) diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp index d180be6d2a..780db06ca9 100644 --- a/src/plugins/accessible/widgets/main.cpp +++ b/src/plugins/accessible/widgets/main.cpp @@ -67,7 +67,6 @@ class AccessibleFactory : public QAccessiblePlugin public: AccessibleFactory(); - QStringList keys() const; QAccessibleInterface *create(const QString &classname, QObject *object); }; @@ -75,88 +74,6 @@ AccessibleFactory::AccessibleFactory() { } -QStringList AccessibleFactory::keys() const -{ - QStringList list; -#ifndef QT_NO_LINEEDIT - list << QLatin1String("QLineEdit"); -#endif -#ifndef QT_NO_COMBOBOX - list << QLatin1String("QComboBox"); -#endif -#ifndef QT_NO_SPINBOX - list << QLatin1String("QAbstractSpinBox"); - list << QLatin1String("QSpinBox"); - list << QLatin1String("QDoubleSpinBox"); -#endif -#ifndef QT_NO_SCROLLBAR - list << QLatin1String("QScrollBar"); -#endif -#ifndef QT_NO_SLIDER - list << QLatin1String("QSlider"); -#endif - list << QLatin1String("QAbstractSlider"); -#ifndef QT_NO_TOOLBUTTON - list << QLatin1String("QToolButton"); -#endif - list << QLatin1String("QCheckBox"); - list << QLatin1String("QRadioButton"); - list << QLatin1String("QPushButton"); - list << QLatin1String("QAbstractButton"); - list << QLatin1String("QDialog"); - list << QLatin1String("QMessageBox"); - list << QLatin1String("QMainWindow"); - list << QLatin1String("QLabel"); - list << QLatin1String("QLCDNumber"); - list << QLatin1String("QGroupBox"); - list << QLatin1String("QStatusBar"); - list << QLatin1String("QProgressBar"); - list << QLatin1String("QMenuBar"); - list << QLatin1String("QMenu"); - list << QLatin1String("QHeaderView"); - list << QLatin1String("QTabBar"); - list << QLatin1String("QToolBar"); - list << QLatin1String("QSizeGrip"); - list << QLatin1String("QAbstractItemView"); - list << QLatin1String("QWidget"); -#ifndef QT_NO_SPLITTER - list << QLatin1String("QSplitter"); - list << QLatin1String("QSplitterHandle"); -#endif -#ifndef QT_NO_TEXTEDIT - list << QLatin1String("QTextEdit"); -#endif - list << QLatin1String("QTipLabel"); - list << QLatin1String("QFrame"); - list << QLatin1String("QStackedWidget"); - list << QLatin1String("QToolBox"); - list << QLatin1String("QMdiArea"); - list << QLatin1String("QMdiSubWindow"); - list << QLatin1String("QDialogButtonBox"); -#ifndef QT_NO_DIAL - list << QLatin1String("QDial"); -#endif -#ifndef QT_NO_RUBBERBAND - list << QLatin1String("QRubberBand"); -#endif -#ifndef QT_NO_TEXTBROWSER - list << QLatin1String("QTextBrowser"); -#endif -#ifndef QT_NO_SCROLLAREA - list << QLatin1String("QAbstractScrollArea"); - list << QLatin1String("QScrollArea"); -#endif -#ifndef QT_NO_CALENDARWIDGET - list << QLatin1String("QCalendarWidget"); -#endif - -#ifndef QT_NO_DOCKWIDGET - list << QLatin1String("QDockWidget"); -#endif - list << QLatin1String("QAccessibleWidget"); - return list; -} - QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObject *object) { QAccessibleInterface *iface = 0;