Commit 4e83fb79 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Port Qt Creator to the new plugin system of Qt 5.



- Add Q_PLUGIN_METADATA for Qt 5, use Q_EXPORT_PLUGIN
  for Qt 4.
- Generate the Json files for Qt 5 from the pluginspec
  files by using a XSLT sheet.

Change-Id: I8653f182ae7d61615971c093df10b84fb06c2172
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@nokia.com>
parent 36effe8c
......@@ -36,6 +36,9 @@
#include "extensionsystem_global.h"
#include <QObject>
#if QT_VERSION >= 0x050000
# include <QtPlugin>
#endif
namespace ExtensionSystem {
......@@ -83,4 +86,16 @@ private:
} // namespace ExtensionSystem
// The macros Q_EXPORT_PLUGIN, Q_EXPORT_PLUGIN2 become obsolete in Qt 5.
#if QT_VERSION >= 0x050000
# if defined(Q_EXPORT_PLUGIN)
# undef Q_EXPORT_PLUGIN
# undef Q_EXPORT_PLUGIN2
# endif
# define Q_EXPORT_PLUGIN(plugin)
# define Q_EXPORT_PLUGIN2(function, plugin)
#else
# define Q_PLUGIN_METADATA(x)
#endif
#endif // IPLUGIN_H
......@@ -95,4 +95,6 @@ void StylePlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
engine->addImageProvider("desktoptheme", new DesktopIconProvider);
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(styleplugin, StylePlugin)
#endif
......@@ -50,6 +50,11 @@
class StylePlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "styleitem.json")
Q_INTERFACES(QDeclarativeExtensionInterface)
#endif
public:
void registerTypes(const char *uri);
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
......
<?xml version="1.0"?>
<!-- XSL sheet to transform Qt Creator's pluginspec files into json files required
for the new Qt 5 plugin system. -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="plugin vendor category description url"/>
<xsl:template match="/">
{
<xsl:apply-templates/>
}
</xsl:template>
<xsl:template match="license"/>
<xsl:template match="dependencyList"/>
<xsl:template match="copyright"/>
<xsl:template match="argumentList"/>
<xsl:template match="vendor">
"Vendor" : "<xsl:apply-templates/>",
</xsl:template>
<xsl:template match="category">
"Category" : "<xsl:apply-templates/>",
</xsl:template>
<xsl:template match="description">
"Description" : "<xsl:apply-templates/>",
</xsl:template>
<xsl:template match="url">
"Url" : "<xsl:apply-templates/>"
</xsl:template>
</xsl:stylesheet>
......@@ -43,6 +43,7 @@ namespace Internal {
class AnalyzerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AnalyzerBase.json")
public:
static AnalyzerPlugin *instance();
......
......@@ -70,6 +70,9 @@ namespace Internal {
class AutotoolsProjectPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AutotoolsProjectManager.json")
public:
AutotoolsProjectPlugin();
......
......@@ -81,6 +81,7 @@ class BazaarEditor;
class BazaarPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bazaar.json")
public:
BazaarPlugin();
......
......@@ -60,6 +60,7 @@ class BinEditorFactory;
class BinEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "BinEditor.json")
public:
BinEditorPlugin();
......
......@@ -59,6 +59,7 @@ class BookmarkManager;
class BookmarksPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bookmarks.json")
public:
BookmarksPlugin();
......
......@@ -46,6 +46,7 @@ namespace Internal {
class Plugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClassView.json")
public:
//! Constructor
......
......@@ -44,6 +44,7 @@ class CMakeProjectPlugin
: public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CMakeProjectManager.json")
public:
CMakeProjectPlugin();
......
......@@ -45,6 +45,7 @@ class MainWindow;
class CorePlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Core.json")
public:
CorePlugin();
......
......@@ -63,6 +63,7 @@ public slots:
class CodepasterPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CodePaster.json")
public:
CodepasterPlugin();
......
......@@ -55,6 +55,7 @@ class CppQuickFixAssistProvider;
class CppPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CppEditor.json")
public:
CppPlugin();
......
......@@ -63,6 +63,7 @@ struct CppFileSettings;
class CppToolsPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CppTools.json")
public:
CppToolsPlugin();
......
......@@ -74,6 +74,7 @@ struct CvsResponse
class CvsPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
public:
CvsPlugin();
......
......@@ -53,6 +53,7 @@ class DebuggerStartParameters;
class DEBUGGER_EXPORT DebuggerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Debugger.json")
public:
DebuggerPlugin();
......
......@@ -41,6 +41,7 @@ namespace Internal {
class FormEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Designer.json")
public:
FormEditorPlugin();
......
......@@ -44,6 +44,7 @@ class FakeVimPluginPrivate;
class FakeVimPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "FakeVim.json")
public:
FakeVimPlugin();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment