Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use new plugin system in QtDeclarative.
- Use prefix "org.qt-project" for interfaces.
- Use new macros, add json files.

Change-Id: I53df83f95153c5c9c462098584606284470a5ae0
Reviewed-by: Martin Jones <martin.jones@nokia.com>
  • Loading branch information
Friedemann Kleint authored and Qt by Nokia committed Feb 23, 2012
1 parent dc31651 commit fb3889a
Show file tree
Hide file tree
Showing 55 changed files with 101 additions and 55 deletions.
Expand Up @@ -87,6 +87,7 @@ class ColorImageProvider : public QDeclarativeImageProvider
class ImageProviderExtensionPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "imageprovider.json")
public:
void registerTypes(const char *uri)
{
Expand All @@ -101,7 +102,8 @@ class ImageProviderExtensionPlugin : public QDeclarativeExtensionPlugin

};

#include "imageprovider.moc"

Q_EXPORT_PLUGIN(ImageProviderExtensionPlugin);
#define QDeclarativeExtensionInterface_iid "org.qt-project.Qt.QDeclarativeExtensionInterface"


#include "imageprovider.moc"
@@ -0,0 +1 @@
{}
Expand Up @@ -7,6 +7,8 @@ TARGET = qmlimageproviderplugin

SOURCES += imageprovider.cpp

OTHER_FILES += imageprovider.json

sources.files = $$SOURCES imageprovider.qml imageprovider.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative/imageprovider

Expand Down
6 changes: 2 additions & 4 deletions examples/declarative/cppextensions/plugins/plugin.cpp
Expand Up @@ -141,6 +141,8 @@ MinuteTimer *TimeModel::timer=0;
class QExampleQmlPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "plugin.json")

public:
void registerTypes(const char *uri)
{
Expand All @@ -151,7 +153,3 @@ class QExampleQmlPlugin : public QDeclarativeExtensionPlugin
//![plugin]

#include "plugin.moc"

//![export]
Q_EXPORT_PLUGIN2(qmlqtimeexampleplugin, QExampleQmlPlugin);
//![export]
1 change: 1 addition & 0 deletions examples/declarative/cppextensions/plugins/plugin.json
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions examples/declarative/cppextensions/plugins/plugins.pro
Expand Up @@ -7,6 +7,8 @@ TARGET = qmlqtimeexampleplugin

SOURCES += plugin.cpp

OTHER_FILES += "plugin.json"

qdeclarativesources.files += \
com/nokia/TimeExample/qmldir \
com/nokia/TimeExample/center.png \
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/cppextensions/qwidgets/qwidgets.json
@@ -0,0 +1 @@
{}
Expand Up @@ -46,11 +46,10 @@
class TextBalloonPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "textballoon.json")
public:
void registerTypes(const char *uri)
{
qmlRegisterType<TextBalloon>(uri, 1, 0, "TextBalloon");
}
};

Q_EXPORT_PLUGIN2(qmltextballoonplugin, TextBalloonPlugin);
@@ -0,0 +1 @@
{}
Expand Up @@ -9,6 +9,8 @@ HEADERS += TextBalloonPlugin/plugin.h \

SOURCES += textballoon.cpp

OTHER_FILES += textballoon.json

DESTDIR = TextBalloonPlugin

qdeclarativesources.files += \
Expand Down
Expand Up @@ -49,6 +49,5 @@ void ChartsPlugin::registerTypes(const char *uri)
qmlRegisterType<PieSlice>(uri, 1, 0, "PieSlice");
}

Q_EXPORT_PLUGIN2(chartsplugin, ChartsPlugin);
//![0]

Expand Up @@ -46,6 +46,8 @@
class ChartsPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "chartsplugin.json")

public:
void registerTypes(const char *uri);
};
Expand Down
@@ -0,0 +1 @@
{}
Expand Up @@ -49,6 +49,3 @@ void DialogPlugin::registerTypes(const char *uri)
qmlRegisterType<Directory>(uri, 1, 0, "Directory");
qmlRegisterType<File>(uri,1,0,"File");
}

//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs
Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin);
Expand Up @@ -46,6 +46,7 @@
class DialogPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "dialogplugin.json")

