From 5a022653021c0aa24df40e0cec9bd2c0b1129f20 Mon Sep 17 00:00:00 2001 From: iaom Date: Mon, 14 Mar 2022 16:25:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=8A=A0=E8=BD=BD=E6=97=B6=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/pluginmanage/plugin-manager.cpp | 12 ++++++++++-- libsearch/pluginmanage/search-plugin-manager.cpp | 1 + .../ukui-search-app-data-service.pro | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libsearch/pluginmanage/plugin-manager.cpp b/libsearch/pluginmanage/plugin-manager.cpp index 88ee196..8f127c0 100644 --- a/libsearch/pluginmanage/plugin-manager.cpp +++ b/libsearch/pluginmanage/plugin-manager.cpp @@ -30,9 +30,17 @@ PluginManager::PluginManager(QObject *parent) : QObject(parent) Q_FOREACH(QString fileName, pluginsDir.entryList(QDir::Files)) { QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName)); - // version check - if (pluginLoader.metaData().value("MetaData").toObject().value("version").toString() != VERSION) + if(pluginLoader.isLoaded()) { + // version check + QString version = pluginLoader.metaData().value("MetaData").toObject().value("version").toString(); + if (version != VERSION) { + qWarning() << "Plugin version check failed:" << fileName << "version," << "iface version : " << VERSION; + continue; + } + } else { + qWarning() << "Fail to load fileName"; continue; + } QObject *plugin = pluginLoader.instance(); if (!plugin) diff --git a/libsearch/pluginmanage/search-plugin-manager.cpp b/libsearch/pluginmanage/search-plugin-manager.cpp index 0223ef7..20e759b 100644 --- a/libsearch/pluginmanage/search-plugin-manager.cpp +++ b/libsearch/pluginmanage/search-plugin-manager.cpp @@ -28,6 +28,7 @@ bool SearchPluginManager::registerPlugin(UkuiSearch::SearchPluginIface *plugin) return false; } m_map[plugin->name()] = plugin; + qDebug() << "register search plugin: " << plugin->name(); m_plugin_order[m_plugin_order.size()] = plugin->name();//按注册顺序绑定优先级 return true; } diff --git a/ukui-search-app-data-service/ukui-search-app-data-service.pro b/ukui-search-app-data-service/ukui-search-app-data-service.pro index 12e2a17..df00b1f 100644 --- a/ukui-search-app-data-service/ukui-search-app-data-service.pro +++ b/ukui-search-app-data-service/ukui-search-app-data-service.pro @@ -3,7 +3,7 @@ QT += core gui dbus greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -TARGET = ukui-search-service +TARGET = ukui-search-app-data-service VERSION = 1.0.0 DEFINES += VERSION='\\"$${VERSION}\\"' CONFIG += c++11 link_pkgconfig no_keywords lrelease