Remove the QFactoryInterface dependency from accessible plugins

QFactoryInterface is not needed anymore and will get removed soon.

Change-Id: Ib2806200b1a7f4a45d62e2b556380946ef68f585
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Lars Knoll 2012-05-27 03:47:28 +02:00 committed by Qt by Nokia
parent c9d040c1f5
commit 2903db8b4c
7 changed files with 11 additions and 135 deletions

View File

@ -582,7 +582,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
return iface; return iface;
} }
#ifndef QT_NO_LIBRARY #ifndef QT_NO_LIBRARY
if (QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessibleFactoryInterface>(loader(), cn, object)) if (QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessiblePlugin>(loader(), cn, object))
return iface; return iface;
#endif #endif
mo = mo->superClass(); mo = mo->superClass();

View File

@ -108,17 +108,15 @@ QT_BEGIN_NAMESPACE
\inmodule QtWidgets \inmodule QtWidgets
Writing an accessibility bridge plugin is achieved by subclassing Writing an accessibility bridge plugin is achieved by subclassing
this base class, reimplementing the pure virtual functions keys() this base class, reimplementing the pure virtual function create(),
and create(), and exporting the class with the and exporting the class with the Q_PLUGIN_METADATA() macro.
Q_EXPORT_PLUGIN2() macro.
\sa QAccessibleBridge, QAccessiblePlugin, {How to Create Qt Plugins} \sa QAccessibleBridge, QAccessiblePlugin, {How to Create Qt Plugins}
*/ */
/*! /*!
Constructs an accessibility bridge plugin with the given \a Constructs an accessibility bridge plugin with the given \a
parent. This is invoked automatically by the Q_EXPORT_PLUGIN2() parent. This is invoked automatically by the plugin loader.
macro.
*/ */
QAccessibleBridgePlugin::QAccessibleBridgePlugin(QObject *parent) QAccessibleBridgePlugin::QAccessibleBridgePlugin(QObject *parent)
: 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) \fn QAccessibleBridge *QAccessibleBridgePlugin::create(const QString &key)

View File

@ -63,23 +63,15 @@ public:
virtual void notifyAccessibilityUpdate(QAccessibleEvent *event) = 0; 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" #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_OBJECT
Q_INTERFACES(QAccessibleBridgeFactoryInterface:QFactoryInterface)
public: public:
explicit QAccessibleBridgePlugin(QObject *parent = 0); explicit QAccessibleBridgePlugin(QObject *parent = 0);
~QAccessibleBridgePlugin(); ~QAccessibleBridgePlugin();
virtual QStringList keys() const = 0;
virtual QAccessibleBridge *create(const QString &key) = 0; virtual QAccessibleBridge *create(const QString &key) = 0;
}; };

View File

@ -58,16 +58,15 @@ QT_BEGIN_NAMESPACE
\ingroup accessibility \ingroup accessibility
Writing an accessibility plugin is achieved by subclassing this Writing an accessibility plugin is achieved by subclassing this
base class, reimplementing the pure virtual functions keys() and base class, reimplementing the pure virtual function create(),
create(), and exporting the class with the Q_EXPORT_PLUGIN2() and exporting the class with the Q_PLUGIN_METADATA() macro.
macro.
\sa QAccessibleBridgePlugin, {How to Create Qt Plugins} \sa QAccessibleBridgePlugin, {How to Create Qt Plugins}
*/ */
/*! /*!
Constructs an accessibility plugin with the given \a parent. This 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) QAccessiblePlugin::QAccessiblePlugin(QObject *parent)
: 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) \fn QAccessibleInterface *QAccessiblePlugin::create(const QString &key, QObject *object)

View File

@ -55,25 +55,17 @@ QT_BEGIN_NAMESPACE
class QStringList; class QStringList;
class QAccessibleInterface; 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" #define QAccessibleFactoryInterface_iid "org.qt-project.Qt.QAccessibleFactoryInterface"
Q_DECLARE_INTERFACE(QAccessibleFactoryInterface, QAccessibleFactoryInterface_iid)
class QAccessiblePluginPrivate; class QAccessiblePluginPrivate;
class Q_GUI_EXPORT QAccessiblePlugin : public QObject, public QAccessibleFactoryInterface class Q_GUI_EXPORT QAccessiblePlugin : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(QAccessibleFactoryInterface:QFactoryInterface)
public: public:
explicit QAccessiblePlugin(QObject *parent = 0); explicit QAccessiblePlugin(QObject *parent = 0);
~QAccessiblePlugin(); ~QAccessiblePlugin();
virtual QStringList keys() const = 0;
virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0; virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0;
}; };

View File

@ -118,13 +118,13 @@ void QPlatformAccessibility::initialize()
typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
const PluginKeyMap keyMap = bridgeloader()->keyMap(); const PluginKeyMap keyMap = bridgeloader()->keyMap();
QAccessibleBridgeFactoryInterface *factory = 0; QAccessibleBridgePlugin *factory = 0;
int i = -1; int i = -1;
const PluginKeyMapConstIterator cend = keyMap.constEnd(); const PluginKeyMapConstIterator cend = keyMap.constEnd();
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
if (it.key() != i) { if (it.key() != i) {
i = it.key(); i = it.key();
factory = qobject_cast<QAccessibleBridgeFactoryInterface*>(bridgeloader()->instance(i)); factory = qobject_cast<QAccessibleBridgePlugin*>(bridgeloader()->instance(i));
} }
if (factory) if (factory)
if (QAccessibleBridge *bridge = factory->create(it.value())) if (QAccessibleBridge *bridge = factory->create(it.value()))

View File

@ -67,7 +67,6 @@ class AccessibleFactory : public QAccessiblePlugin
public: public:
AccessibleFactory(); AccessibleFactory();
QStringList keys() const;
QAccessibleInterface *create(const QString &classname, QObject *object); 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 *AccessibleFactory::create(const QString &classname, QObject *object)
{ {
QAccessibleInterface *iface = 0; QAccessibleInterface *iface = 0;