public:
//registerTypes is inherited from QDeclarativeExtensionPlugin
Expand Down
@@ -0,0 +1 @@
{}
Expand Up @@ -75,7 +75,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugServerConnection
virtual bool waitForMessage() = 0;
};

Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, "com.trolltech.Qt.QDeclarativeDebugServerConnection/1.0")
#define QDeclarativeDebugServerConnection_iid "org.qt-project.Qt.QDeclarativeDebugServerConnection"

Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, QDeclarativeDebugServerConnection_iid)

QT_END_NAMESPACE

Expand Down
4 changes: 3 additions & 1 deletion src/declarative/debugger/qdeclarativeinspectorinterface_p.h
Expand Up @@ -74,7 +74,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeInspectorInterface
virtual void clientMessage(const QByteArray &message) = 0;
};

Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, "com.trolltech.Qt.QDeclarativeInspectorInterface/1.0")
#define QDeclarativeInspectorInterface_iid "org.qt-project.Qt."

Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, QDeclarativeInspectorInterface_iid)

QT_END_NAMESPACE

Expand Down
7 changes: 6 additions & 1 deletion src/declarative/qml/qdeclarativeextensioninterface.h
Expand Up @@ -65,8 +65,13 @@ class Q_DECLARATIVE_EXPORT QDeclarativeExtensionInterface : public QDeclarativeT
virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri) = 0;
};

#define QDeclarativeTypesExtensionInterface_iid "org.qt-project.Qt.QDeclarativeTypesExtensionInterface"

Q_DECLARE_INTERFACE(QDeclarativeTypesExtensionInterface, "org.qt-project.Qt.QDeclarativeTypesExtensionInterface/1.0")
Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, "org.qt-project.Qt.QDeclarativeExtensionInterface/1.0")

#define QDeclarativeExtensionInterface_iid "org.qt-project.Qt.QDeclarativeExtensionInterface"

Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, QDeclarativeExtensionInterface_iid)

QT_END_NAMESPACE

Expand Down
5 changes: 4 additions & 1 deletion src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h
Expand Up @@ -66,7 +66,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueInterceptor
virtual void setTarget(const QDeclarativeProperty &property) = 0;
virtual void write(const QVariant &value) = 0;
};
Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, "com.trolltech.qml.QDeclarativePropertyValueInterceptor")

#define QDeclarativePropertyValueInterceptor_iid "org.qt-project.Qt.QDeclarativePropertyValueInterceptor"

Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, QDeclarativePropertyValueInterceptor_iid)

QT_END_NAMESPACE

Expand Down
5 changes: 4 additions & 1 deletion src/declarative/qml/qdeclarativepropertyvaluesource.h
Expand Up @@ -57,7 +57,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueSource
virtual ~QDeclarativePropertyValueSource();
virtual void setTarget(const QDeclarativeProperty &) = 0;
};
Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, "com.trolltech.qml.QDeclarativePropertyValueSource")

#define QDeclarativePropertyValueSource_iid "org.qt-project.Qt.QDeclarativePropertyValueSource"

Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, QDeclarativePropertyValueSource_iid)

QT_END_NAMESPACE

Expand Down
1 change: 1 addition & 0 deletions src/imports/folderlistmodel/folderlistmodel.json
@@ -0,0 +1 @@
{}
7 changes: 2 additions & 5 deletions src/imports/folderlistmodel/plugin.cpp
Expand Up @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
class QmlFolderListModelPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "folderlistmodel.json")

