修改版本号机制,修改插件版本校验机制。
This commit is contained in:
parent
6009d862ca
commit
cb1201a283
|
@ -2,7 +2,7 @@ QT += core gui dbus KWindowSystem xml x11extras
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
VERSION = 1.0.0
|
VERSION = 2.2.3
|
||||||
DEFINES += VERSION='\\"$${VERSION}\\"'
|
DEFINES += VERSION='\\"$${VERSION}\\"'
|
||||||
TARGET = ukui-search
|
TARGET = ukui-search
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
QT += core xml widgets dbus concurrent sql
|
QT += core xml widgets dbus concurrent sql
|
||||||
VERSION = 1.1.0
|
VERSION = 2.2.3
|
||||||
DEFINES += VERSION='\\"$${VERSION}\\"'
|
DEFINES += VERSION='\\"$${VERSION}\\"'
|
||||||
|
|
||||||
TARGET = ukui-search
|
TARGET = ukui-search
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef SEARCHPLUGINIFACE_H
|
#ifndef SEARCHPLUGINIFACE_H
|
||||||
#define SEARCHPLUGINIFACE_H
|
#define SEARCHPLUGINIFACE_H
|
||||||
#define SearchPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchPluginInterface"
|
#define SearchPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchPluginInterface"
|
||||||
|
#define SEARCH_PLUGIN_IFACE_VERSION "1.1.0"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef SEARCHTASKPLUGINIFACE_H
|
#ifndef SEARCHTASKPLUGINIFACE_H
|
||||||
#define SEARCHTASKPLUGINIFACE_H
|
#define SEARCHTASKPLUGINIFACE_H
|
||||||
#define SearchTaskPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchTaskPluginIface"
|
#define SearchTaskPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchTaskPluginIface"
|
||||||
|
#define SEARCH_TASK_PLUGIN_IFACE_VERSION "1.0.0"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
|
@ -31,9 +31,20 @@ PluginManager::PluginManager(QObject *parent) : QObject(parent)
|
||||||
Q_FOREACH(QString fileName, pluginsDir.entryList(QDir::Files)) {
|
Q_FOREACH(QString fileName, pluginsDir.entryList(QDir::Files)) {
|
||||||
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
|
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
|
||||||
// version check
|
// version check
|
||||||
|
QString type = pluginLoader.metaData().value("MetaData").toObject().value("type").toString();
|
||||||
QString version = pluginLoader.metaData().value("MetaData").toObject().value("version").toString();
|
QString version = pluginLoader.metaData().value("MetaData").toObject().value("version").toString();
|
||||||
if (version != VERSION) {
|
if(type == "SEARCH_PLUGIN") {
|
||||||
qWarning() << "Plugin version check failed:" << fileName << "version," << "iface version : " << VERSION;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue