mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
feat: update plugin API version
Note: 1. add a new function in PluginProxyInterface for set applet widget visible from a plugin. 2. remove requestContextMenu function from PluginProxyInterface, cause's the context menu should be handled in Dock, it is enough for a plugin to simply provide menu data and handle callbacks with functions itemContextMenu and invokedMenuItem in PluginsItemInterface https://github.com/linuxdeepin/internal-discussion/issues/646 Change-Id: Ic4af4eee138e87911ff5b18ccbbb0c3f7187ac4d
This commit is contained in:
parent
ff0d9f0804
commit
7a5501e53d
Notes:
gerrit
2018-12-18 11:41:07 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: listenerri <listenerri@gmail.com> Submitted-by: listenerri <listenerri@gmail.com> Submitted-at: Tue, 18 Dec 2018 11:41:06 +0800 Reviewed-on: https://cr.deepin.io/40650 Project: dde/dde-dock Branch: refs/heads/dev/refactor-plugins-mouse
@ -28,8 +28,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#define API_VERSION "1.1"
|
|
||||||
|
|
||||||
DockPluginsController::DockPluginsController(
|
DockPluginsController::DockPluginsController(
|
||||||
DockItemController *itemControllerInter)
|
DockItemController *itemControllerInter)
|
||||||
: QObject(itemControllerInter)
|
: QObject(itemControllerInter)
|
||||||
@ -94,14 +92,6 @@ void DockPluginsController::itemRemoved(PluginsItemInterface * const itemInter,
|
|||||||
item->deleteLater();
|
item->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockPluginsController::requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey)
|
|
||||||
{
|
|
||||||
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
|
||||||
Q_ASSERT(item);
|
|
||||||
|
|
||||||
item->showContextMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DockPluginsController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
void DockPluginsController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||||
{
|
{
|
||||||
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||||
@ -118,6 +108,18 @@ void DockPluginsController::requestRefreshWindowVisible(PluginsItemInterface * c
|
|||||||
Q_EMIT item->requestRefreshWindowVisible();
|
Q_EMIT item->requestRefreshWindowVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockPluginsController::requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||||
|
{
|
||||||
|
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||||
|
Q_ASSERT(item);
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
item->showPopupApplet(itemInter->itemPopupApplet(itemKey));
|
||||||
|
} else {
|
||||||
|
item->hidePopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DockPluginsController::startLoader()
|
void DockPluginsController::startLoader()
|
||||||
{
|
{
|
||||||
DockPluginLoader *loader = new DockPluginLoader(this);
|
DockPluginLoader *loader = new DockPluginLoader(this);
|
||||||
@ -150,7 +152,7 @@ void DockPluginsController::loadPlugin(const QString &pluginFile)
|
|||||||
{
|
{
|
||||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
||||||
const auto meta = pluginLoader->metaData().value("MetaData").toObject();
|
const auto meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||||
if (!meta.contains("api") || meta["api"].toString() != API_VERSION)
|
if (!meta.contains("api") || meta["api"].toString() != DOCK_PLUGIN_API_VERSION)
|
||||||
{
|
{
|
||||||
qWarning() << "plugin api version not matched!" << pluginFile;
|
qWarning() << "plugin api version not matched!" << pluginFile;
|
||||||
return;
|
return;
|
||||||
|
@ -45,9 +45,9 @@ public:
|
|||||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
void requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
|
||||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) Q_DECL_OVERRIDE;
|
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) Q_DECL_OVERRIDE;
|
||||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
|
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) Q_DECL_OVERRIDE;
|
||||||
void saveValue(PluginsItemInterface *const itemInter, const QString &itemKey, const QVariant &value) Q_DECL_OVERRIDE;
|
void saveValue(PluginsItemInterface *const itemInter, const QString &itemKey, const QVariant &value) Q_DECL_OVERRIDE;
|
||||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &itemKey, const QVariant& failback = QVariant()) Q_DECL_OVERRIDE;
|
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &itemKey, const QVariant& failback = QVariant()) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -316,19 +316,11 @@ void AppItem::mousePressEvent(QMouseEvent *e)
|
|||||||
m_updateIconGeometryTimer->stop();
|
m_updateIconGeometryTimer->stop();
|
||||||
hidePopup();
|
hidePopup();
|
||||||
|
|
||||||
if (e->button() == Qt::RightButton)
|
|
||||||
{
|
|
||||||
if (perfectIconRect().contains(e->pos()))
|
|
||||||
{
|
|
||||||
QMetaObject::invokeMethod(this, "showContextMenu", Qt::QueuedConnection);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
MousePressPos = e->pos();
|
MousePressPos = e->pos();
|
||||||
|
|
||||||
|
// context menu will handle in DockItem
|
||||||
|
DockItem::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::mouseMoveEvent(QMouseEvent *e)
|
void AppItem::mouseMoveEvent(QMouseEvent *e)
|
||||||
|
@ -150,8 +150,13 @@ void DockItem::mousePressEvent(QMouseEvent *e)
|
|||||||
// ignore this event to MainPanel/MainWindow to show context menu of MainWindow
|
// ignore this event to MainPanel/MainWindow to show context menu of MainWindow
|
||||||
return e->ignore();
|
return e->ignore();
|
||||||
}
|
}
|
||||||
return showContextMenu();
|
if (perfectIconRect().contains(e->pos())) {
|
||||||
|
return showContextMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// same as e->ignore above
|
||||||
|
QWidget::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockItem::enterEvent(QEvent *e)
|
void DockItem::enterEvent(QEvent *e)
|
||||||
|
@ -62,6 +62,9 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
virtual void refershIcon() {}
|
virtual void refershIcon() {}
|
||||||
|
|
||||||
|
void showPopupApplet(QWidget * const applet);
|
||||||
|
void hidePopup();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dragStarted() const;
|
void dragStarted() const;
|
||||||
void itemDropped(QObject *destination, const QPoint &dropPoint) const;
|
void itemDropped(QObject *destination, const QPoint &dropPoint) const;
|
||||||
@ -79,10 +82,8 @@ protected:
|
|||||||
const QPoint popupMarkPoint() const;
|
const QPoint popupMarkPoint() const;
|
||||||
const QPoint topleftPoint() const;
|
const QPoint topleftPoint() const;
|
||||||
|
|
||||||
void hidePopup();
|
|
||||||
void hideNonModel();
|
void hideNonModel();
|
||||||
void popupWindowAccept();
|
void popupWindowAccept();
|
||||||
void showPopupApplet(QWidget * const applet);
|
|
||||||
virtual void showPopupWindow(QWidget * const content, const bool model = false);
|
virtual void showPopupWindow(QWidget * const content, const bool model = false);
|
||||||
virtual void showHoverTips();
|
virtual void showHoverTips();
|
||||||
virtual void invokedMenuItem(const QString &itemId, const bool checked);
|
virtual void invokedMenuItem(const QString &itemId, const bool checked);
|
||||||
|
@ -162,7 +162,8 @@ void PluginsItem::mousePressEvent(QMouseEvent *e)
|
|||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
MousePressPoint = e->pos();
|
MousePressPoint = e->pos();
|
||||||
|
|
||||||
QWidget::mousePressEvent(e);
|
// context menu will handle in DockItem
|
||||||
|
DockItem::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsItem::mouseMoveEvent(QMouseEvent *e)
|
void PluginsItem::mouseMoveEvent(QMouseEvent *e)
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
namespace Dock {
|
namespace Dock {
|
||||||
|
|
||||||
#define DOCK_PLUGIN_MIME "dock/plugin"
|
#define DOCK_PLUGIN_MIME "dock/plugin"
|
||||||
|
#define DOCK_PLUGIN_API_VERSION "1.1.1"
|
||||||
|
|
||||||
#define PROP_DISPLAY_MODE "DisplayMode"
|
#define PROP_DISPLAY_MODE "DisplayMode"
|
||||||
///
|
///
|
||||||
|
@ -61,11 +61,13 @@ public:
|
|||||||
/// \brief requestContextMenu
|
/// \brief requestContextMenu
|
||||||
/// request show context menu
|
/// request show context menu
|
||||||
///
|
///
|
||||||
virtual void requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
//virtual void requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||||
|
|
||||||
virtual void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) = 0;
|
virtual void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) = 0;
|
||||||
virtual void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
virtual void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||||
|
|
||||||
|
virtual void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief saveValue
|
/// \brief saveValue
|
||||||
/// save module config to .config/deepin/dde-dock.conf
|
/// save module config to .config/deepin/dde-dock.conf
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1"
|
"api": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ DatetimePlugin::DatetimePlugin(QObject *parent)
|
|||||||
|
|
||||||
m_centralWidget = new DatetimeWidget;
|
m_centralWidget = new DatetimeWidget;
|
||||||
|
|
||||||
connect(m_centralWidget, &DatetimeWidget::requestContextMenu, [this] { m_proxyInter->requestContextMenu(this, QString()); });
|
|
||||||
connect(m_centralWidget, &DatetimeWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, QString()); });
|
connect(m_centralWidget, &DatetimeWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, QString()); });
|
||||||
|
|
||||||
connect(m_refershTimer, &QTimer::timeout, this, &DatetimePlugin::updateCurrentTimeString);
|
connect(m_refershTimer, &QTimer::timeout, this, &DatetimePlugin::updateCurrentTimeString);
|
||||||
|
@ -183,21 +183,6 @@ void DatetimeWidget::paintEvent(QPaintEvent *e)
|
|||||||
painter.drawPixmap(rect().center() - m_cachedIcon.rect().center() / ratio, m_cachedIcon);
|
painter.drawPixmap(rect().center() - m_cachedIcon.rect().center() / ratio, m_cachedIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatetimeWidget::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::RightButton)
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
|
|
||||||
const QPoint p(e->pos() - rect().center());
|
|
||||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
{
|
|
||||||
emit requestContextMenu();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QPixmap DatetimeWidget::loadSvg(const QString &fileName, const QSize size)
|
const QPixmap DatetimeWidget::loadSvg(const QString &fileName, const QSize size)
|
||||||
{
|
{
|
||||||
const auto ratio = qApp->devicePixelRatio();
|
const auto ratio = qApp->devicePixelRatio();
|
||||||
|
@ -35,7 +35,6 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestUpdateGeometry() const;
|
void requestUpdateGeometry() const;
|
||||||
void requestContextMenu() const;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void set24HourFormat(const bool value);
|
void set24HourFormat(const bool value);
|
||||||
@ -44,7 +43,6 @@ private:
|
|||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
const QPixmap loadSvg(const QString &fileName, const QSize size);
|
const QPixmap loadSvg(const QString &fileName, const QSize size);
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1"
|
"api": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1"
|
"api": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -361,5 +361,7 @@ void WirelessList::onActivateApFailed(const QString &apPath, const QString &uuid
|
|||||||
.arg(QString("network"))
|
.arg(QString("network"))
|
||||||
.arg(QString(QJsonDocument(m_editConnectionData).toJson()))
|
.arg(QString(QJsonDocument(m_editConnectionData).toJson()))
|
||||||
.call();
|
.call();
|
||||||
|
|
||||||
|
Q_EMIT requestSetAppletVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ signals:
|
|||||||
void requestActiveAP(const QString &devPath, const QString &apPath, const QString &uuid) const;
|
void requestActiveAP(const QString &devPath, const QString &apPath, const QString &uuid) const;
|
||||||
void requestDeactiveAP(const QString &devPath) const;
|
void requestDeactiveAP(const QString &devPath) const;
|
||||||
void requestWirelessScan();
|
void requestWirelessScan();
|
||||||
|
void requestSetAppletVisible(const bool visible) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void loadAPList();
|
void loadAPList();
|
||||||
|
@ -45,7 +45,6 @@ public:
|
|||||||
virtual void invokeMenuItem(const QString &menuId);
|
virtual void invokeMenuItem(const QString &menuId);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestContextMenu() const;
|
|
||||||
void requestSetDeviceEnable(const QString &path, const bool enable) const;
|
void requestSetDeviceEnable(const QString &path, const bool enable) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -87,21 +87,6 @@ void WiredItem::resizeEvent(QResizeEvent *e)
|
|||||||
m_delayTimer->start();
|
m_delayTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiredItem::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::RightButton)
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
|
|
||||||
const QPoint p(e->pos() - rect().center());
|
|
||||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
{
|
|
||||||
emit requestContextMenu();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WiredItem::refreshIcon()
|
void WiredItem::refreshIcon()
|
||||||
{
|
{
|
||||||
m_delayTimer->start();
|
m_delayTimer->start();
|
||||||
|
@ -44,7 +44,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void mousePressEvent(QMouseEvent *e) override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void refreshIcon() override;
|
void refreshIcon() override;
|
||||||
|
@ -125,21 +125,6 @@ void WirelessItem::resizeEvent(QResizeEvent *e)
|
|||||||
m_icons.clear();
|
m_icons.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WirelessItem::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::RightButton)
|
|
||||||
return e->ignore();
|
|
||||||
|
|
||||||
const QPoint p(e->pos() - rect().center());
|
|
||||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
{
|
|
||||||
emit requestContextMenu();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QPixmap WirelessItem::iconPix(const Dock::DisplayMode displayMode, const int size)
|
const QPixmap WirelessItem::iconPix(const Dock::DisplayMode displayMode, const int size)
|
||||||
{
|
{
|
||||||
QString type;
|
QString type;
|
||||||
@ -244,6 +229,7 @@ void WirelessItem::init()
|
|||||||
connect(m_APList, &WirelessList::requestActiveAP, this, &WirelessItem::requestActiveAP);
|
connect(m_APList, &WirelessList::requestActiveAP, this, &WirelessItem::requestActiveAP);
|
||||||
connect(m_APList, &WirelessList::requestDeactiveAP, this, &WirelessItem::requestDeactiveAP);
|
connect(m_APList, &WirelessList::requestDeactiveAP, this, &WirelessItem::requestDeactiveAP);
|
||||||
connect(m_APList, &WirelessList::requestWirelessScan, this, &WirelessItem::requestWirelessScan);
|
connect(m_APList, &WirelessList::requestWirelessScan, this, &WirelessItem::requestWirelessScan);
|
||||||
|
connect(m_APList, &WirelessList::requestSetAppletVisible, this, &WirelessItem::requestSetAppletVisible);
|
||||||
|
|
||||||
QTimer::singleShot(0, this, [=]() {
|
QTimer::singleShot(0, this, [=]() {
|
||||||
m_refreshTimer->start();
|
m_refreshTimer->start();
|
||||||
|
@ -52,6 +52,7 @@ public Q_SLOTS:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void requestActiveAP(const QString &devPath, const QString &apPath, const QString &uuid) const;
|
void requestActiveAP(const QString &devPath, const QString &apPath, const QString &uuid) const;
|
||||||
void requestDeactiveAP(const QString &devPath) const;
|
void requestDeactiveAP(const QString &devPath) const;
|
||||||
|
void requestSetAppletVisible(const bool visible) const;
|
||||||
void feedSecret(const QString &connectionPath, const QString &settingName, const QString &password, const bool autoConnect);
|
void feedSecret(const QString &connectionPath, const QString &settingName, const QString &password, const bool autoConnect);
|
||||||
void cancelSecret(const QString &connectionPath, const QString &settingName);
|
void cancelSecret(const QString &connectionPath, const QString &settingName);
|
||||||
void queryActiveConnInfo();
|
void queryActiveConnInfo();
|
||||||
@ -63,7 +64,6 @@ protected:
|
|||||||
bool eventFilter(QObject *o, QEvent *e);
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QPixmap iconPix(const Dock::DisplayMode displayMode, const int size);
|
const QPixmap iconPix(const Dock::DisplayMode displayMode, const int size);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1",
|
"api": "1.1.1",
|
||||||
"depends-daemon-dbus-service": "com.deepin.daemon.Network"
|
"depends-daemon-dbus-service": "com.deepin.daemon.Network"
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,9 @@ void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
|||||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::queryConnectionSession,
|
connect(static_cast<WirelessItem *>(item), &WirelessItem::queryConnectionSession,
|
||||||
m_networkWorker, &NetworkWorker::queryConnectionSession);
|
m_networkWorker, &NetworkWorker::queryConnectionSession);
|
||||||
|
|
||||||
|
connect(static_cast<WirelessItem *>(item), &WirelessItem::requestSetAppletVisible,
|
||||||
|
this, &NetworkPlugin::onItemRequestSetAppletVisible);
|
||||||
|
|
||||||
m_networkWorker->queryAccessPoints(path);
|
m_networkWorker->queryAccessPoints(path);
|
||||||
m_networkWorker->requestWirelessScan();
|
m_networkWorker->requestWirelessScan();
|
||||||
break;
|
break;
|
||||||
@ -227,7 +230,6 @@ void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
|||||||
connect(device, &dde::network::NetworkDevice::enableChanged,
|
connect(device, &dde::network::NetworkDevice::enableChanged,
|
||||||
m_delayRefreshTimer, static_cast<void (QTimer:: *)()>(&QTimer::start));
|
m_delayRefreshTimer, static_cast<void (QTimer:: *)()>(&QTimer::start));
|
||||||
|
|
||||||
connect(item, &DeviceItem::requestContextMenu, this, &NetworkPlugin::contextMenuRequested);
|
|
||||||
connect(item, &DeviceItem::requestSetDeviceEnable, m_networkWorker, &NetworkWorker::setDeviceEnable);
|
connect(item, &DeviceItem::requestSetDeviceEnable, m_networkWorker, &NetworkWorker::setDeviceEnable);
|
||||||
connect(m_networkModel, &NetworkModel::connectivityChanged, item, &DeviceItem::refreshIcon);
|
connect(m_networkModel, &NetworkModel::connectivityChanged, item, &DeviceItem::refreshIcon);
|
||||||
}
|
}
|
||||||
@ -320,10 +322,10 @@ void NetworkPlugin::loadPlugin()
|
|||||||
onDeviceListChanged(m_networkModel->devices());
|
onDeviceListChanged(m_networkModel->devices());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkPlugin::contextMenuRequested()
|
void NetworkPlugin::onItemRequestSetAppletVisible(const bool visible)
|
||||||
{
|
{
|
||||||
DeviceItem *item = qobject_cast<DeviceItem *>(sender());
|
DeviceItem *item = qobject_cast<DeviceItem *>(sender());
|
||||||
Q_ASSERT(item);
|
Q_ASSERT(item);
|
||||||
|
|
||||||
m_proxyInter->requestContextMenu(this, item->path());
|
m_proxyInter->requestSetAppletVisible(this, item->path(), visible);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void onDeviceListChanged(const QList<dde::network::NetworkDevice *> devices);
|
void onDeviceListChanged(const QList<dde::network::NetworkDevice *> devices);
|
||||||
void refreshWiredItemVisible();
|
void refreshWiredItemVisible();
|
||||||
void contextMenuRequested();
|
void onItemRequestSetAppletVisible(const bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceItem *itemByPath(const QString &path);
|
DeviceItem *itemByPath(const QString &path);
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1"
|
"api": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1",
|
"api": "1.1.1",
|
||||||
"depends-daemon-dbus-service": "com.deepin.daemon.Power"
|
"depends-daemon-dbus-service": "com.deepin.daemon.Power"
|
||||||
}
|
}
|
||||||
|
@ -181,11 +181,6 @@ void PowerPlugin::updateBatteryVisible()
|
|||||||
m_proxyInter->itemAdded(this, POWER_KEY);
|
m_proxyInter->itemAdded(this, POWER_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerPlugin::requestContextMenu(const QString &itemKey)
|
|
||||||
{
|
|
||||||
m_proxyInter->requestContextMenu(this, itemKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PowerPlugin::loadPlugin()
|
void PowerPlugin::loadPlugin()
|
||||||
{
|
{
|
||||||
if (m_pluginLoaded) {
|
if (m_pluginLoaded) {
|
||||||
@ -199,7 +194,6 @@ void PowerPlugin::loadPlugin()
|
|||||||
m_powerInter = new DBusPower(this);
|
m_powerInter = new DBusPower(this);
|
||||||
|
|
||||||
connect(m_powerInter, &DBusPower::BatteryPercentageChanged, this, &PowerPlugin::updateBatteryVisible);
|
connect(m_powerInter, &DBusPower::BatteryPercentageChanged, this, &PowerPlugin::updateBatteryVisible);
|
||||||
connect(m_powerStatusWidget, &PowerStatusWidget::requestContextMenu, this, &PowerPlugin::requestContextMenu);
|
|
||||||
|
|
||||||
updateBatteryVisible();
|
updateBatteryVisible();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateBatteryVisible();
|
void updateBatteryVisible();
|
||||||
void requestContextMenu(const QString &itemKey);
|
|
||||||
void loadPlugin();
|
void loadPlugin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -60,21 +60,6 @@ void PowerStatusWidget::paintEvent(QPaintEvent *e)
|
|||||||
painter.drawPixmap(rf.center() - rfp.center() / ratio, icon);
|
painter.drawPixmap(rf.center() - rfp.center() / ratio, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerStatusWidget::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() == Qt::LeftButton)
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
|
|
||||||
const QPoint p(e->pos() - rect().center());
|
|
||||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
{
|
|
||||||
emit requestContextMenu(POWER_KEY);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap PowerStatusWidget::getBatteryIcon()
|
QPixmap PowerStatusWidget::getBatteryIcon()
|
||||||
{
|
{
|
||||||
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
||||||
|
@ -43,7 +43,6 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap getBatteryIcon();
|
QPixmap getBatteryIcon();
|
||||||
|
@ -60,21 +60,6 @@ void PluginWidget::paintEvent(QPaintEvent *e)
|
|||||||
painter.drawPixmap(rect().center() - pixmap.rect().center() / qApp->devicePixelRatio(), pixmap);
|
painter.drawPixmap(rect().center() - pixmap.rect().center() / qApp->devicePixelRatio(), pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginWidget::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::RightButton)
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
|
|
||||||
const QPoint p(e->pos() - rect().center());
|
|
||||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
{
|
|
||||||
emit requestContextMenu(QString("shutdown"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginWidget::enterEvent(QEvent *e)
|
void PluginWidget::enterEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
e->accept();
|
e->accept();
|
||||||
|
@ -39,7 +39,6 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void enterEvent(QEvent *e);
|
void enterEvent(QEvent *e);
|
||||||
void leaveEvent(QEvent *e);
|
void leaveEvent(QEvent *e);
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1"
|
"api": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -208,11 +208,6 @@ void ShutdownPlugin::setSortKey(const QString &itemKey, const int order)
|
|||||||
m_proxyInter->saveValue(this, key, order);
|
m_proxyInter->saveValue(this, key, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownPlugin::requestContextMenu(const QString &itemKey)
|
|
||||||
{
|
|
||||||
m_proxyInter->requestContextMenu(this, itemKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShutdownPlugin::loadPlugin()
|
void ShutdownPlugin::loadPlugin()
|
||||||
{
|
{
|
||||||
if (m_pluginLoaded) {
|
if (m_pluginLoaded) {
|
||||||
@ -224,8 +219,6 @@ void ShutdownPlugin::loadPlugin()
|
|||||||
|
|
||||||
m_shutdownWidget = new PluginWidget;
|
m_shutdownWidget = new PluginWidget;
|
||||||
|
|
||||||
connect(m_shutdownWidget, &PluginWidget::requestContextMenu, this, &ShutdownPlugin::requestContextMenu);
|
|
||||||
|
|
||||||
m_proxyInter->itemAdded(this, pluginName());
|
m_proxyInter->itemAdded(this, pluginName());
|
||||||
displayModeChanged(displayMode());
|
displayModeChanged(displayMode());
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,6 @@ public:
|
|||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void requestContextMenu(const QString &itemKey);
|
|
||||||
void loadPlugin();
|
void loadPlugin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1",
|
"api": "1.1.1",
|
||||||
"depends-daemon-dbus-service": "com.deepin.daemon.Audio"
|
"depends-daemon-dbus-service": "com.deepin.daemon.Audio"
|
||||||
}
|
}
|
||||||
|
@ -123,22 +123,6 @@ void SoundItem::resizeEvent(QResizeEvent *e)
|
|||||||
refreshIcon();
|
refreshIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundItem::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::RightButton)
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
|
|
||||||
const QPoint p(e->pos() - rect().center());
|
|
||||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
{
|
|
||||||
e->accept();
|
|
||||||
emit requestContextMenu();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoundItem::wheelEvent(QWheelEvent *e)
|
void SoundItem::wheelEvent(QWheelEvent *e)
|
||||||
{
|
{
|
||||||
QWheelEvent *event = new QWheelEvent(e->pos(), e->delta(), e->buttons(), e->modifiers());
|
QWheelEvent *event = new QWheelEvent(e->pos(), e->delta(), e->buttons(), e->modifiers());
|
||||||
|
@ -51,7 +51,6 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void wheelEvent(QWheelEvent *e);
|
void wheelEvent(QWheelEvent *e);
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ void SoundPlugin::init(PluginProxyInterface *proxyInter)
|
|||||||
m_proxyInter = proxyInter;
|
m_proxyInter = proxyInter;
|
||||||
|
|
||||||
m_soundItem = new SoundItem;
|
m_soundItem = new SoundItem;
|
||||||
connect(m_soundItem, &SoundItem::requestContextMenu, [this] { m_proxyInter->requestContextMenu(this, SOUND_KEY); });
|
|
||||||
|
|
||||||
if (!pluginIsDisable())
|
if (!pluginIsDisable())
|
||||||
m_proxyInter->itemAdded(this, SOUND_KEY);
|
m_proxyInter->itemAdded(this, SOUND_KEY);
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1"
|
"api": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,6 @@ TrashPlugin::TrashPlugin(QObject *parent)
|
|||||||
m_tipsLabel->setObjectName("trash");
|
m_tipsLabel->setObjectName("trash");
|
||||||
m_tipsLabel->setStyleSheet("color:white;"
|
m_tipsLabel->setStyleSheet("color:white;"
|
||||||
"padding: 0 3px;");
|
"padding: 0 3px;");
|
||||||
|
|
||||||
connect(m_trashWidget, &TrashWidget::requestContextMenu, this, &TrashPlugin::showContextMenu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString TrashPlugin::pluginName() const
|
const QString TrashPlugin::pluginName() const
|
||||||
@ -145,8 +143,3 @@ void TrashPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
|
|||||||
else
|
else
|
||||||
m_proxyInter->itemRemoved(this, pluginName());
|
m_proxyInter->itemRemoved(this, pluginName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrashPlugin::showContextMenu()
|
|
||||||
{
|
|
||||||
m_proxyInter->requestContextMenu(this, pluginName());
|
|
||||||
}
|
|
||||||
|
@ -57,9 +57,6 @@ public:
|
|||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
||||||
void displayModeChanged(const Dock::DisplayMode displayMode) Q_DECL_OVERRIDE;
|
void displayModeChanged(const Dock::DisplayMode displayMode) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
|
||||||
void showContextMenu();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TrashWidget *m_trashWidget;
|
TrashWidget *m_trashWidget;
|
||||||
QLabel *m_tipsLabel;
|
QLabel *m_tipsLabel;
|
||||||
|
@ -180,15 +180,6 @@ void TrashWidget::resizeEvent(QResizeEvent *e)
|
|||||||
updateIcon();
|
updateIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrashWidget::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
const QPoint dis = e->pos() - rect().center();
|
|
||||||
if (e->button() != Qt::RightButton || dis.manhattanLength() > std::min(width(), height()) * 0.8 * 0.5)
|
|
||||||
return QWidget::mousePressEvent(e);
|
|
||||||
|
|
||||||
emit requestContextMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrashWidget::updateIcon()
|
void TrashWidget::updateIcon()
|
||||||
{
|
{
|
||||||
const Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
|
const Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
|
||||||
|
@ -58,7 +58,6 @@ protected:
|
|||||||
void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
|
||||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
||||||
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
|
||||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeApp(const QString &appKey);
|
void removeApp(const QString &appKey);
|
||||||
|
@ -63,6 +63,8 @@ void AbstractTrayWidget::mouseReleaseEvent(QMouseEvent *e)
|
|||||||
m_lastMouseReleaseData.second = e->button();
|
m_lastMouseReleaseData.second = e->button();
|
||||||
|
|
||||||
m_handleMouseReleaseTimer->start();
|
m_handleMouseReleaseTimer->start();
|
||||||
|
|
||||||
|
QWidget::mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ FashionTrayWidgetWrapper::FashionTrayWidgetWrapper(const QString &itemKey, Abstr
|
|||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
m_absTrayWidget->setVisible(true);
|
m_absTrayWidget->setVisible(true);
|
||||||
m_absTrayWidget->installEventFilter(this);
|
|
||||||
|
|
||||||
m_layout->setSpacing(0);
|
m_layout->setSpacing(0);
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
@ -93,19 +92,6 @@ void FashionTrayWidgetWrapper::paintEvent(QPaintEvent *event)
|
|||||||
painter.fillPath(path, color);
|
painter.fillPath(path, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FashionTrayWidgetWrapper::eventFilter(QObject *watched, QEvent *event)
|
|
||||||
{
|
|
||||||
if (watched == m_absTrayWidget) {
|
|
||||||
if (event->type() == QEvent::Type::MouseButtonPress) {
|
|
||||||
mousePressEvent(static_cast<QMouseEvent *>(event));
|
|
||||||
} else if (event->type() == QEvent::Type::MouseButtonRelease) {
|
|
||||||
mouseReleaseEvent(static_cast<QMouseEvent *>(event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FashionTrayWidgetWrapper::mousePressEvent(QMouseEvent *event)
|
void FashionTrayWidgetWrapper::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||||
|
@ -49,7 +49,6 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||||
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
@ -194,6 +194,15 @@ void SystemTrayItem::mousePressEvent(QMouseEvent *event)
|
|||||||
m_popupTipsDelayTimer->stop();
|
m_popupTipsDelayTimer->stop();
|
||||||
hideNonModel();
|
hideNonModel();
|
||||||
|
|
||||||
|
if (event->button() == Qt::RightButton) {
|
||||||
|
const QPoint p(event->pos() - rect().center());
|
||||||
|
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
||||||
|
{
|
||||||
|
showContextMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AbstractTrayWidget::mousePressEvent(event);
|
AbstractTrayWidget::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,9 @@ public:
|
|||||||
void detachPluginWidget();
|
void detachPluginWidget();
|
||||||
void showContextMenu();
|
void showContextMenu();
|
||||||
|
|
||||||
|
void showPopupApplet(QWidget * const applet);
|
||||||
|
void hidePopup();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||||
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
||||||
@ -68,10 +71,8 @@ protected:
|
|||||||
const QPoint popupMarkPoint() const;
|
const QPoint popupMarkPoint() const;
|
||||||
const QPoint topleftPoint() const;
|
const QPoint topleftPoint() const;
|
||||||
|
|
||||||
void hidePopup();
|
|
||||||
void hideNonModel();
|
void hideNonModel();
|
||||||
void popupWindowAccept();
|
void popupWindowAccept();
|
||||||
void showPopupApplet(QWidget * const applet);
|
|
||||||
|
|
||||||
virtual void showPopupWindow(QWidget * const content, const bool model = false);
|
virtual void showPopupWindow(QWidget * const content, const bool model = false);
|
||||||
virtual void showHoverTips();
|
virtual void showHoverTips();
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#define API_VERSION "1.1"
|
|
||||||
|
|
||||||
SystemTraysController::SystemTraysController(QObject *parent)
|
SystemTraysController::SystemTraysController(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_dbusDaemonInterface(QDBusConnection::sessionBus().interface())
|
, m_dbusDaemonInterface(QDBusConnection::sessionBus().interface())
|
||||||
@ -83,14 +81,6 @@ void SystemTraysController::itemRemoved(PluginsItemInterface * const itemInter,
|
|||||||
item->deleteLater();
|
item->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTraysController::requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey)
|
|
||||||
{
|
|
||||||
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
|
||||||
Q_ASSERT(item);
|
|
||||||
|
|
||||||
item->showContextMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemTraysController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
void SystemTraysController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||||
{
|
{
|
||||||
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
||||||
@ -107,6 +97,18 @@ void SystemTraysController::requestRefreshWindowVisible(PluginsItemInterface * c
|
|||||||
Q_EMIT item->requestRefershWindowVisible();
|
Q_EMIT item->requestRefershWindowVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SystemTraysController::requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||||
|
{
|
||||||
|
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
||||||
|
Q_ASSERT(item);
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
item->showPopupApplet(itemInter->itemPopupApplet(itemKey));
|
||||||
|
} else {
|
||||||
|
item->hidePopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SystemTraysController::startLoader()
|
void SystemTraysController::startLoader()
|
||||||
{
|
{
|
||||||
SystemTrayLoader *loader = new SystemTrayLoader(this);
|
SystemTrayLoader *loader = new SystemTrayLoader(this);
|
||||||
@ -139,7 +141,7 @@ void SystemTraysController::loadPlugin(const QString &pluginFile)
|
|||||||
{
|
{
|
||||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
||||||
const auto meta = pluginLoader->metaData().value("MetaData").toObject();
|
const auto meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||||
if (!meta.contains("api") || meta["api"].toString() != API_VERSION)
|
if (!meta.contains("api") || meta["api"].toString() != DOCK_PLUGIN_API_VERSION)
|
||||||
{
|
{
|
||||||
qWarning() << "plugin api version not matched!" << pluginFile;
|
qWarning() << "plugin api version not matched!" << pluginFile;
|
||||||
return;
|
return;
|
||||||
|
@ -42,9 +42,9 @@ public:
|
|||||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
void requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
|
||||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) Q_DECL_OVERRIDE;
|
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) Q_DECL_OVERRIDE;
|
||||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
||||||
|
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) Q_DECL_OVERRIDE;
|
||||||
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) Q_DECL_OVERRIDE;
|
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) Q_DECL_OVERRIDE;
|
||||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& failback = QVariant()) Q_DECL_OVERRIDE;
|
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& failback = QVariant()) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"api": "1.1",
|
"api": "1.1.1",
|
||||||
"depends-daemon-dbus-service": "com.deepin.dde.TrayManager"
|
"depends-daemon-dbus-service": "com.deepin.dde.TrayManager"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user