Use new plugin system in qtbase.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Thu, 23 Feb 2012 11:26:10 +0000 (12:26 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 27 Feb 2012 12:28:21 +0000 (13:28 +0100)
- AccessibleWidgets
- Windows printer support
- Examples

Change-Id: Icc162bd7fc284b3c76d9966210f983728085c743
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
24 files changed:
examples/tools/echoplugin/echowindow/echointerface.h
examples/tools/echoplugin/plugin/echoplugin.cpp
examples/tools/echoplugin/plugin/echoplugin.h
examples/tools/echoplugin/plugin/echoplugin.json [new file with mode: 0644]
examples/tools/echoplugin/plugin/plugin.pro
examples/tools/plugandpaint/interfaces.h
examples/tools/plugandpaint/main.cpp
examples/tools/plugandpaintplugins/basictools/basictools.json [new file with mode: 0644]
examples/tools/plugandpaintplugins/basictools/basictools.pro
examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp
examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h
examples/tools/plugandpaintplugins/extrafilters/extrafilters.json [new file with mode: 0644]
examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro
examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp
examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h
examples/tools/styleplugin/plugin/plugin.pro
examples/tools/styleplugin/plugin/simplestyle.json [new file with mode: 0644]
examples/tools/styleplugin/plugin/simplestyleplugin.cpp
examples/tools/styleplugin/plugin/simplestyleplugin.h
src/plugins/accessible/widgets/main.cpp
src/plugins/accessible/widgets/widgets.json [new file with mode: 0644]
src/plugins/printsupport/windows/main.cpp
src/plugins/printsupport/windows/windows.json [new file with mode: 0644]
src/plugins/printsupport/windows/windows.pro

index 412e37b..13494c8 100644 (file)
@@ -53,8 +53,10 @@ public:
 
 
 QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(EchoInterface,
-                    "com.trolltech.Plugin.EchoInterface/1.0");
+
+#define EchoInterface_iid "org.qt-project.Qt.Examples.EchoInterface"
+
+Q_DECLARE_INTERFACE(EchoInterface, EchoInterface_iid)
 QT_END_NAMESPACE
 
 //! [0]
index d22e7ea..0752089 100644 (file)
@@ -48,7 +48,3 @@ QString EchoPlugin::echo(const QString &message)
     return message;
 }
 //! [0]
-
-//! [1]
-Q_EXPORT_PLUGIN2(echoplugin, EchoPlugin);
-//! [1]
index d5e24b3..47373fc 100644 (file)
@@ -42,6 +42,7 @@
 #define ECHOPLUGIN_H
 
 #include <QObject>
+#include <QtPlugin>
 #include "echoplugin.h"
 #include "echointerface.h"
 
