mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
feat: update plugin interface version
add a new function in PluginsItemInterface: pluginSettingsChanged this function is called after DeepinSync completes a synchronization Change-Id: I7c758c27423446c28cab820ddc072680d1eccb6a
This commit is contained in:
parent
aef1fb7f0b
commit
07e8775371
Notes:
gerrit
2019-01-30 18:00:29 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: listenerri <listenerri@gmail.com> Submitted-by: listenerri <listenerri@gmail.com> Submitted-at: Wed, 30 Jan 2019 18:00:28 +0800 Reviewed-on: https://cr.deepin.io/41541 Project: dde/dde-dock Branch: refs/heads/dev/daemon-plugin-settings
@ -26,6 +26,11 @@
|
||||
#include <QDir>
|
||||
#include <QGSettings>
|
||||
|
||||
static const QStringList CompatiblePluginApiList {
|
||||
"1.1.1",
|
||||
DOCK_PLUGIN_API_VERSION
|
||||
};
|
||||
|
||||
AbstractPluginsController::AbstractPluginsController(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_dbusDaemonInterface(QDBusConnection::sessionBus().interface())
|
||||
@ -134,10 +139,14 @@ void AbstractPluginsController::positionChanged()
|
||||
void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
{
|
||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
||||
const auto meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||
if (!meta.contains("api") || meta["api"].toString() != DOCK_PLUGIN_API_VERSION)
|
||||
const QJsonObject &meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||
const QString &pluginApi = meta.value("api").toString();
|
||||
if (pluginApi.isEmpty() || !CompatiblePluginApiList.contains(pluginApi))
|
||||
{
|
||||
qWarning() << objectName() << "plugin api version not matched! expect version:" << DOCK_PLUGIN_API_VERSION << pluginFile;
|
||||
qWarning() << objectName()
|
||||
<< "plugin api version not matched! expect versions:" << CompatiblePluginApiList
|
||||
<< ", got version:" << pluginApi
|
||||
<< ", the plugin file is:" << pluginFile;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -204,7 +213,10 @@ void AbstractPluginsController::refreshPluginSettings()
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: notify all plugins to reload plugin settings
|
||||
// notify all plugins to reload plugin settings
|
||||
for (PluginsItemInterface *pluginInter : m_pluginsMap.keys()) {
|
||||
pluginInter->pluginSettingsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractPluginsController::eventFilter(QObject *o, QEvent *e)
|
||||
|
@ -27,7 +27,7 @@
|
||||
namespace Dock {
|
||||
|
||||
#define DOCK_PLUGIN_MIME "dock/plugin"
|
||||
#define DOCK_PLUGIN_API_VERSION "1.1.1"
|
||||
#define DOCK_PLUGIN_API_VERSION "1.2"
|
||||
|
||||
#define PROP_DISPLAY_MODE "DisplayMode"
|
||||
///
|
||||
|
@ -211,6 +211,12 @@ public:
|
||||
return qApp->property(PROP_POSITION).value<Dock::Position>();
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief settingsChanged
|
||||
/// override this function to receive plugin settings changed signal(DeepinSync)
|
||||
///
|
||||
virtual void pluginSettingsChanged() {}
|
||||
|
||||
protected:
|
||||
///
|
||||
/// \brief m_proxyInter
|
||||
|
Loading…
x
Reference in New Issue
Block a user