mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
feat: 适配v20插件加载
增加适配器,适配v20插件为v23接口,保证能正常加载v20插件 Log: 增加对v20插件的正常适配 Influence: 加载v20插件 Task: https://pms.uniontech.com/task-view-112073.html Change-Id: If0b3c83cc808f62c0b15554fe6d58f90dc376175
This commit is contained in:
parent
9e2e8fb18d
commit
ee248287d3
@ -66,6 +66,7 @@ target_include_directories(${BIN_NAME} PUBLIC
|
||||
item
|
||||
item/components
|
||||
model
|
||||
pluginadapter
|
||||
screenspliter
|
||||
util
|
||||
window
|
||||
|
@ -154,51 +154,53 @@ QString ProxyPluginController::itemKey(PluginsItemInterface *itemInter) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
void ProxyPluginController::itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void ProxyPluginController::pluginItemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
addPluginItems(itemInter, itemKey);
|
||||
if (!addPluginItems(itemInter, itemKey))
|
||||
return;
|
||||
|
||||
// 获取需要加载当前插件的监听者,然后将当前插件添加到监听者
|
||||
QList<AbstractPluginsController *> validController = getValidController(itemInter);
|
||||
for (AbstractPluginsController *interface : validController)
|
||||
interface->itemAdded(itemInter, itemKey);
|
||||
interface->pluginItemAdded(itemInter, itemKey);
|
||||
}
|
||||
|
||||
void ProxyPluginController::itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void ProxyPluginController::pluginItemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
QList<AbstractPluginsController *> validController = getValidController(itemInter);
|
||||
for (AbstractPluginsController *interface : validController)
|
||||
interface->itemUpdate(itemInter, itemKey);
|
||||
interface->pluginItemUpdate(itemInter, itemKey);
|
||||
}
|
||||
|
||||
void ProxyPluginController::itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void ProxyPluginController::pluginItemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
// 先获取可执行的controller,再移除,因为在判断当前插件是否加载的时候需要用到当前容器中的插件来获取当前代理
|
||||
QList<AbstractPluginsController *> validController = getValidController(itemInter);
|
||||
for (AbstractPluginsController *interface : validController)
|
||||
interface->itemRemoved(itemInter, itemKey);
|
||||
interface->pluginItemRemoved(itemInter, itemKey);
|
||||
|
||||
removePluginItem(itemInter);
|
||||
}
|
||||
|
||||
void ProxyPluginController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
void ProxyPluginController::requestPluginWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
{
|
||||
QList<AbstractPluginsController *> validController = getValidController(itemInter);
|
||||
for (AbstractPluginsController *interface : validController)
|
||||
interface->requestWindowAutoHide(itemInter, itemKey, autoHide);
|
||||
interface->requestPluginWindowAutoHide(itemInter, itemKey, autoHide);
|
||||
}
|
||||
|
||||
void ProxyPluginController::requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void ProxyPluginController::requestRefreshPluginWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
QList<AbstractPluginsController *> validController = getValidController(itemInter);
|
||||
for (AbstractPluginsController *interface : validController)
|
||||
interface->requestRefreshWindowVisible(itemInter, itemKey);
|
||||
interface->requestRefreshPluginWindowVisible(itemInter, itemKey);
|
||||
}
|
||||
|
||||
void ProxyPluginController::requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||
void ProxyPluginController::requestSetPluginAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||
{
|
||||
QList<AbstractPluginsController *> validController = getValidController(itemInter);
|
||||
for (AbstractPluginsController *interface : validController)
|
||||
interface->requestSetAppletVisible(itemInter, itemKey, visible);
|
||||
interface->requestSetPluginAppletVisible(itemInter, itemKey, visible);
|
||||
}
|
||||
|
||||
void ProxyPluginController::updateDockInfo(PluginsItemInterface * const itemInter, const DockPart &part)
|
||||
@ -231,13 +233,15 @@ QList<AbstractPluginsController *> ProxyPluginController::getValidController(Plu
|
||||
return validController;
|
||||
}
|
||||
|
||||
void ProxyPluginController::addPluginItems(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
bool ProxyPluginController::addPluginItems(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
if (!m_pluginsItems.contains(itemInter))
|
||||
m_pluginsItems << itemInter;
|
||||
// 如果该插件已经存在,则无需再次插入
|
||||
if (m_pluginsItems.contains(itemInter))
|
||||
return false;
|
||||
|
||||
if (!m_pluginsItemKeys.contains(itemInter))
|
||||
m_pluginsItemKeys[itemInter] = itemKey;
|
||||
m_pluginsItems << itemInter;
|
||||
m_pluginsItemKeys[itemInter] = itemKey;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProxyPluginController::removePluginItem(PluginsItemInterface * const itemInter)
|
||||
|
@ -52,13 +52,13 @@ protected:
|
||||
explicit ProxyPluginController(QObject *parent = nullptr);
|
||||
~ProxyPluginController() override {}
|
||||
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void pluginItemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void pluginItemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void pluginItemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
|
||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
void requestPluginWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||
void requestRefreshPluginWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestSetPluginAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
|
||||
void updateDockInfo(PluginsItemInterface * const itemInter, const DockPart &part) override;
|
||||
|
||||
@ -66,7 +66,7 @@ protected:
|
||||
|
||||
private:
|
||||
QList<AbstractPluginsController *> getValidController(PluginsItemInterface *itemInter) const;
|
||||
void addPluginItems(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
bool addPluginItems(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void removePluginItem(PluginsItemInterface * const itemInter);
|
||||
void startLoader();
|
||||
|
||||
|
@ -36,7 +36,7 @@ QuickSettingController::~QuickSettingController()
|
||||
ProxyPluginController::instance(PluginType::QuickPlugin)->removeProxyInterface(this);
|
||||
}
|
||||
|
||||
void QuickSettingController::itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void QuickSettingController::pluginItemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
// 根据读取到的metaData数据获取当前插件的类型,提供给外部
|
||||
PluginAttribute pluginClass = PluginAttribute::Quick;
|
||||
@ -56,11 +56,7 @@ void QuickSettingController::itemAdded(PluginsItemInterface * const itemInter, c
|
||||
emit pluginInserted(itemInter, pluginClass);
|
||||
}
|
||||
|
||||
void QuickSettingController::itemUpdate(PluginsItemInterface * const itemInter, const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
void QuickSettingController::itemRemoved(PluginsItemInterface * const itemInter, const QString &)
|
||||
void QuickSettingController::pluginItemRemoved(PluginsItemInterface * const itemInter, const QString &)
|
||||
{
|
||||
for (auto it = m_quickPlugins.begin(); it != m_quickPlugins.end(); it++) {
|
||||
QList<PluginsItemInterface *> &plugins = m_quickPlugins[it.key()];
|
||||
|
@ -54,12 +54,13 @@ protected:
|
||||
~QuickSettingController() override;
|
||||
|
||||
protected:
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &) override;
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &) override;
|
||||
void requestWindowAutoHide(PluginsItemInterface * const, const QString &, const bool) override {}
|
||||
void requestRefreshWindowVisible(PluginsItemInterface * const, const QString &) override {}
|
||||
void requestSetAppletVisible(PluginsItemInterface * const, const QString &, const bool) override {}
|
||||
void pluginItemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void pluginItemUpdate(PluginsItemInterface * const itemInter, const QString &) override {}
|
||||
void pluginItemRemoved(PluginsItemInterface * const itemInter, const QString &) override;
|
||||
void requestPluginWindowAutoHide(PluginsItemInterface * const, const QString &, const bool) override {}
|
||||
void requestRefreshPluginWindowVisible(PluginsItemInterface * const, const QString &) override {}
|
||||
void requestSetPluginAppletVisible(PluginsItemInterface * const, const QString &, const bool) override {}
|
||||
|
||||
void updateDockInfo(PluginsItemInterface * const itemInter, const DockPart &part) override;
|
||||
|
||||
private:
|
||||
|
@ -33,7 +33,7 @@ SystemPluginController::SystemPluginController(QObject *parent)
|
||||
setObjectName("SystemTray");
|
||||
}
|
||||
|
||||
void SystemPluginController::itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void SystemPluginController::pluginItemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &mPluginsMap = pluginsMap();
|
||||
|
||||
@ -54,7 +54,7 @@ void SystemPluginController::itemAdded(PluginsItemInterface * const itemInter, c
|
||||
emit pluginItemAdded(itemKey, item);
|
||||
}
|
||||
|
||||
void SystemPluginController::itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void SystemPluginController::pluginItemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
SystemPluginItem *item = static_cast<SystemPluginItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
@ -65,7 +65,7 @@ void SystemPluginController::itemUpdate(PluginsItemInterface * const itemInter,
|
||||
emit pluginItemUpdated(itemKey, item);
|
||||
}
|
||||
|
||||
void SystemPluginController::itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void SystemPluginController::pluginItemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
SystemPluginItem *item = static_cast<SystemPluginItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
@ -85,7 +85,7 @@ void SystemPluginController::itemRemoved(PluginsItemInterface * const itemInter,
|
||||
item->deleteLater();
|
||||
}
|
||||
|
||||
void SystemPluginController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
void SystemPluginController::requestPluginWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
{
|
||||
SystemPluginItem *item = static_cast<SystemPluginItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
@ -94,7 +94,7 @@ void SystemPluginController::requestWindowAutoHide(PluginsItemInterface * const
|
||||
Q_EMIT item->requestWindowAutoHide(autoHide);
|
||||
}
|
||||
|
||||
void SystemPluginController::requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void SystemPluginController::requestRefreshPluginWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
SystemPluginItem *item = static_cast<SystemPluginItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
@ -103,7 +103,7 @@ void SystemPluginController::requestRefreshWindowVisible(PluginsItemInterface *
|
||||
Q_EMIT item->requestRefershWindowVisible();
|
||||
}
|
||||
|
||||
void SystemPluginController::requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||
void SystemPluginController::requestSetPluginAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||
{
|
||||
SystemPluginItem *item = static_cast<SystemPluginItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
@ -146,7 +146,7 @@ const QVariant SystemPluginController::getValueSystemTrayItem(const QString &ite
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
return getValue(inter, key, fallback);
|
||||
return getPluginValue(inter, key, fallback);
|
||||
}
|
||||
|
||||
void SystemPluginController::saveValueSystemTrayItem(const QString &itemKey, const QString &key, const QVariant &value)
|
||||
@ -157,7 +157,7 @@ void SystemPluginController::saveValueSystemTrayItem(const QString &itemKey, con
|
||||
return;
|
||||
}
|
||||
|
||||
saveValue(inter, key, value);
|
||||
savePluginValue(inter, key, value);
|
||||
}
|
||||
|
||||
void SystemPluginController::startLoader()
|
||||
|
@ -42,12 +42,12 @@ public:
|
||||
explicit SystemPluginController(QObject *parent = nullptr);
|
||||
|
||||
// implements PluginProxyInterface
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
void pluginItemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void pluginItemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void pluginItemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestPluginWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||
void requestRefreshPluginWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestSetPluginAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
|
||||
int systemTrayItemSortKey(const QString &itemKey);
|
||||
void setSystemTrayItemSortKey(const QString &itemKey, const int order);
|
||||
|
190
frame/pluginadapter/pluginadapter.cpp
Normal file
190
frame/pluginadapter/pluginadapter.cpp
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pluginadapter.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#define ICONWIDTH 24
|
||||
#define ICONHEIGHT 24
|
||||
|
||||
PluginAdapter::PluginAdapter(PluginsItemInterface_V20 *pluginInter)
|
||||
: m_pluginInter(pluginInter)
|
||||
{
|
||||
}
|
||||
|
||||
PluginAdapter::~PluginAdapter()
|
||||
{
|
||||
delete m_pluginInter;
|
||||
}
|
||||
|
||||
const QString PluginAdapter::pluginName() const
|
||||
{
|
||||
return m_pluginInter->pluginName();
|
||||
}
|
||||
|
||||
const QString PluginAdapter::pluginDisplayName() const
|
||||
{
|
||||
return m_pluginInter->pluginDisplayName();
|
||||
}
|
||||
|
||||
void PluginAdapter::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_pluginInter->init(proxyInter);
|
||||
}
|
||||
|
||||
QWidget *PluginAdapter::itemWidget(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemWidget(itemKey);
|
||||
}
|
||||
|
||||
QWidget *PluginAdapter::itemTipsWidget(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemTipsWidget(itemKey);
|
||||
}
|
||||
|
||||
QWidget *PluginAdapter::itemPopupApplet(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemPopupApplet(itemKey);
|
||||
}
|
||||
|
||||
const QString PluginAdapter::itemCommand(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemCommand(itemKey);
|
||||
}
|
||||
|
||||
const QString PluginAdapter::itemContextMenu(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemContextMenu(itemKey);
|
||||
}
|
||||
|
||||
void PluginAdapter::invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked)
|
||||
{
|
||||
m_pluginInter->invokedMenuItem(itemKey, menuId, checked);
|
||||
}
|
||||
|
||||
int PluginAdapter::itemSortKey(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemSortKey(itemKey);
|
||||
}
|
||||
|
||||
void PluginAdapter::setSortKey(const QString &itemKey, const int order)
|
||||
{
|
||||
m_pluginInter->setSortKey(itemKey, order);
|
||||
}
|
||||
|
||||
bool PluginAdapter::itemAllowContainer(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemAllowContainer(itemKey);
|
||||
}
|
||||
|
||||
bool PluginAdapter::itemIsInContainer(const QString &itemKey)
|
||||
{
|
||||
return m_pluginInter->itemIsInContainer(itemKey);
|
||||
}
|
||||
|
||||
void PluginAdapter::setItemIsInContainer(const QString &itemKey, const bool container)
|
||||
{
|
||||
m_pluginInter->setItemIsInContainer(itemKey, container);
|
||||
}
|
||||
|
||||
bool PluginAdapter::pluginIsAllowDisable()
|
||||
{
|
||||
return m_pluginInter->pluginIsAllowDisable();
|
||||
}
|
||||
|
||||
bool PluginAdapter::pluginIsDisable()
|
||||
{
|
||||
return m_pluginInter->pluginIsDisable();
|
||||
}
|
||||
|
||||
void PluginAdapter::pluginStateSwitched()
|
||||
{
|
||||
m_pluginInter->pluginStateSwitched();
|
||||
}
|
||||
|
||||
void PluginAdapter::displayModeChanged(const Dock::DisplayMode displayMode)
|
||||
{
|
||||
m_pluginInter->displayModeChanged(displayMode);
|
||||
}
|
||||
|
||||
void PluginAdapter::positionChanged(const Dock::Position position)
|
||||
{
|
||||
m_pluginInter->positionChanged(position);
|
||||
}
|
||||
|
||||
void PluginAdapter::refreshIcon(const QString &itemKey)
|
||||
{
|
||||
m_pluginInter->refreshIcon(itemKey);
|
||||
}
|
||||
|
||||
void PluginAdapter::pluginSettingsChanged()
|
||||
{
|
||||
m_pluginInter->pluginSettingsChanged();
|
||||
}
|
||||
|
||||
PluginsItemInterface::PluginType PluginAdapter::type()
|
||||
{
|
||||
switch (m_pluginInter->type()) {
|
||||
case PluginsItemInterface_V20::PluginType::Fixed:
|
||||
return PluginsItemInterface::PluginType::Fixed;
|
||||
case PluginsItemInterface_V20::PluginType::Normal:
|
||||
return PluginsItemInterface::PluginType::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
PluginsItemInterface::PluginSizePolicy PluginAdapter::pluginSizePolicy() const
|
||||
{
|
||||
switch (m_pluginInter->pluginSizePolicy()) {
|
||||
case PluginsItemInterface_V20::PluginSizePolicy::Custom:
|
||||
return PluginsItemInterface::PluginSizePolicy::Custom;
|
||||
case PluginsItemInterface_V20::PluginSizePolicy::System:
|
||||
return PluginsItemInterface::PluginSizePolicy::System;
|
||||
}
|
||||
}
|
||||
|
||||
QIcon PluginAdapter::icon(const DockPart &dockPart)
|
||||
{
|
||||
if (dockPart == DockPart::QuickPanel) {
|
||||
// 如果图标为空,就使用itemWidget的截图作为它的图标,这种一般是适用于老版本插件或者没有实现v23接口的插件
|
||||
QWidget *itemWidget = m_pluginInter->itemWidget(m_itemKey);
|
||||
if (itemWidget) {
|
||||
itemWidget->setFixedSize(ICONWIDTH, ICONHEIGHT);
|
||||
return itemWidget->grab();
|
||||
}
|
||||
}
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
PluginsItemInterface::PluginStatus PluginAdapter::status() const
|
||||
{
|
||||
return PluginStatus::Active;
|
||||
}
|
||||
|
||||
QString PluginAdapter::description() const
|
||||
{
|
||||
return tr("actived");
|
||||
}
|
||||
|
||||
void PluginAdapter::setItemKey(const QString &itemKey)
|
||||
{
|
||||
m_itemKey = itemKey;
|
||||
}
|
78
frame/pluginadapter/pluginadapter.h
Normal file
78
frame/pluginadapter/pluginadapter.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PLUGINADAPTER_H
|
||||
#define PLUGINADAPTER_H
|
||||
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "pluginsiteminterface_v20.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
/** 适配器,当加载到v20插件的时候,通过该接口来转成v23接口的插件
|
||||
* @brief The PluginAdapter class
|
||||
*/
|
||||
|
||||
class PluginAdapter : public QObject, public PluginsItemInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PluginAdapter(PluginsItemInterface_V20 *pluginInter);
|
||||
~PluginAdapter();
|
||||
|
||||
const QString pluginName() const override;
|
||||
const QString pluginDisplayName() const override;
|
||||
void init(PluginProxyInterface *proxyInter) override;
|
||||
QWidget *itemWidget(const QString &itemKey) override;
|
||||
|
||||
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||
QWidget *itemPopupApplet(const QString &itemKey) override;
|
||||
const QString itemCommand(const QString &itemKey) override;
|
||||
const QString itemContextMenu(const QString &itemKey) override;
|
||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||
int itemSortKey(const QString &itemKey) override;
|
||||
void setSortKey(const QString &itemKey, const int order) override;
|
||||
bool itemAllowContainer(const QString &itemKey) override;
|
||||
bool itemIsInContainer(const QString &itemKey) override;
|
||||
void setItemIsInContainer(const QString &itemKey, const bool container) override;
|
||||
|
||||
bool pluginIsAllowDisable() override;
|
||||
bool pluginIsDisable() override;
|
||||
void pluginStateSwitched() override;
|
||||
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
||||
void positionChanged(const Dock::Position position) override;
|
||||
void refreshIcon(const QString &itemKey) override;
|
||||
void pluginSettingsChanged() override;
|
||||
PluginType type() override;
|
||||
PluginSizePolicy pluginSizePolicy() const override;
|
||||
|
||||
QIcon icon(const DockPart &dockPart) override;
|
||||
PluginStatus status() const override;
|
||||
QString description() const override;
|
||||
|
||||
void setItemKey(const QString &itemKey);
|
||||
|
||||
private:
|
||||
PluginsItemInterface_V20 *m_pluginInter;
|
||||
QString m_itemKey;
|
||||
};
|
||||
|
||||
#endif // PLUGINADAPTER_H
|
261
frame/pluginadapter/pluginsiteminterface_v20.h
Normal file
261
frame/pluginadapter/pluginsiteminterface_v20.h
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PLUGINSITEMINTERFACE_V20_H
|
||||
#define PLUGINSITEMINTERFACE_V20_H
|
||||
|
||||
#include "pluginproxyinterface.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QtCore>
|
||||
|
||||
///
|
||||
/// \brief The PluginsItemInterface_V20 class
|
||||
/// the dock plugins item interface, all dock plugins should
|
||||
/// inheirt this class and override all pure virtual function.
|
||||
///
|
||||
class PluginsItemInterface_V20
|
||||
{
|
||||
public:
|
||||
enum PluginType {
|
||||
Normal,
|
||||
Fixed
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Plugin size policy
|
||||
*/
|
||||
enum PluginSizePolicy {
|
||||
System = 1 << 0, // Follow the system
|
||||
Custom = 1 << 1 // The custom
|
||||
};
|
||||
|
||||
///
|
||||
/// \brief ~PluginsItemInterface_V20
|
||||
/// DON'T try to delete m_proxyInter.
|
||||
///
|
||||
virtual ~PluginsItemInterface_V20() {}
|
||||
|
||||
///
|
||||
/// \brief pluginName
|
||||
/// tell dock the unique plugin id
|
||||
/// \return
|
||||
///
|
||||
virtual const QString pluginName() const = 0;
|
||||
virtual const QString pluginDisplayName() const { return QString(); }
|
||||
|
||||
///
|
||||
/// \brief init
|
||||
/// init your plugins, you need to save proxyInter to m_proxyInter
|
||||
/// member variable. but you shouldn't free this pointer.
|
||||
/// \param proxyInter
|
||||
/// DON'T try to delete this pointer.
|
||||
///
|
||||
virtual void init(PluginProxyInterface *proxyInter) = 0;
|
||||
///
|
||||
/// \brief itemWidget
|
||||
/// your plugin item widget, each item should have a unique key.
|
||||
/// \param itemKey
|
||||
/// your widget' unqiue key.
|
||||
/// \return
|
||||
///
|
||||
virtual QWidget *itemWidget(const QString &itemKey) = 0;
|
||||
|
||||
///
|
||||
/// \brief itemTipsWidget
|
||||
/// override this function if your item want to have a tips.
|
||||
/// the tips will shown when user hover your item.
|
||||
/// nullptr will be ignored.
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual QWidget *itemTipsWidget(const QString &itemKey) {Q_UNUSED(itemKey); return nullptr;}
|
||||
///
|
||||
/// \brief itemPopupApplet
|
||||
/// override this function if your item wants to have an popup applet.
|
||||
/// the popup applet will shown when user click your item.
|
||||
///
|
||||
/// Tips:
|
||||
/// dock should receive mouse press/release event to check user mouse operate,
|
||||
/// if your item filter mouse event, this function will not be called.
|
||||
/// so if you override mouse event and want to use popup applet, you
|
||||
/// should pass event to your parent use QWidget::someEvent(e);
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual QWidget *itemPopupApplet(const QString &itemKey) {Q_UNUSED(itemKey); return nullptr;}
|
||||
///
|
||||
/// \brief itemCommand
|
||||
/// execute spec command when user clicked your item.
|
||||
/// ensure your command do not get user input.
|
||||
///
|
||||
/// empty string will be ignored.
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual const QString itemCommand(const QString &itemKey) {Q_UNUSED(itemKey); return QString();}
|
||||
|
||||
///
|
||||
/// \brief itemContextMenu
|
||||
/// context menu is shown when RequestPopupMenu called.
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual const QString itemContextMenu(const QString &itemKey) {Q_UNUSED(itemKey); return QString();}
|
||||
///
|
||||
/// \brief invokedMenuItem
|
||||
/// call if context menu item is clicked
|
||||
/// \param itemKey
|
||||
/// \param itemId
|
||||
/// menu item id
|
||||
/// \param checked
|
||||
///
|
||||
virtual void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) {Q_UNUSED(itemKey); Q_UNUSED(menuId); Q_UNUSED(checked);}
|
||||
|
||||
///
|
||||
/// \brief itemSortKey
|
||||
/// tell dock where your item wants to put on.
|
||||
///
|
||||
/// this index is start from 1 and
|
||||
/// 0 for left side
|
||||
/// -1 for right side
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual int itemSortKey(const QString &itemKey) {Q_UNUSED(itemKey); return 1;}
|
||||
///
|
||||
/// \brief setSortKey
|
||||
/// save your item new position
|
||||
/// sort key will be changed when plugins order
|
||||
/// changed(by user drag-drop)
|
||||
/// \param itemKey
|
||||
/// \param order
|
||||
///
|
||||
virtual void setSortKey(const QString &itemKey, const int order) {Q_UNUSED(itemKey); Q_UNUSED(order);}
|
||||
|
||||
///
|
||||
/// \brief itemAllowContainer
|
||||
/// tell dock is your item allow to move into container
|
||||
///
|
||||
/// if your item placed into container, popup tips and popup
|
||||
/// applet will be disabled.
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual bool itemAllowContainer(const QString &itemKey) {Q_UNUSED(itemKey); return false;}
|
||||
///
|
||||
/// \brief itemIsInContainer
|
||||
/// tell dock your item is in container, this function
|
||||
/// called at item init and if your item enable container.
|
||||
/// \param itemKey
|
||||
/// \return
|
||||
///
|
||||
virtual bool itemIsInContainer(const QString &itemKey) {Q_UNUSED(itemKey); return false;}
|
||||
///
|
||||
/// \brief setItemIsInContainer
|
||||
/// save your item new state.
|
||||
/// this function called when user drag out your item from
|
||||
/// container or user drop item into container(if your item
|
||||
/// allow drop into container).
|
||||
/// \param itemKey
|
||||
/// \param container
|
||||
///
|
||||
virtual void setItemIsInContainer(const QString &itemKey, const bool container) {Q_UNUSED(itemKey); Q_UNUSED(container);}
|
||||
|
||||
virtual bool pluginIsAllowDisable() { return false; }
|
||||
virtual bool pluginIsDisable() { return false; }
|
||||
virtual void pluginStateSwitched() {}
|
||||
|
||||
///
|
||||
/// \brief displayModeChanged
|
||||
/// override this function to receive display mode changed signal
|
||||
/// \param displayMode
|
||||
///
|
||||
virtual void displayModeChanged(const Dock::DisplayMode displayMode) {Q_UNUSED(displayMode);}
|
||||
///
|
||||
/// \brief positionChanged
|
||||
/// override this function to receive dock position changed signal
|
||||
/// \param position
|
||||
///
|
||||
virtual void positionChanged(const Dock::Position position) {Q_UNUSED(position);}
|
||||
|
||||
///
|
||||
/// \brief refreshIcon
|
||||
/// refresh item icon, its triggered when system icon theme changed.
|
||||
/// \param itemKey
|
||||
/// item key
|
||||
///
|
||||
virtual void refreshIcon(const QString &itemKey) { Q_UNUSED(itemKey); }
|
||||
|
||||
///
|
||||
/// \brief displayMode
|
||||
/// get current dock display mode
|
||||
/// \return
|
||||
///
|
||||
inline Dock::DisplayMode displayMode() const
|
||||
{
|
||||
return qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief position
|
||||
/// get current dock position
|
||||
/// \return
|
||||
///
|
||||
inline Dock::Position position() const
|
||||
{
|
||||
return qApp->property(PROP_POSITION).value<Dock::Position>();
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief settingsChanged
|
||||
/// override this function to receive plugin settings changed signal(DeepinSync)
|
||||
///
|
||||
virtual void pluginSettingsChanged() {}
|
||||
|
||||
///
|
||||
/// \brief type
|
||||
/// default plugin add dock right,fixed plugin add to dock fixed area
|
||||
///
|
||||
virtual PluginType type() { return Normal; }
|
||||
|
||||
///
|
||||
/// \brief plugin size policy
|
||||
/// default plugin size policy
|
||||
///
|
||||
virtual PluginSizePolicy pluginSizePolicy() const { return System; }
|
||||
|
||||
protected:
|
||||
///
|
||||
/// \brief m_proxyInter
|
||||
/// NEVER delete this object.
|
||||
///
|
||||
PluginProxyInterface *m_proxyInter = nullptr;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define ModuleInterface_iid "com.deepin.dock.PluginsItemInterface"
|
||||
|
||||
Q_DECLARE_INTERFACE(PluginsItemInterface_V20, ModuleInterface_iid)
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PLUGINSITEMINTERFACE_H
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "abstractpluginscontroller.h"
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "pluginsiteminterface_v20.h"
|
||||
#include "pluginadapter.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <DNotifySender>
|
||||
@ -62,6 +64,71 @@ AbstractPluginsController::~AbstractPluginsController()
|
||||
}
|
||||
|
||||
void AbstractPluginsController::saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value)
|
||||
{
|
||||
savePluginValue(getPluginInterface(itemInter), key, value);
|
||||
}
|
||||
|
||||
const QVariant AbstractPluginsController::getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &fallback)
|
||||
{
|
||||
return getPluginValue(getPluginInterface(itemInter), key, fallback);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::removeValue(PluginsItemInterface *const itemInter, const QStringList &keyList)
|
||||
{
|
||||
removePluginValue(getPluginInterface(itemInter), keyList);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
PluginsItemInterface *pluginItem = getPluginInterface(itemInter);
|
||||
PluginAdapter *pluginAdapter = dynamic_cast<PluginAdapter *>(pluginItem);
|
||||
if (pluginAdapter)
|
||||
pluginAdapter->setItemKey(itemKey);
|
||||
|
||||
pluginItemAdded(pluginItem, itemKey);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
pluginItemUpdate(getPluginInterface(itemInter), itemKey);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
pluginItemRemoved(getPluginInterface(itemInter), itemKey);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
{
|
||||
requestPluginWindowAutoHide(getPluginInterface(itemInter), itemKey, autoHide);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
requestRefreshPluginWindowVisible(getPluginInterface(itemInter), itemKey);
|
||||
}
|
||||
|
||||
void AbstractPluginsController::requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||
{
|
||||
requestSetPluginAppletVisible(getPluginInterface(itemInter), itemKey, visible);
|
||||
}
|
||||
|
||||
PluginsItemInterface *AbstractPluginsController::getPluginInterface(PluginsItemInterface * const itemInter)
|
||||
{
|
||||
// 先从事先定义好的map中查找,如果没有找到,就是v23插件,直接返回当前插件的指针
|
||||
qulonglong pluginAddr = (qulonglong)itemInter;
|
||||
if (m_pluginAdapterMap.contains(pluginAddr))
|
||||
return m_pluginAdapterMap[pluginAddr];
|
||||
|
||||
return itemInter;
|
||||
}
|
||||
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &AbstractPluginsController::pluginsMap()
|
||||
{
|
||||
return m_pluginsMap;
|
||||
}
|
||||
|
||||
void AbstractPluginsController::savePluginValue(PluginsItemInterface * const itemInter, const QString &key, const QVariant &value)
|
||||
{
|
||||
// is it necessary?
|
||||
// refreshPluginSettings();
|
||||
@ -99,7 +166,7 @@ void AbstractPluginsController::saveValue(PluginsItemInterface *const itemInter,
|
||||
m_dockDaemonInter->MergePluginSettings(QJsonDocument(remoteObject).toJson(QJsonDocument::JsonFormat::Compact));
|
||||
}
|
||||
|
||||
const QVariant AbstractPluginsController::getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &fallback)
|
||||
const QVariant AbstractPluginsController::getPluginValue(PluginsItemInterface * const itemInter, const QString &key, const QVariant &fallback)
|
||||
{
|
||||
// load from local cache
|
||||
QVariant v = m_pluginSettingsObject.value(itemInter->pluginName()).toObject().value(key).toVariant();
|
||||
@ -110,7 +177,7 @@ const QVariant AbstractPluginsController::getValue(PluginsItemInterface *const i
|
||||
return v;
|
||||
}
|
||||
|
||||
void AbstractPluginsController::removeValue(PluginsItemInterface *const itemInter, const QStringList &keyList)
|
||||
void AbstractPluginsController::removePluginValue(PluginsItemInterface * const itemInter, const QStringList &keyList)
|
||||
{
|
||||
if (keyList.isEmpty()) {
|
||||
m_pluginSettingsObject.remove(itemInter->pluginName());
|
||||
@ -125,11 +192,6 @@ void AbstractPluginsController::removeValue(PluginsItemInterface *const itemInte
|
||||
m_dockDaemonInter->RemovePluginSettings(itemInter->pluginName(), keyList);
|
||||
}
|
||||
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &AbstractPluginsController::pluginsMap()
|
||||
{
|
||||
return m_pluginsMap;
|
||||
}
|
||||
|
||||
QObject *AbstractPluginsController::pluginItemAt(PluginsItemInterface *const itemInter, const QString &itemKey) const
|
||||
{
|
||||
if (!m_pluginsMap.contains(itemInter))
|
||||
@ -213,6 +275,18 @@ void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
}
|
||||
|
||||
PluginsItemInterface *interface = qobject_cast<PluginsItemInterface *>(pluginLoader->instance());
|
||||
if (!interface) {
|
||||
// 如果识别当前插件失败,就认为这个插件是v20的插件,将其转换为v20插件接口
|
||||
PluginsItemInterface_V20 *interface_v20 = qobject_cast<PluginsItemInterface_V20 *>(pluginLoader->instance());
|
||||
if (interface_v20) {
|
||||
// 将v20插件接口通过适配器转换成v23的接口,方便在后面识别
|
||||
PluginAdapter *pluginAdapter = new PluginAdapter(interface_v20);
|
||||
// 将适配器的地址保存到map列表中,因为适配器自己会调用itemAdded方法,转换成PluginsItemInterface类,但是实际上它
|
||||
// 对应的是PluginAdapter类,因此,这个map用于在后面的itemAdded方法中用来查找
|
||||
m_pluginAdapterMap[(qulonglong)(interface_v20)] = pluginAdapter;
|
||||
interface = pluginAdapter;
|
||||
}
|
||||
}
|
||||
|
||||
if (!interface) {
|
||||
qDebug() << objectName() << "load plugin failed!!!" << pluginLoader->errorString() << pluginFile;
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include <QDBusConnectionInterface>
|
||||
|
||||
class PluginsItemInterface;
|
||||
class PluginAdapter;
|
||||
|
||||
class AbstractPluginsController : public QObject, PluginProxyInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -40,26 +42,40 @@ public:
|
||||
explicit AbstractPluginsController(QObject *parent = Q_NULLPTR);
|
||||
~ AbstractPluginsController() override;
|
||||
|
||||
// implements PluginProxyInterface
|
||||
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) override;
|
||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& fallback = QVariant()) override;
|
||||
void removeValue(PluginsItemInterface * const itemInter, const QStringList &keyList) override;
|
||||
|
||||
void itemAdded(PluginsItemInterface * const, const QString &) override {}
|
||||
void itemUpdate(PluginsItemInterface * const, const QString &) override {}
|
||||
void itemRemoved(PluginsItemInterface * const, const QString &) override {}
|
||||
void requestWindowAutoHide(PluginsItemInterface * const, const QString &, const bool) override {}
|
||||
void requestRefreshWindowVisible(PluginsItemInterface * const, const QString &) override {}
|
||||
void requestSetAppletVisible(PluginsItemInterface * const, const QString &, const bool) override {}
|
||||
|
||||
void updateDockInfo(PluginsItemInterface *const, const DockPart &) override {}
|
||||
|
||||
virtual bool needLoad(PluginsItemInterface *) { return true; }
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &pluginsMap();
|
||||
|
||||
signals:
|
||||
virtual void savePluginValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value);
|
||||
virtual const QVariant getPluginValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& fallback = QVariant());
|
||||
virtual void removePluginValue(PluginsItemInterface * const itemInter, const QStringList &keyList);
|
||||
|
||||
virtual void pluginItemAdded(PluginsItemInterface * const, const QString &) = 0;
|
||||
virtual void pluginItemUpdate(PluginsItemInterface * const, const QString &) = 0;
|
||||
virtual void pluginItemRemoved(PluginsItemInterface * const, const QString &) = 0;
|
||||
virtual void requestPluginWindowAutoHide(PluginsItemInterface * const, const QString &, const bool) {}
|
||||
virtual void requestRefreshPluginWindowVisible(PluginsItemInterface * const, const QString &) {}
|
||||
virtual void requestSetPluginAppletVisible(PluginsItemInterface * const, const QString &, const bool) {}
|
||||
|
||||
Q_SIGNALS:
|
||||
void pluginLoaderFinished();
|
||||
|
||||
private:
|
||||
// implements PluginProxyInterface
|
||||
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) override;
|
||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& fallback = QVariant()) override;
|
||||
void removeValue(PluginsItemInterface * const itemInter, const QStringList &keyList) override;
|
||||
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
|
||||
PluginsItemInterface *getPluginInterface(PluginsItemInterface * const itemInter);
|
||||
|
||||
protected:
|
||||
QObject *pluginItemAt(PluginsItemInterface * const itemInter, const QString &itemKey) const;
|
||||
PluginsItemInterface *pluginInterAt(const QString &itemKey);
|
||||
@ -76,7 +92,6 @@ private slots:
|
||||
void initPlugin(PluginsItemInterface *interface);
|
||||
void refreshPluginSettings();
|
||||
|
||||
|
||||
private:
|
||||
QDBusConnectionInterface *m_dbusDaemonInterface;
|
||||
DockInter *m_dockDaemonInter;
|
||||
@ -88,6 +103,7 @@ private:
|
||||
QMap<QPair<QString, PluginsItemInterface *>, bool> m_pluginLoadMap;
|
||||
|
||||
QJsonObject m_pluginSettingsObject;
|
||||
QMap<qulonglong, PluginAdapter *> m_pluginAdapterMap;
|
||||
};
|
||||
|
||||
#endif // ABSTRACTPLUGINSCONTROLLER_H
|
||||
|
@ -287,7 +287,7 @@ protected:
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define ModuleInterface_iid "com.deepin.dock.PluginsItemInterface"
|
||||
#define ModuleInterface_iid "com.deepin.dock.PluginsItemInterface_2_0_0"
|
||||
|
||||
Q_DECLARE_INTERFACE(PluginsItemInterface, ModuleInterface_iid)
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user