@@ -49,6 +50,7 @@
 class EchoPlugin : public QObject, EchoInterface
 {
     Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EchoInterface" FILE "echoplugin.json")
     Q_INTERFACES(EchoInterface)
 
 public:
diff --git a/examples/tools/echoplugin/plugin/echoplugin.json b/examples/tools/echoplugin/plugin/echoplugin.json
new file mode 100644 (file)
index 0000000..0967ef4
--- /dev/null
@@ -0,0 +1 @@
+{}
index 2be6de8..308c1b8 100644 (file)
@@ -4,6 +4,7 @@ CONFIG         += plugin
 INCLUDEPATH    += ../echowindow
 HEADERS         = echoplugin.h
 SOURCES         = echoplugin.cpp
+OTHER_FILES    += echoplugin.json
 TARGET          = $$qtLibraryTarget(echoplugin)
 DESTDIR         = ../plugins
 #! [0]
index e48683c..5c1e0c3 100644 (file)
@@ -96,14 +96,18 @@ public:
 
 QT_BEGIN_NAMESPACE
 //! [3] //! [4]
-Q_DECLARE_INTERFACE(BrushInterface,
-                    "com.trolltech.PlugAndPaint.BrushInterface/1.0")
+#define BrushInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface"
+
+Q_DECLARE_INTERFACE(BrushInterface, BrushInterface_iid)
 //! [3]
-Q_DECLARE_INTERFACE(ShapeInterface,
-                    "com.trolltech.PlugAndPaint.ShapeInterface/1.0")
+
+#define ShapeInterface_iid  "org.qt-project.Qt.Examples.PlugAndPaint.ShapeInterface"
+
+Q_DECLARE_INTERFACE(ShapeInterface, ShapeInterface_iid)
 //! [5]
-Q_DECLARE_INTERFACE(FilterInterface,
-                    "com.trolltech.PlugAndPaint.FilterInterface/1.0")
+#define FilterInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface"
+
+Q_DECLARE_INTERFACE(FilterInterface, FilterInterface_iid)
 //! [4] //! [5]
 QT_END_NAMESPACE
 
index 841d5b4..3c3693e 100644 (file)
@@ -43,9 +43,7 @@
 #include <QtPlugin>
 #include <QApplication>
 
-QT_BEGIN_NAMESPACE
-Q_IMPORT_PLUGIN(pnp_basictools)
-QT_END_NAMESPACE
+Q_IMPORT_PLUGIN(BasicToolsPlugin)
 
 int main(int argc, char *argv[])
 {
diff --git a/examples/tools/plugandpaintplugins/basictools/basictools.json b/examples/tools/plugandpaintplugins/basictools/basictools.json
new file mode 100644 (file)
index 0000000..0967ef4
--- /dev/null
@@ -0,0 +1 @@
+{}
index 6175de3..89023d1 100644 (file)
@@ -4,6 +4,7 @@ CONFIG       += plugin static
 INCLUDEPATH  += ../..
 HEADERS       = basictoolsplugin.h
 SOURCES       = basictoolsplugin.cpp
+OTHER_FILES  += basictools.json
 TARGET        = $$qtLibraryTarget(pnp_basictools)
 DESTDIR       = ../../plugandpaint/plugins
 #! [0]
index d55048d..bbcae60 100644 (file)
@@ -189,9 +189,3 @@ QImage BasicToolsPlugin::filterImage(const QString &filter, const QImage &image,
     return result;
 }
 //! [8]
-
-QT_BEGIN_NAMESPACE
-//! [9]
-Q_EXPORT_PLUGIN2(pnp_basictools, BasicToolsPlugin)
-//! [9]
-QT_END_NAMESPACE
index c857e4c..a895b60 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <QRect>
 #include <QObject>
+#include <QtPlugin>
 #include <QStringList>
 #include <QPainterPath>
 #include <QImage>
@@ -57,6 +58,7 @@ class BasicToolsPlugin : public QObject,
                          public FilterInterface
 {
     Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface" FILE "basictools.json")
     Q_INTERFACES(BrushInterface ShapeInterface FilterInterface)
 //! [0]
 
diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafilters.json b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.json
new file mode 100644 (file)
index 0000000..0967ef4
--- /dev/null
@@ -0,0 +1 @@
+{}
index 70e7c42..89acbab 100644 (file)
@@ -4,6 +4,7 @@ CONFIG       += plugin
 INCLUDEPATH  += ../..
 HEADERS       = extrafiltersplugin.h
 SOURCES       = extrafiltersplugin.cpp
+OTHER_FILES  += extrafilters.json
 TARGET        = $$qtLibraryTarget(pnp_extrafilters)
 DESTDIR       = ../../plugandpaint/plugins
 
index 9303fbb..186f364 100644 (file)
@@ -120,5 +120,3 @@ QImage ExtraFiltersPlugin::filterImage(const QString &filter,
     }
     return result;
 }
-
-Q_EXPORT_PLUGIN2(pnp_extrafilters, ExtraFiltersPlugin)
index b88febe..6693287 100644 (file)
@@ -43,6 +43,7 @@
 
 //! [0]
 #include <QObject>
+#include <QtPlugin>
 #include <QStringList>
 #include <QImage>
 
@@ -51,6 +52,7 @@
 class ExtraFiltersPlugin : public QObject, public FilterInterface
 {
     Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface" FILE "extrafilters.json")
     Q_INTERFACES(FilterInterface)
 
 public:
index e5cdbe0..b0dd871 100644 (file)
@@ -5,6 +5,7 @@ HEADERS     = simplestyle.h \
               simplestyleplugin.h
 SOURCES     = simplestyle.cpp \
               simplestyleplugin.cpp
+OTHER_FILES += simplestyle.json
 TARGET      = simplestyleplugin
 #! [0]
 win32 {
diff --git a/examples/tools/styleplugin/plugin/simplestyle.json b/examples/tools/styleplugin/plugin/simplestyle.json
new file mode 100644 (file)
index 0000000..a708e2a
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "Keys": [ "simplestyle" ]
+}
index caf3e01..4b37b2a 100644 (file)
@@ -58,7 +58,3 @@ QStyle *SimpleStylePlugin::create(const QString &key)
     return 0;
 }
 //! [1]
-
-QT_BEGIN_NAMESPACE
-Q_EXPORT_PLUGIN2(simplestyleplugin, SimpleStylePlugin)
-QT_END_NAMESPACE
index 873ac59..eb2cded 100644 (file)
@@ -52,9 +52,10 @@ QT_END_NAMESPACE
 class SimpleStylePlugin : public QStylePlugin
 {
     Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "simplestyle.json")
 
 public:
-    SimpleStylePlugin() {};
+    SimpleStylePlugin() {}
 
     QStringList keys() const;
     QStyle *create(const QString &key);
index dfa9594..ca8bf81 100644 (file)
@@ -61,6 +61,9 @@ QT_BEGIN_NAMESPACE
 
 class AccessibleFactory : public QAccessiblePlugin
 {
+    Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QAccessibleFactoryInterface" FILE "widgets.json")
+
 public:
     AccessibleFactory();
 
@@ -109,7 +112,6 @@ QStringList AccessibleFactory::keys() const
     list << QLatin1String("QStatusBar");
     list << QLatin1String("QProgressBar");
     list << QLatin1String("QMenuBar");
-    list << QLatin1String("Q3PopupMenu");
     list << QLatin1String("QMenu");
     list << QLatin1String("QHeaderView");
     list << QLatin1String("QTabBar");
@@ -251,8 +253,6 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
 #ifndef QT_NO_MENU
     } else if (classname == QLatin1String("QMenu")) {
         iface = new QAccessibleMenu(widget);
-    } else if (classname == QLatin1String("Q3PopupMenu")) {
-        iface = new QAccessibleMenu(widget);
 #endif
 #ifndef QT_NO_ITEMVIEWS
     } else if (classname == QLatin1String("QAbstractItemView")) {
@@ -345,9 +345,9 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
     return iface;
 }
 
-Q_EXPORT_STATIC_PLUGIN(AccessibleFactory)
-Q_EXPORT_PLUGIN2(qtaccessiblewidgets, AccessibleFactory)
 
 QT_END_NAMESPACE
 
+#include "main.moc"
+
 #endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/accessible/widgets/widgets.json b/src/plugins/accessible/widgets/widgets.json
new file mode 100644 (file)
index 0000000..fdeb6f2
--- /dev/null
@@ -0,0 +1,52 @@
+{
+    "Keys": [
+    "QLineEdit",
+    "QComboBox",
+    "QAbstractSpinBox",
+    "QSpinBox",
+    "QDoubleSpinBox",
+    "QScrollBar",
+    "QSlider",
+    "QAbstractSlider",
+    "QToolButton",
+    "QCheckBox",
+    "QRadioButton",
+    "QPushButton",
+    "QAbstractButton",
+    "QDialog",
+    "QMessageBox",
+    "QMainWindow",
+    "QLabel",
+    "QLCDNumber",
+    "QGroupBox",
+    "QStatusBar",
+    "QProgressBar",
+    "QMenuBar",
+    "QMenu",
+    "QHeaderView",
+    "QTabBar",
+    "QToolBar",
+    "QWorkspaceChild",
+    "QSizeGrip",
+    "QAbstractItemView",
+    "QWidget",
+    "QSplitter",
+    "QSplitterHandle",
+    "QTextEdit",
+    "QTipLabel",
+    "QFrame",
+    "QStackedWidget",
+    "QToolBox",
+    "QMdiArea",
+    "QMdiSubWindow",
+    "QWorkspace",
+    "QDialogButtonBox",
+    "QDial",
+    "QRubberBand",
+    "QTextBrowser",
+    "QAbstractScrollArea",
+    "QScrollArea",
+    "QCalendarWidget",
+    "QDockWidget",
+    "QAccessibleWidget" ]
+}
index baf1850..e29705a 100644 (file)
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
 class QWindowsPrinterSupportPlugin : public QPlatformPrinterSupportPlugin
 {
     Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.QPlatformPrinterSupportFactoryInterface" FILE "windows.json")
+
 public:
     QStringList keys() const;
     QPlatformPrinterSupport *create(const QString &);
@@ -67,8 +69,6 @@ QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key
     return 0;
 }
 
-Q_EXPORT_PLUGIN2(windowsprint, QWindowsPrinterSupportPlugin)
-
 QT_END_NAMESPACE
 
 #include "main.moc"
diff --git a/src/plugins/printsupport/windows/windows.json b/src/plugins/printsupport/windows/windows.json
new file mode 100644 (file)
index 0000000..8030528
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "Keys": [ "windowsprintsupport" ]
+}
index 2032125..97d90a6 100644 (file)
@@ -15,6 +15,8 @@ SOURCES += \
 HEADERS += \
     qwindowsprintersupport.h
 
+OTHER_FILES += windows.json
+
 target.path += $$[QT_INSTALL_PLUGINS]/printsupport
 INSTALLS += target
 LIBS += -lWinspool -lComdlg32