From 759127a32e7319195535267129212ae1bdddc96b Mon Sep 17 00:00:00 2001 From: xionglinlin Date: Tue, 9 Jul 2024 09:56:56 +0800 Subject: [PATCH 01/17] fix: window indicator margin Dynamically resize the window indicator margin size Issue: https://github.com/linuxdeepin/developer-center/issues/9577 --- panels/dock/taskmanager/package/AppItem.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/panels/dock/taskmanager/package/AppItem.qml b/panels/dock/taskmanager/package/AppItem.qml index fc683038c..afa4c783d 100644 --- a/panels/dock/taskmanager/package/AppItem.qml +++ b/panels/dock/taskmanager/package/AppItem.qml @@ -91,7 +91,13 @@ Item { windowIndicator.anchors.rightMargin = 0 windowIndicator.anchors.horizontalCenter = undefined windowIndicator.anchors.verticalCenter = undefined + let fixedDistance = 2 + if (Panel.position === Dock.Top || Panel.position === Dock.Bottom) { + fixedDistance = (root.height - Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE * iconScale) / 2 / 3 + } else { + fixedDistance = (root.width - Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE * iconScale) / 2 / 3 + } switch(Panel.position) { case Dock.Top: { @@ -339,4 +345,8 @@ Item { onIconGlobalPointChanged: { updateWindowIconGeometryTimer.start() } + + onIconScaleChanged: { + windowIndicator.updateIndicatorAnchors() + } } From a97a37b621ec9e450c176a86897d6f72b6a744f0 Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Tue, 9 Jul 2024 13:20:28 +0800 Subject: [PATCH 02/17] fix: quickpanel's main page doesn't show when reopened popup SubPluginPage. --- panels/dock/tray/quickpanel/QuickPanelPage.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/panels/dock/tray/quickpanel/QuickPanelPage.qml b/panels/dock/tray/quickpanel/QuickPanelPage.qml index 76799ff27..4263bb34e 100644 --- a/panels/dock/tray/quickpanel/QuickPanelPage.qml +++ b/panels/dock/tray/quickpanel/QuickPanelPage.qml @@ -56,6 +56,10 @@ Item { onRequestBack: function () { panelView.pop() } + onVisibleChanged: function () { + if (!visible) + panelView.pop() + } StackView.onActivating: function () { panelView.contentHeight = Qt.binding(function() { return contentHeight}) } From cbd08699c93692cf44765905d4e6421b74f2cad5 Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Tue, 9 Jul 2024 13:31:39 +0800 Subject: [PATCH 03/17] chore: remove warning as title. --- panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml | 6 ++++++ panels/dock/tray/traysortordermodel.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml index c33332c2e..c7fbd7311 100644 --- a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml +++ b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml @@ -78,6 +78,8 @@ Button { running: false repeat: false onTriggered: { + if (!pluginItem.plugin) + return if (pluginItem.itemGlobalPoint.x > 0 && pluginItem.itemGlobalPoint.y > 0) { pluginItem.plugin.updatePluginGeometry(Qt.rect(pluginItem.itemGlobalPoint.x, pluginItem.itemGlobalPoint.y, 0, 0)) } @@ -90,6 +92,8 @@ Button { running: false repeat: false onTriggered: { + if (!pluginItem.plugin) + return pluginItem.plugin.setGlobalPos(pluginItem.itemGlobalPos) } } @@ -103,6 +107,8 @@ Button { } onVisibleChanged: { + if (!pluginItem.plugin) + return pluginItem.plugin.setGlobalPos(pluginItem.itemGlobalPos) } } diff --git a/panels/dock/tray/traysortordermodel.cpp b/panels/dock/tray/traysortordermodel.cpp index 9a46f39f9..596ad0859 100644 --- a/panels/dock/tray/traysortordermodel.cpp +++ b/panels/dock/tray/traysortordermodel.cpp @@ -293,6 +293,7 @@ QStandardItem * TraySortOrderModel::createTrayItem(const QString & name, const Q item->setData(actualSectionType, TraySortOrderModel::SectionTypeRole); item->setData(delegateType, TraySortOrderModel::DelegateTypeRole); item->setData(forbiddenSections, TraySortOrderModel::ForbiddenSectionsRole); + item->setData(-1, TraySortOrderModel::VisualIndexRole); return item; } From e460974318e663c72cb7d2976e929d49cb3c5f99 Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Tue, 9 Jul 2024 15:39:51 +0800 Subject: [PATCH 04/17] fix: tray item sometimes shows empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当 tray item 被拖到托盘区域内后,有可能只显示位置而不显示图标的问题 (因为图标被放到了错误的位置)。这可能是因为 tray 分支 rebase 合入 主干时此段代码被回退了。 Log: --- panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml index c7fbd7311..d04a523be 100644 --- a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml +++ b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml @@ -16,9 +16,6 @@ import org.deepin.ds.dock.tray 1.0 as DDT Button { property alias inputEventsEnabled: surfaceItem.inputEventsEnabled - x: isHorizontal ? (model.visualIndex * (16 + 10)) : 0 - y: !isHorizontal ? (model.visualIndex * (16 + 10)) : 0 - property size visualSize: Qt.size(pluginItem.implicitWidth, pluginItem.implicitHeight) readonly property int itemWidth: isHorizontal ? 0 : DDT.TrayItemPositionManager.dockHeight From ad2a5eaaa8036af8fa88d605155534ce2cb1274f Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Tue, 9 Jul 2024 17:05:45 +0800 Subject: [PATCH 05/17] fix: popup's visible state is inconsistent with window send close to PopupSurface when popup is invisible. --- panels/dock/tray/CMakeLists.txt | 1 + panels/dock/tray/ShellSurfaceItemProxy.qml | 21 +++++++++++++++++++ panels/dock/tray/SurfacePopup.qml | 6 ++++-- panels/dock/tray/package/tray.qml | 10 ++++++--- panels/dock/tray/quickpanel/CMakeLists.txt | 1 - panels/dock/tray/quickpanel/DragItem.qml | 1 + panels/dock/tray/quickpanel/PanelTrayItem.qml | 1 + panels/dock/tray/quickpanel/PluginItem.qml | 1 + .../tray/quickpanel/ShellSurfaceItemProxy.qml | 10 --------- panels/dock/tray/quickpanel/SubPluginPage.qml | 1 + 10 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 panels/dock/tray/ShellSurfaceItemProxy.qml delete mode 100644 panels/dock/tray/quickpanel/ShellSurfaceItemProxy.qml diff --git a/panels/dock/tray/CMakeLists.txt b/panels/dock/tray/CMakeLists.txt index a1841e7cc..7c6825137 100644 --- a/panels/dock/tray/CMakeLists.txt +++ b/panels/dock/tray/CMakeLists.txt @@ -25,6 +25,7 @@ qt_add_qml_module(dock-tray ksortfilterproxymodel.h QML_FILES SurfacePopup.qml + ShellSurfaceItemProxy.qml OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/plugins/org/deepin/ds/dock/tray/ ) diff --git a/panels/dock/tray/ShellSurfaceItemProxy.qml b/panels/dock/tray/ShellSurfaceItemProxy.qml new file mode 100644 index 000000000..4e9d2b31d --- /dev/null +++ b/panels/dock/tray/ShellSurfaceItemProxy.qml @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick +import QtQuick.Controls +import QtWayland.Compositor + +ShellSurfaceItem { + property bool autoClose: false + onVisibleChanged: function () { + if (autoClose && !visible) + closeShellSurface() + } + function closeShellSurface() + { + if (surface && shellSurface) { + shellSurface.close() + } + } +} diff --git a/panels/dock/tray/SurfacePopup.qml b/panels/dock/tray/SurfacePopup.qml index b99a8da1c..9f3d1a0b8 100644 --- a/panels/dock/tray/SurfacePopup.qml +++ b/panels/dock/tray/SurfacePopup.qml @@ -27,9 +27,10 @@ Item { toolTipWindow: toolTipWindow property alias shellSurface: surfaceLayer.shellSurface - ShellSurfaceItem { + ShellSurfaceItemProxy { id: surfaceLayer anchors.centerIn: parent + autoClose: true onSurfaceDestroyed: function () { toolTip.close() } @@ -66,9 +67,10 @@ Item { popupWindow: popupWindow property alias shellSurface: popupSurfaceLayer.shellSurface - ShellSurfaceItem { + ShellSurfaceItemProxy { id: popupSurfaceLayer anchors.centerIn: parent + autoClose: true onSurfaceDestroyed: function () { popup.close() } diff --git a/panels/dock/tray/package/tray.qml b/panels/dock/tray/package/tray.qml index 67f6c05ea..a9d765718 100644 --- a/panels/dock/tray/package/tray.qml +++ b/panels/dock/tray/package/tray.qml @@ -11,6 +11,7 @@ import org.deepin.dtk 1.0 as D import org.deepin.ds 1.0 import org.deepin.ds.dock 1.0 +import org.deepin.ds.dock.tray 1.0 import org.deepin.ds.dock.tray 1.0 as DDT AppletItem { @@ -38,9 +39,10 @@ AppletItem { Item { anchors.fill: parent - ShellSurfaceItem { + ShellSurfaceItemProxy { id: popupContent anchors.centerIn: parent + autoClose: true onSurfaceDestroyed: function () { popup.close() } @@ -58,9 +60,10 @@ AppletItem { Item { anchors.fill: parent - ShellSurfaceItem { + ShellSurfaceItemProxy { id: popupMenuContent anchors.centerIn: parent + autoClose: true onSurfaceDestroyed: function () { popupMenu.close() } @@ -74,9 +77,10 @@ AppletItem { toolTipX: DockPanelPositioner.x toolTipY: DockPanelPositioner.y - ShellSurfaceItem { + ShellSurfaceItemProxy { id: toolTipContent anchors.centerIn: parent + autoClose: true onSurfaceDestroyed: function () { toolTip.close() } diff --git a/panels/dock/tray/quickpanel/CMakeLists.txt b/panels/dock/tray/quickpanel/CMakeLists.txt index d34dd435e..d292cb81a 100644 --- a/panels/dock/tray/quickpanel/CMakeLists.txt +++ b/panels/dock/tray/quickpanel/CMakeLists.txt @@ -18,7 +18,6 @@ qt_add_qml_module(tray-quickpanel QuickPanelModel.qml QuickPanelPage.qml SubPluginPage.qml - ShellSurfaceItemProxy.qml OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/plugins/org/deepin/ds/dock/tray/quickpanel" ) diff --git a/panels/dock/tray/quickpanel/DragItem.qml b/panels/dock/tray/quickpanel/DragItem.qml index ce2b926c2..8a7156e0f 100644 --- a/panels/dock/tray/quickpanel/DragItem.qml +++ b/panels/dock/tray/quickpanel/DragItem.qml @@ -8,6 +8,7 @@ import QtQuick.Window import org.deepin.ds 1.0 import org.deepin.dtk 1.0 +import org.deepin.ds.dock.tray 1.0 import org.deepin.ds.dock.tray.quickpanel 1.0 Item { diff --git a/panels/dock/tray/quickpanel/PanelTrayItem.qml b/panels/dock/tray/quickpanel/PanelTrayItem.qml index 54352ac67..610e24b9f 100644 --- a/panels/dock/tray/quickpanel/PanelTrayItem.qml +++ b/panels/dock/tray/quickpanel/PanelTrayItem.qml @@ -9,6 +9,7 @@ import QtQml import org.deepin.ds 1.0 import org.deepin.ds.dock 1.0 +import org.deepin.ds.dock.tray 1.0 import org.deepin.dtk 1.0 Control { diff --git a/panels/dock/tray/quickpanel/PluginItem.qml b/panels/dock/tray/quickpanel/PluginItem.qml index b5c555928..352d1566b 100644 --- a/panels/dock/tray/quickpanel/PluginItem.qml +++ b/panels/dock/tray/quickpanel/PluginItem.qml @@ -6,6 +6,7 @@ import QtQuick import QtQuick.Controls import org.deepin.dtk 1.0 +import org.deepin.ds.dock.tray 1.0 Control { id: root diff --git a/panels/dock/tray/quickpanel/ShellSurfaceItemProxy.qml b/panels/dock/tray/quickpanel/ShellSurfaceItemProxy.qml deleted file mode 100644 index f55abe690..000000000 --- a/panels/dock/tray/quickpanel/ShellSurfaceItemProxy.qml +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -import QtQuick -import QtQuick.Controls -import QtWayland.Compositor - -ShellSurfaceItem { -} diff --git a/panels/dock/tray/quickpanel/SubPluginPage.qml b/panels/dock/tray/quickpanel/SubPluginPage.qml index 6693703b2..9e7b915de 100644 --- a/panels/dock/tray/quickpanel/SubPluginPage.qml +++ b/panels/dock/tray/quickpanel/SubPluginPage.qml @@ -7,6 +7,7 @@ import QtQuick.Controls import QtQuick.Layouts import org.deepin.dtk 1.0 +import org.deepin.ds.dock.tray 1.0 Item { id: root From 6b06047b919bf055e8d2cfb15ab0a6d014fbbb8b Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Tue, 9 Jul 2024 17:53:25 +0800 Subject: [PATCH 06/17] fix: incorrect quickpanel's drag key using tray's itemKey instead of quickpanel's itemKey. --- .../dock/tray/quickpanel/PanelPluginPage.qml | 2 +- .../tray/quickpanel/quickpanelproxymodel.cpp | 18 ++++++++++++++++-- .../tray/quickpanel/quickpanelproxymodel.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/panels/dock/tray/quickpanel/PanelPluginPage.qml b/panels/dock/tray/quickpanel/PanelPluginPage.qml index 41149bb95..c1d1ba092 100644 --- a/panels/dock/tray/quickpanel/PanelPluginPage.qml +++ b/panels/dock/tray/quickpanel/PanelPluginPage.qml @@ -81,7 +81,7 @@ Item { height: 60 shellSurface: model.surface pluginId: model.pluginId - itemKey: model.surfaceItemKey + itemKey: model.traySurfaceItemKey traySurface: model.traySurface Connections { diff --git a/panels/dock/tray/quickpanel/quickpanelproxymodel.cpp b/panels/dock/tray/quickpanel/quickpanelproxymodel.cpp index a6c0407de..6d9a64c57 100644 --- a/panels/dock/tray/quickpanel/quickpanelproxymodel.cpp +++ b/panels/dock/tray/quickpanel/quickpanelproxymodel.cpp @@ -17,7 +17,8 @@ enum { QuickSurface, QuickSurfaceLayoutType, QuickSurfaceItemKey, - TraySurface + TraySurface, + TraySurfaceItemKey } ProxyRole; } QuickPanelProxyModel::QuickPanelProxyModel(QObject *parent) @@ -81,6 +82,10 @@ QVariant QuickPanelProxyModel::data(const QModelIndex &index, int role) const const auto id = surfacePluginId(sourceIndex); return QVariant::fromValue(traySurfaceObject(id)); } + case TraySurfaceItemKey: { + const auto id = surfacePluginId(sourceIndex); + return traySurfaceItemKey(id); + } } return {}; } @@ -94,6 +99,7 @@ QHash QuickPanelProxyModel::roleNames() const {QuickSurfaceLayoutType, "surfaceLayoutType"}, // quick surface's layout type. (1, signal), (2, multi), (4, full) {QuickSurfaceItemKey, "surfaceItemKey"}, // quick surface's itemKey. {TraySurface, "traySurface"},// tray surface item. + {TraySurfaceItemKey, "traySurfaceItemKey"},// tray surface itemKey. }; return roles; } @@ -247,6 +253,14 @@ QObject *QuickPanelProxyModel::traySurfaceObject(const QString &pluginId) const return nullptr; } +QString QuickPanelProxyModel::traySurfaceItemKey(const QString &pluginId) const +{ + if (auto object = traySurfaceObject(pluginId)) + return object->property("itemKey").toString(); + + return QString(); +} + int QuickPanelProxyModel::roleByName(const QByteArray &roleName) const { if (!surfaceModel()) @@ -264,7 +278,7 @@ void QuickPanelProxyModel::updateTrayItemSurface() { emit trayItemSurfaceChanged(); if (rowCount() > 0) - emit dataChanged(index(0, 0), index(rowCount() - 1, 0), {TraySurface}); + emit dataChanged(index(0, 0), index(rowCount() - 1, 0), {TraySurface, TraySurfaceItemKey}); } void QuickPanelProxyModel::classBegin() diff --git a/panels/dock/tray/quickpanel/quickpanelproxymodel.h b/panels/dock/tray/quickpanel/quickpanelproxymodel.h index b52112c5b..b3e6d1072 100644 --- a/panels/dock/tray/quickpanel/quickpanelproxymodel.h +++ b/panels/dock/tray/quickpanel/quickpanelproxymodel.h @@ -65,6 +65,7 @@ class QuickPanelProxyModel : public QSortFilterProxyModel, public QQmlParserStat QModelIndex surfaceIndex(const QString &pluginId) const; QObject *surfaceObject(const QModelIndex &index) const; QObject *traySurfaceObject(const QString &pluginId) const; + QString traySurfaceItemKey(const QString &pluginId) const; int roleByName(const QByteArray &roleName) const; QAbstractListModel *surfaceModel() const; private slots: From 251bb74812f2b4126abf367b6e2e5b5c7b083de9 Mon Sep 17 00:00:00 2001 From: Tsic Liu Date: Wed, 10 Jul 2024 10:55:28 +0800 Subject: [PATCH 07/17] feat: add rotation animation when open stashdelegate log: as title --- .../tray/package/ActionShowStashDelegate.qml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/panels/dock/tray/package/ActionShowStashDelegate.qml b/panels/dock/tray/package/ActionShowStashDelegate.qml index fd7d764c7..a2e65e7da 100644 --- a/panels/dock/tray/package/ActionShowStashDelegate.qml +++ b/panels/dock/tray/package/ActionShowStashDelegate.qml @@ -26,6 +26,31 @@ D.ToolButton { icon.height: height display: D.IconLabel.IconOnly + states: [ + State { + name: "opened" + PropertyChanges { target: root; rotation: 180 } + }, + + State { + name: "closed" + PropertyChanges { target: root; rotation: 0 } + } + ] + + transitions: [ + Transition { + RotationAnimation { duration: 200; } + } + ] + + Binding { + target: root + property: "state" + value: stashedPopup.popupVisible ? "opened" : "closed" + when: stashedPopup.popupVisibleChanged + } + onClicked: { var point = root.mapToItem(null, root.width / 2, 0) stashedPopup.popupX = Qt.binding(function () { From 7ff08a61ea9f7a4db609607cdf6fda0b47d0209d Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Wed, 10 Jul 2024 10:53:28 +0800 Subject: [PATCH 08/17] fix: workaround dxcb/DWindow might cause DragEvent get rejected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当给 QuickDragWindow 设置任何 DWindow 属性时,都可能导致 DragEvent 在拖拽过程中被 reject。此处暂时绕过此问题。 Log: --- panels/dock/tray/quickpanel/DragItem.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/panels/dock/tray/quickpanel/DragItem.qml b/panels/dock/tray/quickpanel/DragItem.qml index 8a7156e0f..cb7955987 100644 --- a/panels/dock/tray/quickpanel/DragItem.qml +++ b/panels/dock/tray/quickpanel/DragItem.qml @@ -71,10 +71,11 @@ Item { return h } - DWindow.enabled: true - DWindow.enableBlurWindow: !isFallbackIcon - DWindow.shadowRadius: 0 - DWindow.borderWidth: 0 + // TODO: turn on this can cause DnD drag event get rejected, it's likely a dxcb bug. + // DWindow.enabled: true + // DWindow.enableBlurWindow: !isFallbackIcon + // DWindow.shadowRadius: 0 + // DWindow.borderWidth: 0 ColorSelector.family: Palette.CrystalColor height: getHeight() From ece0a48b5906caad9059e5145c606085d1e6af06 Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Wed, 10 Jul 2024 13:45:38 +0800 Subject: [PATCH 09/17] chore: update tray's icon to override system's icon as title. --- panels/dock/tray/package/icons/arrow-down.dci | Bin 0 -> 777 bytes panels/dock/tray/package/icons/arrow-left.dci | Bin 0 -> 775 bytes panels/dock/tray/package/icons/arrow-right.dci | Bin 0 -> 769 bytes panels/dock/tray/package/icons/arrow-up.dci | Bin 0 -> 771 bytes .../tray/package/icons/dock-control-panel.dci | Bin 0 -> 787 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 panels/dock/tray/package/icons/arrow-down.dci create mode 100644 panels/dock/tray/package/icons/arrow-left.dci create mode 100644 panels/dock/tray/package/icons/arrow-right.dci create mode 100644 panels/dock/tray/package/icons/arrow-up.dci create mode 100644 panels/dock/tray/package/icons/dock-control-panel.dci diff --git a/panels/dock/tray/package/icons/arrow-down.dci b/panels/dock/tray/package/icons/arrow-down.dci new file mode 100644 index 0000000000000000000000000000000000000000..dd2d040d8c2818c63cc47382cb4c261d75cba0f6 GIT binary patch literal 777 zcmZ>9_GDmWWME)2G-IFy>|}!IX3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyxCR&jAV8_7O`zs5!W;%M zmSpk`R7a4fo7)p0JKWVNAS}Sb=Q@zBuYZ7BpnTziTMMHjE5QC#28+_`Kj!6$I5fhQXhBh{3dm6+l-vE&!_#-WMTjS(Vv8* literal 0 HcmV?d00001 diff --git a/panels/dock/tray/package/icons/arrow-left.dci b/panels/dock/tray/package/icons/arrow-left.dci new file mode 100644 index 0000000000000000000000000000000000000000..3f1fc15ea0109ab07073d8b3f373d0061da93e66 GIT binary patch literal 775 zcmZ>9_GDmWWME)2G-IFyY-fV#X3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyxC$5nAV8_7jiBZ*!W;%M zmSpl3R7a4fo7*EGJKWVNAS}Sb=PHn`uYZ7BVEw`cxzfk}c)sU9{OA1sN855A7o@8H ze0Hx6I5=R<<3pNeQf*8&-3rU z+8gKcUvx|E;WaN64TPRj80xLEWH)BLv!p8t5oX8Y^;a`9T$J5yK474*e@6`k9y7Y6W>y&rq&jPFL|MV~Bshc@%#jn$mOYhv$VgLZa3yM7e literal 0 HcmV?d00001 diff --git a/panels/dock/tray/package/icons/arrow-right.dci b/panels/dock/tray/package/icons/arrow-right.dci new file mode 100644 index 0000000000000000000000000000000000000000..bc999f41bd84b0b73925cf4959f6e1f74f7ba5aa GIT binary patch literal 769 zcmZ>9_GDmWWME)2G-IFyY-EDyX3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyxC9shAV8_7b)e=j!W;%M zmSpk?R7a4fo7){AJKWVNAS}Sb=K_$euYZ7BVE)1dxzfk}c)sU9{OA1sS!R>&ym*_R zvHlOolkW_o%oT}D22ux|ofX(voEf&TJ2A63aIi269AST8Hc7?xR&rWh+Otph4_=Gw zezCuCOYT0mL%uWqS643mmYnaoo~g`j7xRXx^J-bHU791j;Zhl!*rhw%2GgI#HhRvg zXLrjy$Skp>)qlZcvHcBUQJ)&)6?6GL=BF^rOu2U8qF5A@x_buWoT+ICj*8A|n5}NY mR34wfAlDecZlk9_GDmWWME)2G-IFyY-WP!X3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyxC|HpAV8_7^`Pc3!W;%M zmSpl7R7a4fo7+7gJKWVNAS}Sb=OU1;uYZ7Bz<=R_TUiz-{S zJ%0*z{I@-DqJf=>L0Ec$fLPN4jxHsQBIg8_Mn)cGgF2A{70)1*(DypV#+(2D@8;gC zd{0yG@BD@z+IL<~$@x*k=WW^)*m*3j&)fLm<3>-^JiJ!);;zK7Cd+ka zJ35|;ex9#ekay(tG1hK*-NIGJZ~x*vJ%3HXnxpMomBW5sl4{SYiLp(XYqXU2n`=$v on~k28RX0RGmTq*`_n)4tY81Au9_GDmWWME)2G-IFy9A<*(X3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyxD6NqAV8_7?V#o`!W;%M zmSpl9R7a4fo7+1eJKWVNAS}Sb=Mj*tuYZ7B;J(5C&-VYjZo35)pDy4zznfu>f`f*D zEZY%BcX!vLM_rj8J#M@Zpg1EzKwzE9?JOk&=4XHQ{EmNlK-%E9_{Dm*JZViYvHp$y z0{Whj-;5O!_v*L*z5n~&{j2Zpzy0_B=;}{xMQu`|oc5Pb%6_tR zj;gr5>F}hV{?h+v_&LY(&&tYcwzFROZ$AEL&hq=I+xwQ@dAj%b;%NJ* Ga~uF!nvuQ$ literal 0 HcmV?d00001 From 82cd13a21194e7c32c46dd9be78125aedd39339b Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Wed, 10 Jul 2024 14:19:43 +0800 Subject: [PATCH 10/17] feat: support dock's layout for quickpanel as title. Issue: https://github.com/linuxdeepin/developer-center/issues/9624 --- .../dock/tray/package/ActionToggleQuickSettingsDelegate.qml | 1 + panels/dock/tray/quickpanel/PanelTrayItem.qml | 4 +++- panels/dock/tray/quickpanel/QuickPanel.qml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml b/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml index 6c83ef10b..7f6cb6b5a 100644 --- a/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml +++ b/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml @@ -9,5 +9,6 @@ import org.deepin.ds.dock.tray.quickpanel 1.0 QuickPanel { property bool isHorizontal: false + useColumnLayout: !isHorizontal trayItemPluginId: Applet.rootObject.quickpanelTrayItemPluginId } diff --git a/panels/dock/tray/quickpanel/PanelTrayItem.qml b/panels/dock/tray/quickpanel/PanelTrayItem.qml index 610e24b9f..956017b0c 100644 --- a/panels/dock/tray/quickpanel/PanelTrayItem.qml +++ b/panels/dock/tray/quickpanel/PanelTrayItem.qml @@ -14,6 +14,7 @@ import org.deepin.dtk 1.0 Control { id: root + property bool useColumnLayout: false required property var shellSurface property bool isOpened signal clicked() @@ -28,8 +29,9 @@ Control { toolTipY: DockPanelPositioner.y } - contentItem: RowLayout { + contentItem: Grid { spacing: 5 + rows: root.useColumnLayout ? 2 : 1 Loader { active: root.shellSurface diff --git a/panels/dock/tray/quickpanel/QuickPanel.qml b/panels/dock/tray/quickpanel/QuickPanel.qml index 3ea417373..778be7fe2 100644 --- a/panels/dock/tray/quickpanel/QuickPanel.qml +++ b/panels/dock/tray/quickpanel/QuickPanel.qml @@ -22,6 +22,7 @@ Item { implicitHeight: { return panelTrayItem.height } + property alias useColumnLayout: panelTrayItem.useColumnLayout property string trayItemPluginId: "sound" PanelTrayItem { From b483733f1c4c48997bcf0048b3865d0c1c62b53d Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Wed, 10 Jul 2024 15:26:37 +0800 Subject: [PATCH 11/17] fix: tooltip and popup can't be displayed together Remove the feature for panelpopup. --- frame/panel.cpp | 14 -------------- frame/private/panel_p.h | 1 - 2 files changed, 15 deletions(-) diff --git a/frame/panel.cpp b/frame/panel.cpp index 5175d2980..e194c9cb4 100644 --- a/frame/panel.cpp +++ b/frame/panel.cpp @@ -109,10 +109,6 @@ void DPanelPrivate::ensurePopupWindow() const if (m_popupWindow) { qCDebug(dsLog) << "Create PopupWidow successfully."; m_popupWindow->setTransientParent(q->window()); - QObject::connect(m_popupWindow, &QWindow::visibleChanged, q, [this] (bool arg) { - if (arg) - closeWindow(m_toolTipWindow); - }); Q_EMIT const_cast(q)->popupWindowChanged(); } } @@ -134,18 +130,8 @@ void DPanelPrivate::ensureToolTipWindow() const if (m_toolTipWindow) { qCDebug(dsLog) << "Create ToolTipWindow successfully."; m_toolTipWindow->setTransientParent(q->window()); - QObject::connect(m_toolTipWindow, &QWindow::visibleChanged, q, [this] (bool arg) { - if (arg) - closeWindow(m_popupWindow); - }); Q_EMIT const_cast(q)->toolTipWindowChanged(); } } -void DPanelPrivate::closeWindow(QWindow *window) -{ - if (window && window->isVisible()) - window->close(); -} - DS_END_NAMESPACE diff --git a/frame/private/panel_p.h b/frame/private/panel_p.h index db589a7e3..5e9cbcc81 100644 --- a/frame/private/panel_p.h +++ b/frame/private/panel_p.h @@ -27,7 +27,6 @@ class DPanelPrivate : public DContainmentPrivate void initDciSearchPaths(); void ensurePopupWindow() const; void ensureToolTipWindow() const; - static void closeWindow(QWindow *window); DQmlEngine *m_engine = nullptr; QQuickWindow *m_popupWindow = nullptr; From 5f1d9c8d1e77edb8bc48a6b118e406bf69bc36f5 Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Wed, 10 Jul 2024 15:20:24 +0800 Subject: [PATCH 12/17] feat: support isItemActive property for tray plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持 isItemActive 托盘插件属性(但是目前似乎没有插件用了这个属性) Log: --- .../ActionLegacyTrayPluginDelegate.qml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml index d04a523be..b07c68866 100644 --- a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml +++ b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml @@ -8,6 +8,7 @@ import QtQuick.Layouts import QtWayland.Compositor import Qt.labs.platform 1.1 as LP import org.deepin.dtk 1.0 as D +import org.deepin.dtk.private 1.0 as DP import org.deepin.ds 1.0 import org.deepin.ds.dock 1.0 @@ -20,6 +21,13 @@ Button { readonly property int itemWidth: isHorizontal ? 0 : DDT.TrayItemPositionManager.dockHeight readonly property int itemHeight: isHorizontal ? DDT.TrayItemPositionManager.dockHeight : 0 + readonly property int inset: 4 + + topInset: -inset + bottomInset: -inset + leftInset: -inset + rightInset: -inset + padding: inset contentItem: Item { id: pluginItem @@ -58,6 +66,11 @@ Button { return Qt.point(x, y) } + HoverHandler { + id: hoverHandler + parent: surfaceItem + } + ShellSurfaceItem { id: surfaceItem anchors.centerIn: parent @@ -110,6 +123,17 @@ Button { } } + D.ColorSelector.hovered: (pluginItem.plugin.isItemActive ?? false) || hoverHandler.hovered + background: D.BoxPanel { + property D.Palette backgroundPalette: DockPalette.backgroundPalette + + color2: color1 + color1: backgroundPalette + + outsideBorderColor: null + insideBorderColor: null + } + property Component overlayWindow: QuickDragWindow { height: parent.visualSize.height width: parent.visualSize.width From a93764e01a99daf78f35b58c242e464a3184f654 Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Wed, 10 Jul 2024 15:44:19 +0800 Subject: [PATCH 13/17] fix: client's surface maybe invalid Close shellSurface in next event loop, surface maybe has be correct state. --- panels/dock/tray/ShellSurfaceItemProxy.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panels/dock/tray/ShellSurfaceItemProxy.qml b/panels/dock/tray/ShellSurfaceItemProxy.qml index 4e9d2b31d..c8d1b3856 100644 --- a/panels/dock/tray/ShellSurfaceItemProxy.qml +++ b/panels/dock/tray/ShellSurfaceItemProxy.qml @@ -9,8 +9,10 @@ import QtWayland.Compositor ShellSurfaceItem { property bool autoClose: false onVisibleChanged: function () { - if (autoClose && !visible) - closeShellSurface() + if (autoClose && !visible) { + // surface is valid but client's shellSurface maybe invalid. + Qt.callLater(closeShellSurface) + } } function closeShellSurface() { From 5d3f843fe8a597b81fb9e8e9ffa2fb9c1837d7b3 Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Wed, 10 Jul 2024 17:10:59 +0800 Subject: [PATCH 14/17] fix: popup and tooltip is displayed together for quickpanel closing or not showing tooltip when quickpanel is shown. --- panels/dock/DockCompositor.qml | 7 ++++++ panels/dock/tray/ShellSurfaceItemProxy.qml | 3 ++- .../ActionToggleQuickSettingsDelegate.qml | 7 ++++++ panels/dock/tray/package/tray.qml | 22 +++++++++++++++++++ panels/dock/tray/quickpanel/PanelTrayItem.qml | 2 +- panels/dock/tray/quickpanel/QuickPanel.qml | 1 + 6 files changed, 40 insertions(+), 2 deletions(-) diff --git a/panels/dock/DockCompositor.qml b/panels/dock/DockCompositor.qml index dab5c2e96..6db2becc7 100644 --- a/panels/dock/DockCompositor.qml +++ b/panels/dock/DockCompositor.qml @@ -53,6 +53,13 @@ Item { return ret } + function closeShellSurface(shellSurface) + { + if (shellSurface) { + shellSurface.close() + } + } + WaylandCompositor { id: waylandCompositor socketName: "dockplugin" diff --git a/panels/dock/tray/ShellSurfaceItemProxy.qml b/panels/dock/tray/ShellSurfaceItemProxy.qml index c8d1b3856..8a9235df0 100644 --- a/panels/dock/tray/ShellSurfaceItemProxy.qml +++ b/panels/dock/tray/ShellSurfaceItemProxy.qml @@ -5,6 +5,7 @@ import QtQuick import QtQuick.Controls import QtWayland.Compositor +import org.deepin.ds.dock 1.0 ShellSurfaceItem { property bool autoClose: false @@ -17,7 +18,7 @@ ShellSurfaceItem { function closeShellSurface() { if (surface && shellSurface) { - shellSurface.close() + DockCompositor.closeShellSurface(shellSurface) } } } diff --git a/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml b/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml index 7f6cb6b5a..94f4861f8 100644 --- a/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml +++ b/panels/dock/tray/package/ActionToggleQuickSettingsDelegate.qml @@ -8,7 +8,14 @@ import org.deepin.ds 1.0 import org.deepin.ds.dock.tray.quickpanel 1.0 QuickPanel { + id: root property bool isHorizontal: false useColumnLayout: !isHorizontal trayItemPluginId: Applet.rootObject.quickpanelTrayItemPluginId + Component.onCompleted: function () { + Applet.rootObject.quickPanelIsOpened = Qt.binding(function () { + return root.isOpened + }) + } + } diff --git a/panels/dock/tray/package/tray.qml b/panels/dock/tray/package/tray.qml index a9d765718..63bd9154e 100644 --- a/panels/dock/tray/package/tray.qml +++ b/panels/dock/tray/package/tray.qml @@ -21,6 +21,8 @@ AppletItem { property int dockOrder: 25 readonly property string quickpanelTrayItemPluginId: "sound" readonly property var filterTrayPlugins: [quickpanelTrayItemPluginId] + property bool quickPanelIsOpened: false + implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : overflowId.implicitWidth implicitHeight: useColumnLayout ? overflowId.implicitHeight : Panel.rootObject.dockSize Component.onCompleted: { @@ -141,6 +143,20 @@ AppletItem { } } + function isQuickPanelPopup(popupSurface) + { + return popupSurface && + popupSurface.pluginId === tray.quickpanelTrayItemPluginId + } + onQuickPanelIsOpenedChanged: function () + { + if (tray.quickPanelIsOpened && + toolTip.toolTipVisible && + isQuickPanelPopup(toolTip.shellSurface)) { + toolTip.close() + } + } + Connections { target: DockCompositor function onPopupCreated(popupSurface) @@ -149,6 +165,12 @@ AppletItem { return if (popupSurface.popupType === Dock.TrayPopupTypeTooltip) { + if (tray.quickPanelIsOpened && isQuickPanelPopup(popupSurface)) { + // don't show the surface, and release it. + DockCompositor.closeShellSurface(popupSurface) + return + } + toolTip.shellSurface = popupSurface toolTip.DockPanelPositioner.bounding = Qt.binding(function () { var point = Qt.point(toolTip.shellSurface.x, toolTip.shellSurface.y) diff --git a/panels/dock/tray/quickpanel/PanelTrayItem.qml b/panels/dock/tray/quickpanel/PanelTrayItem.qml index 956017b0c..1459aa029 100644 --- a/panels/dock/tray/quickpanel/PanelTrayItem.qml +++ b/panels/dock/tray/quickpanel/PanelTrayItem.qml @@ -55,7 +55,7 @@ Control { enabled: !root.isOpened onHoveredChanged: function () { root.contentHovered = hovered - if (hovered) { + if (hovered && !root.isOpened) { var point = quickpanelPlaceholder.mapToItem(null, quickpanelPlaceholder.width / 2, quickpanelPlaceholder.height / 2) toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height) toolTip.open() diff --git a/panels/dock/tray/quickpanel/QuickPanel.qml b/panels/dock/tray/quickpanel/QuickPanel.qml index 778be7fe2..6fc000b2e 100644 --- a/panels/dock/tray/quickpanel/QuickPanel.qml +++ b/panels/dock/tray/quickpanel/QuickPanel.qml @@ -24,6 +24,7 @@ Item { } property alias useColumnLayout: panelTrayItem.useColumnLayout property string trayItemPluginId: "sound" + readonly property bool isOpened: panelTrayItem.isOpened PanelTrayItem { id: panelTrayItem From b83311819dad1c183b45c9698da1c8508910d3a3 Mon Sep 17 00:00:00 2001 From: Tsic Date: Thu, 11 Jul 2024 10:20:28 +0800 Subject: [PATCH 15/17] fix: mouse dance when click ToggleCollapse (#545) not send event to plugin when it's invisible log: as title issue: https://github.com/linuxdeepin/developer-center/issues/9608 --- panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml index b07c68866..ef5f1168f 100644 --- a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml +++ b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml @@ -75,6 +75,7 @@ Button { id: surfaceItem anchors.centerIn: parent shellSurface: pluginItem.plugin + inputEventsEnabled: !DDT.TraySortOrderModel.collapsed } Component.onCompleted: { From 1d4008890e3a8b5b7386ef7d0fa7da71ced98f6e Mon Sep 17 00:00:00 2001 From: Tsic Date: Thu, 11 Jul 2024 10:26:27 +0800 Subject: [PATCH 16/17] fix: tray shake when playing animation (#544) TrayContainer will shake while in a layout, so tmp remove it from layout and use anchors It's better to use deletegatechooser to manager all items like tray log: as title --- panels/dock/OverflowContainer.qml | 55 ++++++++----------------------- panels/dock/package/main.qml | 29 ++++++++-------- panels/dock/tray/package/tray.qml | 29 +++++----------- 3 files changed, 38 insertions(+), 75 deletions(-) diff --git a/panels/dock/OverflowContainer.qml b/panels/dock/OverflowContainer.qml index b22a5f173..1402f849b 100644 --- a/panels/dock/OverflowContainer.qml +++ b/panels/dock/OverflowContainer.qml @@ -7,50 +7,12 @@ import QtQuick.Layouts 2.15 Item { id: root - // NOTE: if the value is assigned, and not -1, it will use this value as implicitWidth - property int assignedWidth: -1 - property int assignedHeight: -1 required property bool useColumnLayout property alias model: listView.model property alias delegate: listView.delegate property alias spacing: listView.spacing property alias count: listView.count property alias displaced: listView.displaced - - // NOTE: the width calculated by contentItems - property int suggestedWidth: { - let width = 0 - for (let child of listView.contentItem.visibleChildren) { - width = calculateImplicitWidth(width, child.implicitWidth) - } - return width - } - - // NOTE: the height calculated by contentItems - property int suggestedHeight: { - let height = 0 - for (let child of listView.contentItem.visibleChildren) { - height = calculateImplicitHeight(height, child.implicitHeight) - } - return height - } - - // NOTE: provide width value for other objects - property int suggestedImplicitWidth : { - if (root.assignedWidth !== -1) { - return root.assignedWidth - } - return root.suggestedWidth - } - - // NOTE: provide height value for other objects - property int suggestedImplicitHeight : { - if (root.assignedHeight !== -1) { - return root.assignedHeight - } - return root.suggestedHeight - } - ListView { id: listView anchors.fill: parent @@ -76,7 +38,18 @@ Item { } } - // FIXME: find 2 * root.spacing comes from where - implicitWidth: root.suggestedImplicitWidth - (useColumnLayout ? 0 : 2 * root.spacing) - implicitHeight: root.suggestedImplicitHeight - (useColumnLayout ? 2 * root.spacing : 0) + implicitWidth: { + let width = 0 + for (let child of listView.contentItem.visibleChildren) { + width = calculateImplicitWidth(width, child.implicitWidth) + } + return width + } + implicitHeight: { + let height = 0 + for (let child of listView.contentItem.visibleChildren) { + height = calculateImplicitHeight(height, child.implicitHeight) + } + return height + } } diff --git a/panels/dock/package/main.qml b/panels/dock/package/main.qml index 3518123d3..28f57d58f 100644 --- a/panels/dock/package/main.qml +++ b/panels/dock/package/main.qml @@ -267,6 +267,7 @@ Window { } } + // TODO: remove GridLayout and use delegatechosser manager all items GridLayout { id: gridLayout anchors.fill: parent @@ -329,21 +330,21 @@ Window { Layout.fillWidth: true Layout.fillHeight: true } + } - Item { - id: dockRightPart - implicitWidth: rightLoader.implicitWidth - implicitHeight: rightLoader.implicitHeight - Layout.alignment: Qt.AlignRight | Qt.AlignBottom - OverflowContainer { - id: rightLoader - anchors.fill: parent - useColumnLayout: dock.useColumnLayout - model: DockPartAppletModel { - id: dockRightPartModel - leftDockOrder: 20 - rightDockOrder: 30 - } + Item { + id: dockRightPart + implicitWidth: rightLoader.implicitWidth + implicitHeight: rightLoader.implicitHeight + anchors.right: parent.right + OverflowContainer { + id: rightLoader + anchors.fill: parent + useColumnLayout: dock.useColumnLayout + model: DockPartAppletModel { + id: dockRightPartModel + leftDockOrder: 20 + rightDockOrder: 30 } } } diff --git a/panels/dock/tray/package/tray.qml b/panels/dock/tray/package/tray.qml index 63bd9154e..b8866bf24 100644 --- a/panels/dock/tray/package/tray.qml +++ b/panels/dock/tray/package/tray.qml @@ -4,7 +4,6 @@ import QtQuick import QtQuick.Controls -import QtQuick.Layouts import QtWayland.Compositor import Qt.labs.platform 1.1 as LP import org.deepin.dtk 1.0 as D @@ -23,8 +22,8 @@ AppletItem { readonly property var filterTrayPlugins: [quickpanelTrayItemPluginId] property bool quickPanelIsOpened: false - implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : overflowId.implicitWidth - implicitHeight: useColumnLayout ? overflowId.implicitHeight : Panel.rootObject.dockSize + implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : trayContainter.implicitWidth + implicitHeight: useColumnLayout ? trayContainter.implicitHeight : Panel.rootObject.dockSize Component.onCompleted: { Applet.trayPluginModel = Qt.binding(function () { return DockCompositor.trayPluginSurfaces @@ -124,23 +123,13 @@ AppletItem { } } - GridLayout { - id: overflowId - columns: 1 - rows: 1 - anchors.centerIn: parent - flow: useColumnLayout ? GridLayout.LeftToRight : GridLayout.TopToBottom - property bool trayVisible: true - columnSpacing: 10 - rowSpacing: 10 - - TrayContainer { - isHorizontal: !tray.useColumnLayout - model: DDT.TraySortOrderModel - collapsed: DDT.TraySortOrderModel.collapsed - trayHeight: isHorizontal ? tray.implicitHeight : tray.implicitWidth - color: "transparent" - } + TrayContainer { + id: trayContainter + isHorizontal: !tray.useColumnLayout + model: DDT.TraySortOrderModel + collapsed: DDT.TraySortOrderModel.collapsed + trayHeight: isHorizontal ? tray.implicitHeight : tray.implicitWidth + color: "transparent" } function isQuickPanelPopup(popupSurface) From 57544a2209d605367b01c2f36c2d26b5bf344e96 Mon Sep 17 00:00:00 2001 From: zyz Date: Thu, 11 Jul 2024 10:43:15 +0800 Subject: [PATCH 17/17] fix: dock or undock abnormal function (#546) as title Log: as title Influence: dock or undock function --- panels/dock/tray/trayitem.cpp | 14 ++++---------- panels/dock/tray/trayitem.h | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/panels/dock/tray/trayitem.cpp b/panels/dock/tray/trayitem.cpp index c426978e4..550502233 100644 --- a/panels/dock/tray/trayitem.cpp +++ b/panels/dock/tray/trayitem.cpp @@ -68,18 +68,12 @@ DockItemInfos TrayItem::dockItemInfos() return m_itemInfos; } -void TrayItem::setItemOnDock(const QString &settingKey, const QString &itemKey, bool visible) +void TrayItem::setItemOnDock(const QString &settingKey, const QString &surfaceId, bool visible) { Q_UNUSED(settingKey) - QString pluginId; - for (const DockItemInfo &itemInfo : m_itemInfos) { - if (itemInfo.itemKey == itemKey) { - pluginId = itemInfo.name; - break; - } - } - visible ? TraySettings::instance()->addTrayItemOnDock(pluginId + "::" + itemKey) : - TraySettings::instance()->removeTrayItemOnDock(pluginId + "::" + itemKey); + + visible ? TraySettings::instance()->addTrayItemOnDock(surfaceId) : + TraySettings::instance()->removeTrayItemOnDock(surfaceId); } D_APPLET_CLASS(TrayItem) diff --git a/panels/dock/tray/trayitem.h b/panels/dock/tray/trayitem.h index e5e5a7598..428fd7953 100644 --- a/panels/dock/tray/trayitem.h +++ b/panels/dock/tray/trayitem.h @@ -23,7 +23,7 @@ class TrayItem : public DS_NAMESPACE::DApplet void setTrayPluginModel(QAbstractItemModel *newTrayPluginModel); Q_INVOKABLE DockItemInfos dockItemInfos(); - Q_INVOKABLE void setItemOnDock(const QString &settingKey, const QString &itemKey, bool visible); + Q_INVOKABLE void setItemOnDock(const QString &settingKey, const QString &surfaceId, bool visible); Q_SIGNALS: void trayPluginModelChanged();