public:
virtual void registerTypes(const char *uri)
{
Expand All @@ -64,8 +66,3 @@ class QmlFolderListModelPlugin : public QDeclarativeExtensionPlugin
QT_END_NAMESPACE

#include "plugin.moc"

//![plugin export decl]
Q_EXPORT_PLUGIN2(qmlfolderlistmodelplugin, QT_PREPEND_NAMESPACE(QmlFolderListModelPlugin));
//![plugin export decl]

1 change: 1 addition & 0 deletions src/imports/gestures/gestures.json
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions src/imports/localstorage/localstorage.json
@@ -0,0 +1 @@
{}
4 changes: 3 additions & 1 deletion src/imports/localstorage/localstorage.pro
Expand Up @@ -6,10 +6,12 @@ QT += sql declarative declarative-private v8-private core-private

SOURCES += plugin.cpp

OTHER_FILES += localstorage.json

DESTDIR = $$QT.declarative.imports/$$TARGETPATH
target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH

qmldir.files += $$PWD/qmldir
qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH

INSTALLS += target qmldir
INSTALLS += target qmldir
4 changes: 2 additions & 2 deletions src/imports/localstorage/plugin.cpp
Expand Up @@ -651,6 +651,8 @@ static QObject *module_api_factory(QDeclarativeEngine *engine, QJSEngine *script
class QDeclarativeLocalStoragePlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "localstorage.json")

public:
QDeclarativeLocalStoragePlugin()
{
Expand All @@ -664,5 +666,3 @@ class QDeclarativeLocalStoragePlugin : public QDeclarativeExtensionPlugin
};

#include "plugin.moc"

Q_EXPORT_PLUGIN2(plugin, QDeclarativeLocalStoragePlugin);
1 change: 1 addition & 0 deletions src/imports/shaders/shaders.json
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions src/imports/testlib/main.cpp
Expand Up @@ -135,6 +135,8 @@ QT_BEGIN_NAMESPACE
class QTestQmlModule : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "testlib.json")

public:
virtual void registerTypes(const char *uri)
{
Expand All @@ -152,5 +154,3 @@ class QTestQmlModule : public QDeclarativeExtensionPlugin
QT_END_NAMESPACE

#include "main.moc"

Q_EXPORT_PLUGIN2(qmltestplugin, QT_PREPEND_NAMESPACE(QTestQmlModule))
1 change: 1 addition & 0 deletions src/imports/testlib/testlib.json
@@ -0,0 +1 @@
{}
3 changes: 2 additions & 1 deletion src/imports/testlib/testlib.pro
Expand Up @@ -7,7 +7,8 @@ CONFIG += qt plugin
QT += declarative quick qmltest qmltest-private v8-private declarative-private core-private testlib

SOURCES += main.cpp
HEADERS +=

OTHER_FILES += testlib.json

DESTDIR = $$QT.declarative.imports/$$TARGETPATH

Expand Down
4 changes: 2 additions & 2 deletions src/imports/xmllistmodel/plugin.cpp
Expand Up @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE
class QmlXmlListModelPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "xmllistmodel.json")

public:
virtual void registerTypes(const char *uri)
{
Expand All @@ -61,5 +63,3 @@ class QmlXmlListModelPlugin : public QDeclarativeExtensionPlugin
QT_END_NAMESPACE

#include "plugin.moc"

Q_EXPORT_PLUGIN2(qmlxmllistmodelplugin, QT_PREPEND_NAMESPACE(QmlXmlListModelPlugin));
1 change: 1 addition & 0 deletions src/imports/xmllistmodel/xmllistmodel.json
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions src/plugins/accessible/quick/accessible.json
@@ -0,0 +1,3 @@
{
"Keys": [ "QQuickView", "QQuickItem" ]
}
8 changes: 5 additions & 3 deletions src/plugins/accessible/quick/main.cpp
Expand Up @@ -59,6 +59,9 @@ QT_BEGIN_NAMESPACE

class AccessibleQuickFactory : public QAccessiblePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QAccessibleFactoryInterface" FILE "accessible.json")

public:
AccessibleQuickFactory();

Expand Down Expand Up @@ -105,9 +108,8 @@ QAccessibleInterface *AccessibleQuickFactory::create(const QString &classname, Q
return 0;
}

Q_EXPORT_STATIC_PLUGIN(AccessibleQuickFactory)
Q_EXPORT_PLUGIN2(qtaccessiblequick, AccessibleQuickFactory)

QT_END_NAMESPACE

#include "main.moc"

#endif // QT_NO_ACCESSIBILITY
2 changes: 2 additions & 0 deletions src/plugins/accessible/quick/quick.pro
Expand Up @@ -19,5 +19,7 @@ SOURCES += \
HEADERS += \
qaccessiblequickview.h \
qaccessiblequickitem.h

OTHERFILES += accessible.json
}

2 changes: 2 additions & 0 deletions src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro
Expand Up @@ -27,5 +27,7 @@ HEADERS += \
../shared/qdeclarativeinspectorprotocol.h \
../shared/qmlinspectorconstants.h

