mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Merge branch 'dev/fix-dock-hidden'
Change-Id: Ia3f5ab9659d1356b699a5de33ed71f7b1ce6ba03
This commit is contained in:
commit
e18be0ba7f
@ -28,7 +28,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
#define API_VERSION "1.0"
|
||||
#define API_VERSION "1.1"
|
||||
|
||||
DockPluginsController::DockPluginsController(
|
||||
DockItemController *itemControllerInter)
|
||||
@ -94,19 +94,6 @@ void DockPluginsController::itemRemoved(PluginsItemInterface * const itemInter,
|
||||
item->deleteLater();
|
||||
}
|
||||
|
||||
//void DockPluginsController::requestRefershWindowVisible()
|
||||
//{
|
||||
// for (auto list : m_pluginList.values())
|
||||
// {
|
||||
// for (auto item : list.values())
|
||||
// {
|
||||
// Q_ASSERT(item);
|
||||
// emit item->requestRefershWindowVisible();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
void DockPluginsController::requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||
@ -115,13 +102,21 @@ void DockPluginsController::requestContextMenu(PluginsItemInterface * const item
|
||||
item->showContextMenu();
|
||||
}
|
||||
|
||||
//void DockPluginsController::requestPopupApplet(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
//{
|
||||
// PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||
void DockPluginsController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
{
|
||||
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||
Q_ASSERT(item);
|
||||
|
||||
// Q_ASSERT(item);
|
||||
// item->showPopupApplet();
|
||||
//}
|
||||
Q_EMIT item->requestWindowAutoHide(autoHide);
|
||||
}
|
||||
|
||||
void DockPluginsController::requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||
Q_ASSERT(item);
|
||||
|
||||
Q_EMIT item->requestRefreshWindowVisible();
|
||||
}
|
||||
|
||||
void DockPluginsController::startLoader()
|
||||
{
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
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 saveValue(PluginsItemInterface *const itemInter, const QString &itemKey, const QVariant &value);
|
||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &itemKey, const QVariant& failback = QVariant());
|
||||
|
||||
|
@ -239,7 +239,7 @@ void DockItem::showContextMenu()
|
||||
|
||||
void DockItem::onContextMenuAccepted()
|
||||
{
|
||||
emit requestRefershWindowVisible();
|
||||
emit requestRefreshWindowVisible();
|
||||
emit requestWindowAutoHide(true);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ signals:
|
||||
void dragStarted() const;
|
||||
void itemDropped(QObject *destination) const;
|
||||
void requestWindowAutoHide(const bool autoHide) const;
|
||||
void requestRefershWindowVisible() const;
|
||||
void requestRefreshWindowVisible() const;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
@ -51,10 +51,6 @@ bool TrayPluginItem::eventFilter(QObject *watched, QEvent *e)
|
||||
const QString &propertyName = static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName();
|
||||
if (propertyName == "FashionTraySize") {
|
||||
Q_EMIT fashionTraySizeChanged(watched->property("FashionTraySize").toSize());
|
||||
} else if (propertyName == "RequestWindowAutoHide") {
|
||||
Q_EMIT requestWindowAutoHide(watched->property("RequestWindowAutoHide").toBool());
|
||||
} else if (propertyName == "RequestRefershWindowVisible") {
|
||||
Q_EMIT requestRefershWindowVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ void MainPanel::manageItem(DockItem *item)
|
||||
{
|
||||
connect(item, &DockItem::dragStarted, this, &MainPanel::itemDragStarted, Qt::UniqueConnection);
|
||||
connect(item, &DockItem::itemDropped, this, &MainPanel::itemDropped, Qt::UniqueConnection);
|
||||
connect(item, &DockItem::requestRefershWindowVisible, this, &MainPanel::requestRefershWindowVisible, Qt::UniqueConnection);
|
||||
connect(item, &DockItem::requestRefreshWindowVisible, this, &MainPanel::requestRefershWindowVisible, Qt::UniqueConnection);
|
||||
connect(item, &DockItem::requestWindowAutoHide, this, &MainPanel::requestWindowAutoHide, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,9 @@ public:
|
||||
///
|
||||
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 requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||
|
||||
///
|
||||
/// \brief saveValue
|
||||
/// save module config to .config/deepin/dde-dock.conf
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"api": "1.0"
|
||||
"api": "1.1"
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"api": "1.0"
|
||||
"api": "1.1"
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"api": "1.0"
|
||||
"api": "1.1"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"api": "1.0",
|
||||
"api": "1.1",
|
||||
"depends-daemon-dbus-service": "com.deepin.daemon.Network"
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"api": "1.0"
|
||||
"api": "1.1"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"api": "1.0",
|
||||
"api": "1.1",
|
||||
"depends-daemon-dbus-service": "com.deepin.daemon.Power"
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"api": "1.0"
|
||||
"api": "1.1"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"api": "1.0",
|
||||
"api": "1.1",
|
||||
"depends-daemon-dbus-service": "com.deepin.daemon.Audio"
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"api": "1.0"
|
||||
"api": "1.1"
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ Q_SIGNALS:
|
||||
void iconChanged();
|
||||
void clicked();
|
||||
void needAttention();
|
||||
void requestWindowAutoHide(const bool autoHide);
|
||||
void requestRefershWindowVisible();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
@ -122,12 +122,6 @@ void FashionTrayItem::trayWidgetAdded(const QString &itemKey, AbstractTrayWidget
|
||||
connect(wrapper, &FashionTrayWidgetWrapper::dragStop, this, &FashionTrayItem::onItemDragStop, Qt::UniqueConnection);
|
||||
connect(wrapper, &FashionTrayWidgetWrapper::requestSwapWithDragging, this, &FashionTrayItem::onItemRequestSwapWithDragging, Qt::UniqueConnection);
|
||||
|
||||
if (trayWidget->trayTyep() == AbstractTrayWidget::TrayType::SystemTray) {
|
||||
SystemTrayItem * sysTrayWidget = static_cast<SystemTrayItem *>(trayWidget);
|
||||
connect(sysTrayWidget, &SystemTrayItem::requestWindowAutoHide, this, &FashionTrayItem::requestWindowAutoHide, Qt::UniqueConnection);
|
||||
connect(sysTrayWidget, &SystemTrayItem::requestRefershWindowVisible, this, &FashionTrayItem::requestRefershWindowVisible, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
requestResize();
|
||||
}
|
||||
|
||||
@ -604,22 +598,6 @@ void FashionTrayItem::switchAttionTray(FashionTrayWidgetWrapper *attentionWrappe
|
||||
m_currentAttentionTray = attentionWrapper;
|
||||
}
|
||||
|
||||
void FashionTrayItem::requestWindowAutoHide(const bool autoHide)
|
||||
{
|
||||
// reset property "RequestWindowAutoHide" to EMIT the signal of DockItem
|
||||
// TODO: 考虑新增插件接口
|
||||
|
||||
setProperty("RequestWindowAutoHide", autoHide);
|
||||
}
|
||||
|
||||
void FashionTrayItem::requestRefershWindowVisible()
|
||||
{
|
||||
// reset property "RequestRefershWindowVisible" to EMIT the signal of DockItem
|
||||
// TODO: 考虑新增插件接口
|
||||
|
||||
setProperty("RequestRefershWindowVisible", !property("RequestRefershWindowVisible").toBool());
|
||||
}
|
||||
|
||||
void FashionTrayItem::refreshTraysVisible()
|
||||
{
|
||||
const bool expand = m_controlWidget->expanded();
|
||||
|
@ -77,8 +77,6 @@ private Q_SLOTS:
|
||||
void moveOutAttionTray();
|
||||
void moveInAttionTray();
|
||||
void switchAttionTray(FashionTrayWidgetWrapper *attentionWrapper);
|
||||
void requestWindowAutoHide(const bool autoHide);
|
||||
void requestRefershWindowVisible();
|
||||
void refreshTraysVisible();
|
||||
void onItemDragStart();
|
||||
void onItemDragStop();
|
||||
|
@ -54,10 +54,6 @@ public:
|
||||
QWidget *centralWidget() const;
|
||||
void detachPluginWidget();
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestWindowAutoHide(const bool autoHide) const;
|
||||
void requestRefershWindowVisible() const;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
#define API_VERSION "1.0"
|
||||
#define API_VERSION "1.1"
|
||||
|
||||
SystemTraysController::SystemTraysController(QObject *parent)
|
||||
: QObject(parent)
|
||||
@ -88,7 +88,23 @@ void SystemTraysController::requestContextMenu(PluginsItemInterface * const item
|
||||
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
||||
Q_ASSERT(item);
|
||||
|
||||
// item->showContextMenu();
|
||||
// item->showContextMenu();
|
||||
}
|
||||
|
||||
void SystemTraysController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)
|
||||
{
|
||||
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
||||
Q_ASSERT(item);
|
||||
|
||||
Q_EMIT item->requestWindowAutoHide(autoHide);
|
||||
}
|
||||
|
||||
void SystemTraysController::requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
SystemTrayItem *item = pluginItemAt(itemInter, itemKey);
|
||||
Q_ASSERT(item);
|
||||
|
||||
Q_EMIT item->requestRefershWindowVisible();
|
||||
}
|
||||
|
||||
void SystemTraysController::startLoader()
|
||||
|
@ -43,6 +43,8 @@ public:
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void requestContextMenu(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
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 saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value);
|
||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& failback = QVariant());
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"api": "1.0",
|
||||
"api": "1.1",
|
||||
"depends-daemon-dbus-service": "com.deepin.dde.TrayManager"
|
||||
}
|
||||
|
@ -260,6 +260,19 @@ bool TrayPlugin::isSystemTrayItem(const QString &itemKey)
|
||||
return false;
|
||||
}
|
||||
|
||||
QString TrayPlugin::itemKeyOfTrayWidget(AbstractTrayWidget *trayWidget)
|
||||
{
|
||||
QString itemKey;
|
||||
|
||||
if (displayMode() == Dock::DisplayMode::Fashion) {
|
||||
itemKey = FASHION_MODE_ITEM;
|
||||
} else {
|
||||
itemKey = m_trayMap.key(trayWidget);
|
||||
}
|
||||
|
||||
return itemKey;
|
||||
}
|
||||
|
||||
void TrayPlugin::sniItemsChanged()
|
||||
{
|
||||
const QStringList &itemServicePaths = m_sniWatcher->registeredStatusNotifierItems();
|
||||
@ -313,6 +326,9 @@ void TrayPlugin::addTrayWidget(const QString &itemKey, AbstractTrayWidget *trayW
|
||||
m_proxyInter->itemAdded(this, FASHION_MODE_ITEM);
|
||||
m_fashionItem->trayWidgetAdded(itemKey, trayWidget);
|
||||
}
|
||||
|
||||
connect(trayWidget, &AbstractTrayWidget::requestWindowAutoHide, this, &TrayPlugin::onRequestWindowAutoHide, Qt::UniqueConnection);
|
||||
connect(trayWidget, &AbstractTrayWidget::requestRefershWindowVisible, this, &TrayPlugin::onRequestRefershWindowVisible, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
void TrayPlugin::trayAdded(const QString &itemKey)
|
||||
@ -427,6 +443,28 @@ void TrayPlugin::onDbusNameOwnerChanged(const QString &name, const QString &oldO
|
||||
}
|
||||
}
|
||||
|
||||
void TrayPlugin::onRequestWindowAutoHide(const bool autoHide)
|
||||
{
|
||||
const QString &itemKey = itemKeyOfTrayWidget(static_cast<AbstractTrayWidget *>(sender()));
|
||||
|
||||
if (itemKey.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_proxyInter->requestWindowAutoHide(this, itemKey, autoHide);
|
||||
}
|
||||
|
||||
void TrayPlugin::onRequestRefershWindowVisible()
|
||||
{
|
||||
const QString &itemKey = itemKeyOfTrayWidget(static_cast<AbstractTrayWidget *>(sender()));
|
||||
|
||||
if (itemKey.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_proxyInter->requestRefreshWindowVisible(this, itemKey);
|
||||
}
|
||||
|
||||
void TrayPlugin::loadIndicator()
|
||||
{
|
||||
QDir indicatorConfDir("/etc/dde-dock/indicator");
|
||||
|
@ -69,6 +69,7 @@ private:
|
||||
void loadIndicator();
|
||||
const QString getWindowClass(quint32 winId);
|
||||
bool isSystemTrayItem(const QString &itemKey);
|
||||
QString itemKeyOfTrayWidget(AbstractTrayWidget *trayWidget);
|
||||
|
||||
private slots:
|
||||
void addTrayWidget(const QString &itemKey, AbstractTrayWidget *trayWidget);
|
||||
@ -80,6 +81,8 @@ private slots:
|
||||
void sniItemIconChanged();
|
||||
void switchToMode(const Dock::DisplayMode mode);
|
||||
void onDbusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
|
||||
void onRequestWindowAutoHide(const bool autoHide);
|
||||
void onRequestRefershWindowVisible();
|
||||
|
||||
private:
|
||||
DBusTrayManager *m_trayInter;
|
||||
|
Loading…
x
Reference in New Issue
Block a user