diff --git a/frame/controller/dockpluginscontroller.cpp b/frame/controller/dockpluginscontroller.cpp index 08177db8d..ba190698f 100644 --- a/frame/controller/dockpluginscontroller.cpp +++ b/frame/controller/dockpluginscontroller.cpp @@ -27,6 +27,8 @@ #include #include +#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(pluginLoader->instance()); if (!interface) { diff --git a/plugins/datetime/datetime.json b/plugins/datetime/datetime.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/datetime/datetime.json +++ b/plugins/datetime/datetime.json @@ -1,2 +1,3 @@ { + "api": "1.0" } diff --git a/plugins/disk-mount/disk-mount.json b/plugins/disk-mount/disk-mount.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/disk-mount/disk-mount.json +++ b/plugins/disk-mount/disk-mount.json @@ -1,2 +1,3 @@ { + "api": "1.0" } diff --git a/plugins/network/network.json b/plugins/network/network.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/network/network.json +++ b/plugins/network/network.json @@ -1,2 +1,3 @@ { + "api": "1.0" } diff --git a/plugins/shutdown/shutdown.json b/plugins/shutdown/shutdown.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/shutdown/shutdown.json +++ b/plugins/shutdown/shutdown.json @@ -1,2 +1,3 @@ { + "api": "1.0" } diff --git a/plugins/sound/sound.json b/plugins/sound/sound.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/sound/sound.json +++ b/plugins/sound/sound.json @@ -1,2 +1,3 @@ { + "api": "1.0" } diff --git a/plugins/system-tray/system-tray.json b/plugins/system-tray/system-tray.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/system-tray/system-tray.json +++ b/plugins/system-tray/system-tray.json @@ -1,2 +1,3 @@ { + "api": "1.0" } diff --git a/plugins/trash/trash.json b/plugins/trash/trash.json index 2c63c0851..b9b78cb89 100644 --- a/plugins/trash/trash.json +++ b/plugins/trash/trash.json @@ -1,2 +1,3 @@ { + "api": "1.0" }