From cb1201a2839e095821ba022babafa1b400480296 Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 27 May 2022 09:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A0=A1=E9=AA=8C=E6=9C=BA=E5=88=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/frontend.pro | 2 +- libsearch/libsearch.pro | 2 +- libsearch/plugininterface/search-plugin-iface.h | 1 + .../plugininterface/search-task-plugin-iface.h | 1 + libsearch/pluginmanage/plugin-manager.cpp | 15 +++++++++++++-- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/frontend.pro b/frontend/frontend.pro index 80f9c26..b4fd28a 100644 --- a/frontend/frontend.pro +++ b/frontend/frontend.pro @@ -2,7 +2,7 @@ QT += core gui dbus KWindowSystem xml x11extras greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -VERSION = 1.0.0 +VERSION = 2.2.3 DEFINES += VERSION='\\"$${VERSION}\\"' TARGET = ukui-search TEMPLATE = app diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro index f5aefef..fd86553 100644 --- a/libsearch/libsearch.pro +++ b/libsearch/libsearch.pro @@ -1,5 +1,5 @@ QT += core xml widgets dbus concurrent sql -VERSION = 1.1.0 +VERSION = 2.2.3 DEFINES += VERSION='\\"$${VERSION}\\"' TARGET = ukui-search diff --git a/libsearch/plugininterface/search-plugin-iface.h b/libsearch/plugininterface/search-plugin-iface.h index 2d17ced..a340acd 100644 --- a/libsearch/plugininterface/search-plugin-iface.h +++ b/libsearch/plugininterface/search-plugin-iface.h @@ -1,6 +1,7 @@ #ifndef SEARCHPLUGINIFACE_H #define SEARCHPLUGINIFACE_H #define SearchPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchPluginInterface" +#define SEARCH_PLUGIN_IFACE_VERSION "1.1.0" #include #include diff --git a/libsearch/plugininterface/search-task-plugin-iface.h b/libsearch/plugininterface/search-task-plugin-iface.h index 24ee89f..13d9dc3 100644 --- a/libsearch/plugininterface/search-task-plugin-iface.h +++ b/libsearch/plugininterface/search-task-plugin-iface.h @@ -1,6 +1,7 @@ #ifndef SEARCHTASKPLUGINIFACE_H #define SEARCHTASKPLUGINIFACE_H #define SearchTaskPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchTaskPluginIface" +#define SEARCH_TASK_PLUGIN_IFACE_VERSION "1.0.0" #include #include diff --git a/libsearch/pluginmanage/plugin-manager.cpp b/libsearch/pluginmanage/plugin-manager.cpp index 37f3411..3bbb0c9 100644 --- a/libsearch/pluginmanage/plugin-manager.cpp +++ b/libsearch/pluginmanage/plugin-manager.cpp @@ -31,9 +31,20 @@ PluginManager::PluginManager(QObject *parent) : QObject(parent) Q_FOREACH(QString fileName, pluginsDir.entryList(QDir::Files)) { QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName)); // version check + QString type = pluginLoader.metaData().value("MetaData").toObject().value("type").toString(); QString version = pluginLoader.metaData().value("MetaData").toObject().value("version").toString(); - if (version != VERSION) { - qWarning() << "Plugin version check failed:" << fileName << "version," << "iface version : " << VERSION; + if(type == "SEARCH_PLUGIN") { + if (version != SEARCH_PLUGIN_IFACE_VERSION) { + qWarning() << "SEARCH_PLUGIN version check failed:" << fileName << "version:" << version << "iface version : " << SEARCH_PLUGIN_IFACE_VERSION; + continue; + } + } else if(type == "SEARCH_TASK_PLUGIN") { + if (version != SEARCH_TASK_PLUGIN_IFACE_VERSION) { + qWarning() << "SEARCH_TASK_PLUGIN_IFACE_VERSION version check failed:" << fileName << "version:" << version << "iface version : " << SEARCH_TASK_PLUGIN_IFACE_VERSION; + continue; + } + } else { + qWarning() << "Unsupport plugin:" << fileName << "type:" << type; continue; }