diff --git a/Architecture.dox b/Architecture.dox --- a/Architecture.dox +++ b/Architecture.dox @@ -145,10 +145,6 @@ Q_INTERFACES( IMyInterface ) \endcode to one's class declaration. -- Use KDEV_USE_EXTENSION_INTERFACE macro in the constructor of the plugin: - \code - KDEV_USE_EXTENSION_INTERFACE( IMyInterface ) - \endcode - Add the following to the plugin's .desktop file: \code X-KDevelop-Interfaces=IMyInterface @@ -165,7 +161,6 @@ public: MyPlugin(QObject* parent) : IPlugin( parent ) { - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IMyInterface ) } }; \endcode diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ set(KDEVPLATFORM_VERSION_PATCH 3) # plugin versions listed in the .desktop files -set(KDEV_PLUGIN_VERSION 26) +set(KDEV_PLUGIN_VERSION 27) # Increase this to reset incompatible item-repositories set(KDEV_ITEMREPOSITORY_VERSION 86) diff --git a/interfaces/iplugin.h b/interfaces/iplugin.h --- a/interfaces/iplugin.h +++ b/interfaces/iplugin.h @@ -39,8 +39,7 @@ * Call this macro for all interfaces your plugin implements in its constructor */ #define KDEV_USE_EXTENSION_INTERFACE(Extension) \ - addExtension(QByteArray::fromRawData(qobject_interface_iid(), \ - static_cast(strlen(qobject_interface_iid())))); + _Pragma("message(\"Using deprecated function: KDEV_USE_EXTENSION_INTERFACE. Just remove the use of it.\")") namespace KDevelop { @@ -163,16 +162,15 @@ */ Q_SCRIPTABLE ICore *core() const; - Q_SCRIPTABLE QVector extensions() const; - - template Extension* extension() + /** + * Convenience API to access an interface inherited by this plugin + * + * @return Instance to the specified interface, or nullptr + */ + template + inline Extension* extension() { - const auto extensionIID = QByteArray::fromRawData(qobject_interface_iid(), - static_cast(strlen(qobject_interface_iid()))); - if (extensions().contains(extensionIID)) { - return qobject_cast(this); - } - return nullptr; + return qobject_cast(this); } /** @@ -268,8 +266,6 @@ virtual ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent); protected: - void addExtension( const QByteArray& ); - /** * Initialize the XML GUI State. */ diff --git a/interfaces/iplugin.cpp b/interfaces/iplugin.cpp --- a/interfaces/iplugin.cpp +++ b/interfaces/iplugin.cpp @@ -77,7 +77,6 @@ IPlugin *q; ICore *core; - QVector m_extensions; QString m_errorDescription; }; @@ -132,16 +131,6 @@ } -QVector KDevelop::IPlugin::extensions( ) const -{ - return d->m_extensions; -} - -void KDevelop::IPlugin::addExtension( const QByteArray& ext ) -{ - d->m_extensions << ext; -} - KDevelop::ContextMenuExtension KDevelop::IPlugin::contextMenuExtension( KDevelop::Context* ) { diff --git a/plugins/appwizard/appwizardplugin.cpp b/plugins/appwizard/appwizardplugin.cpp --- a/plugins/appwizard/appwizardplugin.cpp +++ b/plugins/appwizard/appwizardplugin.cpp @@ -67,7 +67,6 @@ : KDevelop::IPlugin(QStringLiteral("kdevappwizard"), parent) , m_templatesModel(nullptr) { - KDEV_USE_EXTENSION_INTERFACE(KDevelop::ITemplateProvider); setXMLFile(QStringLiteral("kdevappwizard.rc")); m_newFromTemplate = actionCollection()->addAction(QStringLiteral("project_new")); diff --git a/plugins/bazaar/bazaarplugin.cpp b/plugins/bazaar/bazaarplugin.cpp --- a/plugins/bazaar/bazaarplugin.cpp +++ b/plugins/bazaar/bazaarplugin.cpp @@ -53,9 +53,6 @@ return; } - KDEV_USE_EXTENSION_INTERFACE(KDevelop::IBasicVersionControl) - KDEV_USE_EXTENSION_INTERFACE(KDevelop::IDistributedVersionControl) - setObjectName(QStringLiteral("Bazaar")); } diff --git a/plugins/contextbrowser/contextbrowser.cpp b/plugins/contextbrowser/contextbrowser.cpp --- a/plugins/contextbrowser/contextbrowser.cpp +++ b/plugins/contextbrowser/contextbrowser.cpp @@ -294,8 +294,6 @@ , m_nextHistoryIndex(0) , m_textHintProvider(this) { - KDEV_USE_EXTENSION_INTERFACE( IContextBrowser ) - core()->uiController()->addToolView(i18n("Code Browser"), m_viewFactory); connect( core()->documentController(), &IDocumentController::textDocumentCreated, this, &ContextBrowserPlugin::textDocumentCreated ); diff --git a/plugins/cvs/cvsplugin.cpp b/plugins/cvs/cvsplugin.cpp --- a/plugins/cvs/cvsplugin.cpp +++ b/plugins/cvs/cvsplugin.cpp @@ -88,9 +88,6 @@ : KDevelop::IPlugin(QStringLiteral("kdevcvs"), parent) , d(new CvsPluginPrivate(this)) { - KDEV_USE_EXTENSION_INTERFACE(KDevelop::IBasicVersionControl) - KDEV_USE_EXTENSION_INTERFACE(KDevelop::ICentralizedVersionControl) - core()->uiController()->addToolView(i18n("CVS"), d->m_factory); setXMLFile(QStringLiteral("kdevcvs.rc")); diff --git a/plugins/execute/executeplugin.cpp b/plugins/execute/executeplugin.cpp --- a/plugins/execute/executeplugin.cpp +++ b/plugins/execute/executeplugin.cpp @@ -65,7 +65,6 @@ ExecutePlugin::ExecutePlugin(QObject *parent, const QVariantList&) : KDevelop::IPlugin(QStringLiteral("kdevexecute"), parent) { - KDEV_USE_EXTENSION_INTERFACE( IExecutePlugin ) m_configType = new NativeAppConfigType(); m_configType->addLauncher( new NativeAppLauncher() ); qCDebug(PLUGIN_EXECUTE) << "adding native app launch config"; diff --git a/plugins/executescript/executescriptplugin.cpp b/plugins/executescript/executescriptplugin.cpp --- a/plugins/executescript/executescriptplugin.cpp +++ b/plugins/executescript/executescriptplugin.cpp @@ -62,7 +62,6 @@ ExecuteScriptPlugin::ExecuteScriptPlugin(QObject *parent, const QVariantList&) : KDevelop::IPlugin(QStringLiteral("kdevexecutescript"), parent) { - KDEV_USE_EXTENSION_INTERFACE( IExecuteScriptPlugin ) m_configType = new ScriptAppConfigType(); m_configType->addLauncher( new ScriptAppLauncher( this ) ); qCDebug(PLUGIN_EXECUTESCRIPT) << "adding script launch config"; diff --git a/plugins/filetemplates/filetemplatesplugin.cpp b/plugins/filetemplates/filetemplatesplugin.cpp --- a/plugins/filetemplates/filetemplatesplugin.cpp +++ b/plugins/filetemplates/filetemplatesplugin.cpp @@ -61,7 +61,6 @@ , m_model(nullptr) { Q_UNUSED(args); - KDEV_USE_EXTENSION_INTERFACE(ITemplateProvider) setXMLFile(QStringLiteral("kdevfiletemplates.rc")); QAction* action = actionCollection()->addAction(QStringLiteral("new_from_template")); diff --git a/plugins/git/gitplugin.cpp b/plugins/git/gitplugin.cpp --- a/plugins/git/gitplugin.cpp +++ b/plugins/git/gitplugin.cpp @@ -185,10 +185,6 @@ return; } - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IBasicVersionControl ) - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IDistributedVersionControl ) - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IBranchingVersionControl ) - setObjectName(QStringLiteral("Git")); DVcsJob* versionJob = new DVcsJob(QDir::tempPath(), this, KDevelop::OutputJob::Silent); diff --git a/plugins/openwith/openwithplugin.cpp b/plugins/openwith/openwithplugin.cpp --- a/plugins/openwith/openwithplugin.cpp +++ b/plugins/openwith/openwithplugin.cpp @@ -91,7 +91,6 @@ : IPlugin ( QStringLiteral("kdevopenwith"), parent ), m_actionMap( nullptr ) { - KDEV_USE_EXTENSION_INTERFACE( IOpenWith ) } OpenWithPlugin::~OpenWithPlugin() diff --git a/plugins/patchreview/patchreview.cpp b/plugins/patchreview/patchreview.cpp --- a/plugins/patchreview/patchreview.cpp +++ b/plugins/patchreview/patchreview.cpp @@ -513,9 +513,8 @@ PatchReviewPlugin::PatchReviewPlugin( QObject *parent, const QVariantList & ) : KDevelop::IPlugin( QStringLiteral("kdevpatchreview"), parent ), - m_patch( nullptr ), m_factory( new PatchReviewToolViewFactory( this ) ) { - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IPatchReview ) - KDEV_USE_EXTENSION_INTERFACE( KDevelop::ILanguageSupport ) + m_patch( nullptr ), m_factory( new PatchReviewToolViewFactory( this ) ) +{ qRegisterMetaType( "const Diff2::DiffModel*" ); setXMLFile( QStringLiteral("kdevpatchreview.rc") ); diff --git a/plugins/perforce/perforceplugin.cpp b/plugins/perforce/perforceplugin.cpp --- a/plugins/perforce/perforceplugin.cpp +++ b/plugins/perforce/perforceplugin.cpp @@ -129,10 +129,6 @@ m_perforceConfigName = tmp; } qCDebug(PLUGIN_PERFORCE) << "The value of P4CONFIG is : " << tmp; - - KDEV_USE_EXTENSION_INTERFACE(KDevelop::IBasicVersionControl) - KDEV_USE_EXTENSION_INTERFACE(KDevelop::ICentralizedVersionControl) - } PerforcePlugin::~PerforcePlugin() diff --git a/plugins/projectfilter/projectfilterprovider.cpp b/plugins/projectfilter/projectfilterprovider.cpp --- a/plugins/projectfilter/projectfilterprovider.cpp +++ b/plugins/projectfilter/projectfilterprovider.cpp @@ -49,8 +49,6 @@ ProjectFilterProvider::ProjectFilterProvider( QObject* parent, const QVariantList& /*args*/ ) : IPlugin( QStringLiteral( "kdevprojectfilter" ), parent ) { - KDEV_USE_EXTENSION_INTERFACE( IProjectFilterProvider ) - connect(core()->projectController(), &IProjectController::projectClosing, this, &ProjectFilterProvider::projectClosing); connect(core()->projectController(), &IProjectController::projectAboutToBeOpened, diff --git a/plugins/quickopen/quickopenplugin.cpp b/plugins/quickopen/quickopenplugin.cpp --- a/plugins/quickopen/quickopenplugin.cpp +++ b/plugins/quickopen/quickopenplugin.cpp @@ -344,7 +344,6 @@ : KDevelop::IPlugin(QStringLiteral("kdevquickopen"), parent) { staticQuickOpenPlugin = this; - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IQuickOpen ) m_model = new QuickOpenModel( nullptr ); KConfigGroup quickopengrp = KSharedConfig::openConfig()->group("QuickOpen"); diff --git a/plugins/standardoutputview/standardoutputview.cpp b/plugins/standardoutputview/standardoutputview.cpp --- a/plugins/standardoutputview/standardoutputview.cpp +++ b/plugins/standardoutputview/standardoutputview.cpp @@ -66,8 +66,6 @@ StandardOutputView::StandardOutputView(QObject *parent, const QVariantList &) : KDevelop::IPlugin(QStringLiteral("kdevstandardoutputview"), parent) { - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IOutputView ) - setXMLFile(QStringLiteral("kdevstandardoutputview.rc")); connect(KDevelop::ICore::self()->uiController()->controller(), &Sublime::Controller::aboutToRemoveView, diff --git a/plugins/subversion/kdevsvnplugin.cpp b/plugins/subversion/kdevsvnplugin.cpp --- a/plugins/subversion/kdevsvnplugin.cpp +++ b/plugins/subversion/kdevsvnplugin.cpp @@ -78,9 +78,6 @@ , move_action( nullptr ) , m_jobQueue(new ThreadWeaver::Queue(this)) { - KDEV_USE_EXTENSION_INTERFACE(KDevelop::IBasicVersionControl) - KDEV_USE_EXTENSION_INTERFACE(KDevelop::ICentralizedVersionControl) - qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); diff --git a/project/abstractfilemanagerplugin.cpp b/project/abstractfilemanagerplugin.cpp --- a/project/abstractfilemanagerplugin.cpp +++ b/project/abstractfilemanagerplugin.cpp @@ -438,8 +438,6 @@ IPlugin( componentName, parent ), d(new Private(this)) { - KDEV_USE_EXTENSION_INTERFACE( IProjectFileManager ) - connect(core()->projectController(), &IProjectController::projectClosing, this, [&] (IProject* project) { d->projectClosing(project); }); } diff --git a/shell/tests/nonguiinterfaceplugin.cpp b/shell/tests/nonguiinterfaceplugin.cpp --- a/shell/tests/nonguiinterfaceplugin.cpp +++ b/shell/tests/nonguiinterfaceplugin.cpp @@ -28,7 +28,6 @@ NonGuiInterfacePlugin::NonGuiInterfacePlugin( QObject* parent, const QVariantList& ) : IPlugin( QStringLiteral("kdevnonguiinterfaceplugin"), parent ) { - KDEV_USE_EXTENSION_INTERFACE( ITestNonGuiInterface ) } #include "nonguiinterfaceplugin.moc" diff --git a/shell/tests/test_plugincontroller.cpp b/shell/tests/test_plugincontroller.cpp --- a/shell/tests/test_plugincontroller.cpp +++ b/shell/tests/test_plugincontroller.cpp @@ -19,6 +19,9 @@ #include "test_plugincontroller.h" +#include "nonguiinterfaceplugin.h" +#include "testfilepaths.h" + #include #include #include @@ -30,8 +33,6 @@ #include "../core.h" #include "../plugincontroller.h" -#include "testfilepaths.h" - using namespace KDevelop; void TestPluginController::initTestCase() @@ -94,7 +95,8 @@ { IPlugin* plugin = m_pluginCtrl->pluginForExtension( QStringLiteral("org.kdevelop.ITestNonGuiInterface") ); QVERIFY( plugin ); - QCOMPARE( plugin->extensions(), QVector() << "org.kdevelop.ITestNonGuiInterface" ); + QVERIFY( plugin->inherits("org.kdevelop.ITestNonGuiInterface") ); + QVERIFY( plugin->extension()); } void TestPluginController::benchPluginForExtension() diff --git a/shell/tests/test_projectcontroller.cpp b/shell/tests/test_projectcontroller.cpp --- a/shell/tests/test_projectcontroller.cpp +++ b/shell/tests/test_projectcontroller.cpp @@ -69,13 +69,11 @@ FakeFileManager(QObject*, const QVariantList&) : IPlugin(ICore::self()->aboutData().componentName(), Core::self()) { - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IProjectFileManager ) } FakeFileManager() : IPlugin(ICore::self()->aboutData().componentName(), Core::self()) { - KDEV_USE_EXTENSION_INTERFACE( KDevelop::IProjectFileManager ) } ~FakeFileManager() override {} @@ -148,8 +146,9 @@ IPlugin* pluginForExtension(const QString& extension, const QString& pluginName = {}, const QVariantMap& constraints = QVariantMap()) override { - if (extension == m_fakeFileManager->extensions().at(0)) + if (extension == qobject_interface_iid()) { return m_fakeFileManager; + } return PluginController::pluginForExtension(extension, pluginName, constraints); }