Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 24 additions & 27 deletions panels/dock/taskmanager/package/AppItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ Item {
Drag.mimeData: { "text/x-dde-dock-dnd-appid": itemId, "text/x-dde-dock-dnd-source": "taskbar", "text/x-dde-dock-dnd-winid": windows.length > 0 ? windows[0] : ""}

property bool useColumnLayout: Panel.rootObject.useColumnLayout
property int statusIndicatorSize: useColumnLayout ? root.width * 0.72 : root.height * 0.72
property int iconSize: Panel.rootObject.dockItemMaxSize * 9 / 14
property bool enableTitle: false
property bool titleActive: enableTitle && titleLoader.active
property int appTitleSpacing: 0
property var iconGlobalPoint: {
var a = icon
var x = 0, y = 0
Expand Down Expand Up @@ -79,16 +77,15 @@ Item {
Control {
anchors.fill: parent
id: appItem
implicitWidth: root.titleActive ? (iconContainer.width + 4 + titleLoader.width + root.appTitleSpacing) : iconContainer.width + root.appTitleSpacing
implicitWidth: root.titleActive ? (root.iconSize + hoverBackground.horizontalSpacing + titleLoader.width) : iconContainer.width
visible: !root.Drag.active // When in dragging, hide app item
background: AppletItemBackground {
background: AppItemBackground {
id: hoverBackground

readonly property int verticalSpacing: Math.round(root.iconSize / 8) + 1
readonly property int horizontalSpacing: Math.round(root.iconSize / 8)
readonly property int nonSplitHeight: root.iconSize + verticalSpacing * 2
readonly property int hoverPadding: Math.round((Panel.rootObject.dockItemMaxSize * 0.8 - root.iconSize) / 2)
readonly property int splitWidth: Math.round(icon.width + titleLoader.width + hoverPadding * 2)
readonly property int splitWidth: Math.round(root.iconSize + titleLoader.width + horizontalSpacing * 3)
readonly property int nonSplitWidth: Math.round(root.iconSize + horizontalSpacing * 2)

enabled: false
Expand All @@ -98,10 +95,8 @@ Item {
radius: height / 5
anchors.centerIn: parent
isActive: root.active
opacity: (hoverHandler.hovered || (root.active && root.windows.length > 0)) ? 1.0 : 0.0
Behavior on opacity {
NumberAnimation { duration: 150 }
}
windowCount: root.windows.length
displayMode: root.displayMode
}
Item {
id: iconContainer
Expand All @@ -118,10 +113,6 @@ Item {
anchors.left: parent.left
anchors.horizontalCenter: undefined
}
PropertyChanges {
target: iconContainer
anchors.leftMargin: hoverBackground.horizontalSpacing
}
},
State {
name: "nonTitleActive"
Expand All @@ -134,13 +125,12 @@ Item {
}
}
]
StatusIndicator {
id: statusIndicator
palette: itemPalette
width: root.statusIndicatorSize
height: root.statusIndicatorSize
anchors.centerIn: iconContainer
visible: root.displayMode === Dock.Efficient && root.windows.length > 0

Connections {
function onDisplayModeChanged() {
windowIndicator.updateIndicatorAnchors()
}
target: root
}

Connections {
Expand Down Expand Up @@ -258,28 +248,30 @@ Item {
windowIndicator.anchors.horizontalCenter = undefined
windowIndicator.anchors.verticalCenter = undefined

const anchorTarget = root.displayMode === Dock.Efficient ? appItem : hoverBackground

switch(Panel.position) {
case Dock.Top: {
windowIndicator.anchors.horizontalCenter = iconContainer.horizontalCenter
windowIndicator.anchors.top = hoverBackground.top
windowIndicator.anchors.top = anchorTarget.top
windowIndicator.anchors.topMargin = 1
return
}
case Dock.Bottom: {
windowIndicator.anchors.horizontalCenter = iconContainer.horizontalCenter
windowIndicator.anchors.bottom = hoverBackground.bottom
windowIndicator.anchors.bottom = anchorTarget.bottom
windowIndicator.anchors.bottomMargin = 1
return
}
case Dock.Left: {
windowIndicator.anchors.verticalCenter = parent.verticalCenter
windowIndicator.anchors.left = hoverBackground.left
windowIndicator.anchors.left = anchorTarget.left
windowIndicator.anchors.leftMargin = 1
return
}
case Dock.Right:{
windowIndicator.anchors.verticalCenter = parent.verticalCenter
windowIndicator.anchors.right = hoverBackground.right
windowIndicator.anchors.right = anchorTarget.right
windowIndicator.anchors.rightMargin = 1
return
}
Expand All @@ -294,13 +286,18 @@ Item {
AppItemTitle {
id: titleLoader
anchors.left: iconContainer.right
anchors.leftMargin: 4
anchors.leftMargin: Math.round(root.iconSize / 8)
anchors.verticalCenter: parent.verticalCenter
enabled: root.enableTitle && root.windows.length > 0
text: root.title
textColor: {
if (root.displayMode === Dock.Efficient && root.active) {
return "#000000"
}
return D.DTK.themeType === D.ApplicationHelper.DarkType ? "#FFFFFF" : "#000000"
}
}

// TODO: value can set during debugPanel
Loader {
id: animationRoot
anchors.fill: parent
Expand Down
143 changes: 143 additions & 0 deletions panels/dock/taskmanager/package/AppItemBackground.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

import QtQuick
import QtQuick.Controls

import org.deepin.ds.dock 1.0
import org.deepin.dtk

AppletItemBackground {
id: control
property int windowCount: 0
property int displayMode: Dock.Efficient
property Palette minDockEffectActive: Palette {
normal {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.8)
}
normalDark {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.6)
}
hovered {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.9)
}
hoveredDark {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.7)
}
}
property Palette normalDockEffectActive: Palette {
normal {
crystal: ("transparent")
}
normalDark: normal
hovered {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.15)
}
hoveredDark: hovered
}
backgroundColor: Palette {
normal {
crystal: if (displayMode === Dock.Efficient && control.windowCount > 0) {
return Qt.rgba(1.0, 1.0, 1.0, 0.35)
} else {
return ("transparent")
}
}
normalDark: {
crystal: if (displayMode === Dock.Efficient && control.windowCount > 0) {
return Qt.rgba(1.0, 1.0, 1.0, 0.1)
} else {
return ("transparent")
}
}
hovered {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.15)
}
hoveredDark {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.15)
}
pressed {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.25)
}
pressedDark {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.25)
}
}
activeBackgroundColor: displayMode === Dock.Efficient ? minDockEffectActive : normalDockEffectActive
insideBorderColor: Palette {
normal {
crystal: if (displayMode === Dock.Efficient && control.windowCount > 0) {
return Qt.rgba(1.0, 1.0, 1.0, 0.05)
} else {
return ("transparent")
}
}
normalDark: normal
hovered {
crystal: Qt.rgba(0, 0, 0, 0.05)
}
hoveredDark: hovered
pressed: hovered
pressedDark: pressed
}

activeInsideBorderColor: Palette {
normal {
crystal: if (displayMode === Dock.Efficient) {
return Qt.rgba(0, 0, 0, 0.1)
} else {
return ("transparent")
}
}
normalDark: {
crystal: if (displayMode === Dock.Efficient) {
return Qt.rgba(1.0, 1.0, 1.0, 0.1)
} else {
return ("transparent")
}
}
hovered {
crystal: Qt.rgba(1.0, 1.0, 1.0, 0.1)
}
hoveredDark: hovered
pressed: hovered
pressedDark: pressed
}
outsideBorderColor: Palette {
normal: {
crystal: ("transparent")
}
normalDark: normal
hovered : normal
hoveredDark: hovered
pressed: hovered
pressedDark: pressed
}
activeOutsideBorderColor: Palette {
normal {
crystal: if (displayMode === Dock.Efficient) {
return Qt.rgba(0, 0, 0, 0.1)
} else {
return ("transparent")
}
}
normalDark {
crystal: if (displayMode === Dock.Efficient) {
return Qt.rgba(0, 0, 0, 0.05)
} else {
return ("transparent")
}
}
hovered {
crystal: Qt.rgba(0.0, 0.0, 0.0, 0.10)
}
hoveredDark: hovered
pressed {
crystal: Qt.rgba(0.0, 0.0, 0.0, 0.10)
}
pressedDark {
crystal: Qt.rgba(0.0, 0.0, 0.0, 0.05)
}
}
}
3 changes: 2 additions & 1 deletion panels/dock/taskmanager/package/AppItemTitle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Item {

property bool active: titleLoader.active
property string text: ""
property color textColor: D.DTK.themeType === D.ApplicationHelper.DarkType ? "#FFFFFF" : "#000000"

implicitWidth: titleLoader.width
implicitHeight: titleLoader.height
Expand All @@ -28,7 +29,7 @@ Item {

text: root.TextCalculator.elidedText

color: D.DTK.themeType === D.ApplicationHelper.DarkType ? "#FFFFFF" : "#000000"
color: root.textColor
font: root.TextCalculator.calculator.font
verticalAlignment: Text.AlignVCenter

Expand Down
12 changes: 0 additions & 12 deletions panels/dock/taskmanager/package/StatusIndicator.qml

This file was deleted.

5 changes: 2 additions & 3 deletions panels/dock/taskmanager/package/TaskManager.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ContainmentItem {
iconSize: Panel.rootObject.dockItemMaxSize * 9 / 14
spacing: appContainer.spacing
cellSize: visualModel.cellWidth
itemPadding: 4
itemPadding: taskmanager.appTitleSpacing
remainingSpace: taskmanager.remainingSpacesForSplitWindow
font.family: D.DTK.fontManager.t6.family
font.pixelSize: Math.max(10, Math.min(20, Math.round(textCalculator.iconSize * 0.35)))
Expand All @@ -74,7 +74,7 @@ ContainmentItem {
id: appContainer
anchors.fill: parent
useColumnLayout: taskmanager.useColumnLayout
spacing: 0
spacing: taskmanager.appTitleSpacing
remove: Transition {
NumberAnimation {
properties: "scale,opacity"
Expand Down Expand Up @@ -191,7 +191,6 @@ ContainmentItem {
blendOpacity: taskmanager.blendOpacity
title: delegateRoot.title
enableTitle: textCalculator.enabled
appTitleSpacing: taskmanager.appTitleSpacing
ListView.delayRemove: Drag.active
Component.onCompleted: {
dropFilesOnItem.connect(taskmanager.Applet.dropFilesOnItem)
Expand Down
3 changes: 1 addition & 2 deletions panels/dock/taskmanager/textcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ void TextCalculator::calculateOptimalTextWidth()
qreal textWidth = calculateElidedTextWidth(title, baselineWidth);
// Only add spacing between icon and text when text is present
if (textWidth > 0.0) {
qreal appTitleSpacing = qMax(10.0, m_iconSize / 3.0);
itemWidth = m_iconSize + m_itemPadding + textWidth + appTitleSpacing;
itemWidth = m_iconSize + m_itemPadding + textWidth;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个改了之后,跟界面上的不一致,算总的缩略时不会出问题么?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个已经在后面的spacingWidth 计算加上去了不包括了。

} else {
itemWidth = m_cellSize;
}
Expand Down
Loading