diff --git a/containments/taskpanel/package/contents/ui/Task.qml b/containments/taskpanel/package/contents/ui/Task.qml index 4618996e..f51e12ad 100644 --- a/containments/taskpanel/package/contents/ui/Task.qml +++ b/containments/taskpanel/package/contents/ui/Task.qml @@ -22,8 +22,6 @@ Item { readonly property point taskScreenPoint: Qt.point(model.ScreenGeometry.x, model.ScreenGeometry.y) readonly property real dragOffset: -control.y - readonly property real headerHeight: appHeader.height + PlasmaCore.Units.smallSpacing - property bool active: model.IsActive required property real previewHeight @@ -63,6 +61,11 @@ Item { width: parent.width height: parent.height + leftPadding: 0 + rightPadding: 0 + topPadding: 0 + bottomPadding: 0 + // drag up gesture DragHandler { id: dragHandler @@ -96,13 +99,16 @@ Item { } // application - ColumnLayout { - anchors.fill: parent - spacing: PlasmaCore.Units.smallSpacing + contentItem: ColumnLayout { + id: column + spacing: 0 + // header RowLayout { id: appHeader Layout.fillWidth: true + Layout.fillHeight: true + Layout.minimumHeight: column.height - appView.height spacing: PlasmaCore.Units.smallSpacing * 2 PlasmaCore.IconItem { @@ -125,6 +131,7 @@ Item { id: rep model: plasmoid.nativeInterface.outputs delegate: PlasmaComponents.ToolButton { + Layout.alignment: Qt.AlignVCenter text: model.modelName visible: model.position !== delegate.taskScreenPoint display: rep.count < 3 ? QQC2.Button.IconOnly : QQC2.Button.TextBesideIcon @@ -137,6 +144,7 @@ Item { } PlasmaComponents.ToolButton { + Layout.alignment: Qt.AlignVCenter z: 99 icon.name: "window-close" icon.width: PlasmaCore.Units.iconSizes.smallMedium @@ -145,11 +153,13 @@ Item { } } + // app preview QQC2.Control { id: appView - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.preferredWidth: delegate.previewWidth - Layout.preferredHeight: delegate.previewHeight // keep same as window resolution + Layout.preferredHeight: delegate.previewHeight + Layout.maximumWidth: delegate.previewWidth + Layout.maximumHeight: delegate.previewHeight leftPadding: 0 rightPadding: 0 diff --git a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml index 5ff98b19..25a03cc0 100644 --- a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml +++ b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml @@ -180,67 +180,76 @@ NanoShell.FullScreenOverlay { } } - ListView { - id: tasksView - z: 100 - opacity: window.wasInActiveTask ? 1 : Math.min(1, window.yOffset / window.targetYOffsetDist) + Item { + id: container - property real horizontalMargin: PlasmaCore.Units.gridUnit * 3 - anchors.centerIn: parent + // provide shell margins + anchors.fill: parent + anchors.rightMargin: navPanel.isPortrait ? 0 : window.taskPanelHeight + anchors.bottomMargin: navPanel.isPortrait ? window.taskPanelHeight : 0 + anchors.topMargin: MobileShell.TopPanelControls.panelHeight - width: window.width - horizontalMargin * 2 - height: window.windowHeight - (PlasmaCore.Units.gridUnit * 2 + PlasmaCore.Units.largeSpacing * 2) - - model: window.model - orientation: ListView.Horizontal - - highlightRangeMode: ListView.StrictlyEnforceRange // ensures currentIndex is updated - snapMode: ListView.SnapToItem - - spacing: PlasmaCore.Units.largeSpacing - displayMarginBeginning: 2 * (width + spacing) - displayMarginEnd: 2 * (width + spacing) - - displaced: Transition { - NumberAnimation { properties: "x,y"; duration: PlasmaCore.Units.longDuration; easing.type: Easing.InOutQuad } - } - - // ensure that window previews are exactly to the scale of the device screen - property real scalingFactor: { - let candidateHeight = (tasksView.width / window.width) * window.windowHeight; + // applications list + ListView { + id: tasksView + opacity: window.wasInActiveTask ? 1 : Math.min(1, window.yOffset / window.targetYOffsetDist) + anchors.centerIn: parent - if (candidateHeight > tasksView.height) { - return tasksView.height / window.windowHeight; - } else { - return tasksView.width / window.windowWidth; - } - } - - delegate: Task { - id: task - property int curIndex: model.index - z: window.currentTaskIndex === curIndex ? 1 : 0 - width: tasksView.width - height: tasksView.height + readonly property real sizeFactor: 0.75 + readonly property real taskHeaderHeight: PlasmaCore.Units.gridUnit * 2 + PlasmaCore.Units.smallSpacing * 2 - // account for header offset (center the preview) - y: task.headerHeight / 2 + width: window.windowWidth * sizeFactor + height: window.windowHeight * sizeFactor + taskHeaderHeight - // scale gesture - scale: { - let maxScale = 1 / tasksView.scalingFactor; - let subtract = (maxScale - 1) * (window.yOffset / window.targetYOffsetDist); - let finalScale = Math.max(0, Math.min(maxScale, maxScale - subtract)); - - if ((window.wasInActiveTask || !taskSwitcher.currentlyDragging) && window.currentTaskIndex === task.curIndex) { - return finalScale; - } - return 1; + model: window.model + orientation: ListView.Horizontal + + highlightRangeMode: ListView.StrictlyEnforceRange // ensures currentIndex is updated + snapMode: ListView.SnapToItem + + spacing: PlasmaCore.Units.largeSpacing + displayMarginBeginning: 2 * (width + spacing) + displayMarginEnd: 2 * (width + spacing) + displaced: Transition { + NumberAnimation { properties: "x,y"; duration: PlasmaCore.Units.longDuration; easing.type: Easing.InOutQuad } } // ensure that window previews are exactly to the scale of the device screen - previewWidth: tasksView.scalingFactor * window.windowWidth - previewHeight: tasksView.scalingFactor * window.windowHeight + property real scalingFactor: { + let candidateHeight = (tasksView.width / window.windowWidth) * window.windowHeight; + if (candidateHeight > tasksView.height) { + return tasksView.height / window.windowHeight; + } else { + return tasksView.width / window.windowWidth; + } + } + + delegate: Task { + id: task + property int curIndex: model.index + z: window.currentTaskIndex === curIndex ? 1 : 0 + width: tasksView.width + height: tasksView.height + + // account for header offset (center the preview) + y: -tasksView.taskHeaderHeight / 2 + + // scale gesture + scale: { + let maxScale = 1 / tasksView.scalingFactor; + let subtract = (maxScale - 1) * (window.yOffset / window.targetYOffsetDist); + let finalScale = Math.max(0, Math.min(maxScale, maxScale - subtract)); + + if ((window.wasInActiveTask || !taskSwitcher.currentlyDragging) && window.currentTaskIndex === task.curIndex) { + return finalScale; + } + return 1; + } + + // ensure that window previews are exactly to the scale of the device screen + previewWidth: tasksView.scalingFactor * window.windowWidth + previewHeight: tasksView.scalingFactor * window.windowHeight + } } }