OTHER_FILES += qtquick2plugin.json

target.path += $$[QT_INSTALL_PLUGINS]/qmltooling
INSTALLS += target
2 changes: 0 additions & 2 deletions src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp
Expand Up @@ -84,5 +84,3 @@ void QtQuick2Plugin::clientMessage(const QByteArray &message)

} // namespace QtQuick2
} // namespace QmlJSDebugger

Q_EXPORT_PLUGIN2(qmldbg_qtquick2, QmlJSDebugger::QtQuick2::QtQuick2Plugin)
1 change: 1 addition & 0 deletions src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h
Expand Up @@ -55,6 +55,7 @@ class QtQuick2Plugin : public QObject, public QDeclarativeInspectorInterface
{
Q_OBJECT
Q_DISABLE_COPY(QtQuick2Plugin)
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeInspectorInterface" FILE "qtquick2plugin.json")
Q_INTERFACES(QDeclarativeInspectorInterface)

public:
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.json
@@ -0,0 +1,2 @@
{}

2 changes: 2 additions & 0 deletions src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro
Expand Up @@ -14,5 +14,7 @@ SOURCES += \
HEADERS += \
qtcpserverconnection.h

OTHER_FILES += qtcpserverconnection.json

target.path += $$[QT_INSTALL_PLUGINS]/qmltooling
INSTALLS += target
2 changes: 0 additions & 2 deletions src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
Expand Up @@ -193,7 +193,5 @@ void QTcpServerConnection::invalidPacket()
qWarning("QDeclarativeDebugServer: Received a corrupted packet! Giving up ...");
}

Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection)

QT_END_NAMESPACE

2 changes: 1 addition & 1 deletion src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h
Expand Up @@ -54,9 +54,9 @@ class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConne
Q_OBJECT
Q_DECLARE_PRIVATE(QTcpServerConnection)
Q_DISABLE_COPY(QTcpServerConnection)
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeDebugServerConnection" FILE "qtcpserverconnection.json")
Q_INTERFACES(QDeclarativeDebugServerConnection)


public:
QTcpServerConnection();
~QTcpServerConnection();
Expand Down
@@ -0,0 +1 @@
{}
4 changes: 3 additions & 1 deletion src/quick/items/qquickvisualadaptormodel_p.h
Expand Up @@ -121,7 +121,9 @@ class QQuickVisualAdaptorModelProxyInterface
virtual QObject *proxiedObject() = 0;
};

Q_DECLARE_INTERFACE(QQuickVisualAdaptorModelProxyInterface, "com.trolltech.qml.QQuickVisualAdaptorModelProxyInterface")
#define QQuickVisualAdaptorModelProxyInterface_iid "org.qt-project.Qt.QQuickVisualAdaptorModelProxyInterface"

Q_DECLARE_INTERFACE(QQuickVisualAdaptorModelProxyInterface, QQuickVisualAdaptorModelProxyInterface_iid)

QT_END_NAMESPACE

Expand Down
2 changes: 1 addition & 1 deletion src/quick/scenegraph/qsgcontextplugin_p.h
Expand Up @@ -62,7 +62,7 @@ struct Q_QUICK_EXPORT QSGContextFactoryInterface : public QFactoryInterface
};

#define QSGContextFactoryInterface_iid \
"com.trolltech.Qt.QSGContextFactoryInterface"
"org.qt-project.Qt.QSGContextFactoryInterface"
Q_DECLARE_INTERFACE(QSGContextFactoryInterface, QSGContextFactoryInterface_iid)

class Q_QUICK_EXPORT QSGContextPlugin : public QObject, public QSGContextFactoryInterface
Expand Down
3 changes: 2 additions & 1 deletion tests/auto/declarative/qdeclarativelanguage/testtypes.h
Expand Up @@ -67,7 +67,8 @@ class MyInterface
};

QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface");
#define MyInterface_iid "org.qt-project.Qt.Test.MyInterface"
Q_DECLARE_INTERFACE(MyInterface, MyInterface_iid);
QT_END_NAMESPACE
QML_DECLARE_INTERFACE(MyInterface);

Expand Down

0 comments on commit fb3889a

Please sign in to comment.