Merge branch 'ukss-dev' into 'ukss-dev'
修改版本号机制,修改插件版本校验机制。 See merge request kylin-desktop/ukui-search!321
This commit is contained in:
commit
36808d7ff6
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <QString>
|
||||
#include <QIcon>
|
||||
|
|
|
@ -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 <QObject>
|
||||
#include <QtPlugin>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue