From 510a825b41af481108ba8695c7064826ef11b32c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 8 Oct 2019 18:21:39 +0200 Subject: [PATCH] widescreen mode for plasmoids --- .../package/contents/ui/SlidingPanel.qml | 9 ++- .../panel/package/contents/ui/main.qml | 71 +++++++++++-------- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/containments/panel/package/contents/ui/SlidingPanel.qml b/containments/panel/package/contents/ui/SlidingPanel.qml index d0d38ac4..1ff74556 100644 --- a/containments/panel/package/contents/ui/SlidingPanel.qml +++ b/containments/panel/package/contents/ui/SlidingPanel.qml @@ -33,7 +33,8 @@ NanoShell.FullScreenOverlay { readonly property bool wideScreen: width > units.gridUnit * 45 readonly property int drawerWidth: wideScreen ? units.gridUnit * 25 : width property int drawerX: 0 - property Item footer + property alias fixedArea: mainScope + property alias flickable: mainFlickable color: "transparent"//Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height)) property alias contentItem: contentArea.contentItem @@ -62,10 +63,7 @@ NanoShell.FullScreenOverlay { interval: 0 onTriggered: updateState() } - onFooterChanged: { - footer.parent = mainScope - footer.anchors.bottom = mainScope.bottom - } + onActiveChanged: { if (!active) { close(); @@ -186,6 +184,7 @@ NanoShell.FullScreenOverlay { onClicked: window.close(); PlasmaComponents.Control { id: contentArea + z: 1 x: drawerX width: drawerWidth } diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index 2eec4deb..173f8339 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -70,7 +70,8 @@ PlasmaCore.ColorScope { var fullContainer = fullContainerComponent.createObject(fullRepresentationView.contentItem); applet.fullRepresentationItem.parent = fullContainer; fullContainer.applet = applet; - applet.fullRepresentationItem.anchors.fill = fullContainer; + fullContainer.contentItem = applet.fullRepresentationItem; + //applet.fullRepresentationItem.anchors.fill = fullContainer; } Component.onCompleted: { @@ -121,12 +122,12 @@ PlasmaCore.ColorScope { Component { id: fullContainerComponent - Item { + DrawerBackground { id: fullContainer property Item applet visible: applet && (applet.status != PlasmaCore.Types.HiddenStatus && applet.status != PlasmaCore.Types.PassiveStatus) height: parent.height - width: visible ? fullRepresentationView.width : 0 + width: visible ? quickSettingsParent.width : 0 Layout.minimumHeight: applet && applet.switchHeight onVisibleChanged: { if (visible) { @@ -282,46 +283,56 @@ PlasmaCore.ColorScope { } } - DrawerBackground { - id: fullRepresentationDrawer + + ListView { + id: fullRepresentationView + parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents anchors { left: parent.left right: parent.right } y: quickSettingsParent.height - height * (1-opacity) - opacity: slidingPanel.offset/panelContents.height - height: Math.min(plasmoid.screenGeometry.height - quickSettingsParent.y - quickSettingsParent.height, implicitHeight) - contentItem: ListView { - id: fullRepresentationView - - implicitHeight: 300 - cacheBuffer: width * 100 - highlightFollowsCurrentItem: true - highlightRangeMode: ListView.StrictlyEnforceRange - highlightMoveDuration: units.longDuration - snapMode: ListView.SnapOneItem - model: ObjectModel { - id: fullRepresentationModel - } - orientation: ListView.Horizontal - - - //implicitHeight: fullRepresentationLayout.implicitHeight - clip: true - + opacity: fullRepresentationModel.count > 0 && slidingPanel.offset/panelContents.height + height: Math.min(plasmoid.screenGeometry.height - slidingPanel.headerHeight - quickSettingsParent.height - bottomBar.height, implicitHeight) + leftMargin: slidingPanel.drawerX + preferredHighlightBegin: slidingPanel.drawerX + + implicitHeight: units.gridUnit * 20 + cacheBuffer: width * 100 + highlightFollowsCurrentItem: true + highlightRangeMode: ListView.StrictlyEnforceRange + highlightMoveDuration: units.longDuration + snapMode: slidingPanel.wideScreen ? ListView.NoSnap : ListView.SnapOneItem + model: ObjectModel { + id: fullRepresentationModel } + orientation: ListView.Horizontal + + MouseArea { + //parent: fullRepresentationView.contentItem + anchors.fill: parent + z: -1 + + onClicked: slidingPanel.close() + } + + //implicitHeight: fullRepresentationLayout.implicitHeight + //clip: true + } } - footer: DrawerBackground { + DrawerBackground { id: bottomBar anchors { left: parent.left right: parent.right bottom: parent.bottom } - opacity: fullRepresentationDrawer.opacity - visible: fullRepresentationModel.count > 1 + + parent: slidingPanel.fixedArea + opacity: fullRepresentationView.opacity + visible: !slidingPanel.wideScreen && fullRepresentationModel.count > 1 //height: 40 z: 100 contentItem: RowLayout { @@ -329,7 +340,9 @@ PlasmaCore.ColorScope { Layout.fillWidth: true Layout.fillHeight: true position: PlasmaComponents.TabBar.Footer - + Text { + text:fullRepresentationModel.count + } Repeater { model: fullRepresentationView.count delegate: PlasmaComponents.TabButton {