update plugins api version

Change-Id: Ifa977978f2ba7cc5795e7f1a10a1b9fe9c6e9923
This commit is contained in:
石博文 2017-10-23 11:53:44 +08:00
parent 363fa90e12
commit 137ac55518
Notes: Deepin Code Review 2017-10-23 11:58:26 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Mon, 23 Oct 2017 11:58:26 +0800
Reviewed-on: https://cr.deepin.io/27299
Project: dde/dde-dock
Branch: refs/heads/master
8 changed files with 16 additions and 2 deletions

View File

@ -27,6 +27,8 @@
#include <QDebug>
#include <QDir>
#define API_VERSION "1.0"
DockPluginsController::DockPluginsController(DockItemController *itemControllerInter)
: QObject(itemControllerInter),
m_itemControllerInter(itemControllerInter)
@ -136,9 +138,14 @@ void DockPluginsController::positionChanged()
void DockPluginsController::loadPlugin(const QString &pluginFile)
{
qDebug() << "load plugin: " << pluginFile;
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile, this);
const auto meta = pluginLoader->metaData().value("MetaData").toObject();
if (!meta.contains("api") || meta["api"].toString() != API_VERSION)
{
qWarning() << "plugin api version not matched!" << pluginFile;
return;
}
PluginsItemInterface *interface = qobject_cast<PluginsItemInterface *>(pluginLoader->instance());
if (!interface)
{

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}

View File

@ -1,2 +1,3 @@
{
"api": "1.0"
}