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
19 changes: 16 additions & 3 deletions panels/dock/package/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Window {
property int dockLeftSpaceForCenter: useColumnLayout ?
(Screen.height - dockLeftPart.implicitHeight - dockRightPart.implicitHeight) :
(Screen.width - dockLeftPart.implicitWidth - dockRightPart.implicitWidth)
property int dockRemainingSpaceForCenter: useColumnLayout ?
(Screen.height / 1.8 - dockRightPart.implicitHeight) :
(Screen.width / 1.8 - dockRightPart.implicitWidth)
// TODO
signal dockCenterPartPosChanged()
signal pressedAndDragging(bool isDragging)
Expand Down Expand Up @@ -419,10 +422,20 @@ Window {
}
}

Item {
Item {
id: dockCenterPart
implicitWidth: centerLoader.implicitWidth
implicitHeight: centerLoader.implicitHeight
property var taskmanagerRootObject: {
let applet = DS.applet("org.deepin.ds.dock.taskmanager")
return applet ? applet.rootObject : null
}

readonly property real taskmanagerImplicitWidth: taskmanagerRootObject ? taskmanagerRootObject.implicitWidth : 0
readonly property real taskmanagerImplicitHeight: taskmanagerRootObject ? taskmanagerRootObject.implicitHeight : 0
readonly property real taskmanagerAppContainerWidth: taskmanagerRootObject ? taskmanagerRootObject.appContainerWidth : 0
readonly property real taskmanagerAppContainerHeight: taskmanagerRootObject ? taskmanagerRootObject.appContainerHeight : 0

implicitWidth: centerLoader.implicitWidth - taskmanagerImplicitWidth + taskmanagerAppContainerWidth
implicitHeight: centerLoader.implicitHeight - taskmanagerImplicitHeight + taskmanagerAppContainerHeight
onXChanged: dockCenterPartPosChanged()
onYChanged: dockCenterPartPosChanged()
Layout.leftMargin: !useColumnLayout && Panel.itemAlignment === Dock.CenterAlignment ?
Expand Down
10 changes: 7 additions & 3 deletions panels/dock/taskmanager/package/TaskManager.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ ContainmentItem {
id: taskmanager
property bool useColumnLayout: Panel.position % 2
property int dockOrder: 16
property int remainingSpacesForTaskManager: Panel.rootObject.dockLeftSpaceForCenter - Panel.rootObject.dockItemMaxSize * 1.2
property int remainingSpacesForTaskManager: Panel.itemAlignment === Dock.LeftAlignment ? Panel.rootObject.dockLeftSpaceForCenter : Panel.rootObject.dockRemainingSpaceForCenter
property int forceRelayoutWorkaround: 0

// 用于居中计算的实际应用区域尺寸
property int appContainerWidth: useColumnLayout ? Panel.rootObject.dockSize : (appContainer.implicitWidth + forceRelayoutWorkaround)
property int appContainerHeight: useColumnLayout ? (appContainer.implicitHeight + forceRelayoutWorkaround) : Panel.rootObject.dockSize

Timer {
// FIXME: dockItemMaxSize(visualModel.cellWidth,actually its implicitWidth/Height) change will cause all delegate item's position change, but
// the newly added item will using the old cellWidth to calculate its position, thus it will be placed in the wrong position. Also it
Expand All @@ -30,8 +34,8 @@ ContainmentItem {
}
}

implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : (Math.min(remainingSpacesForTaskManager, appContainer.implicitWidth) + forceRelayoutWorkaround)
implicitHeight: useColumnLayout ? (Math.min(remainingSpacesForTaskManager, appContainer.implicitHeight) + forceRelayoutWorkaround) : Panel.rootObject.dockSize
implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : (Math.max(remainingSpacesForTaskManager, appContainer.implicitWidth) + forceRelayoutWorkaround)
implicitHeight: useColumnLayout ? (Math.max(remainingSpacesForTaskManager, appContainer.implicitHeight) + forceRelayoutWorkaround) : Panel.rootObject.dockSize

// Helper function to find the current index of an app by its appId in the visualModel
function findAppIndex(appId) {
Expand Down
Loading