widescreen mode for plasmoids

This commit is contained in:
Marco Martin 2019-10-08 18:21:39 +02:00
parent a01e645316
commit 510a825b41
2 changed files with 46 additions and 34 deletions

View file

@ -33,7 +33,8 @@ NanoShell.FullScreenOverlay {
readonly property bool wideScreen: width > units.gridUnit * 45 readonly property bool wideScreen: width > units.gridUnit * 45
readonly property int drawerWidth: wideScreen ? units.gridUnit * 25 : width readonly property int drawerWidth: wideScreen ? units.gridUnit * 25 : width
property int drawerX: 0 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)) color: "transparent"//Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height))
property alias contentItem: contentArea.contentItem property alias contentItem: contentArea.contentItem
@ -62,10 +63,7 @@ NanoShell.FullScreenOverlay {
interval: 0 interval: 0
onTriggered: updateState() onTriggered: updateState()
} }
onFooterChanged: {
footer.parent = mainScope
footer.anchors.bottom = mainScope.bottom
}
onActiveChanged: { onActiveChanged: {
if (!active) { if (!active) {
close(); close();
@ -186,6 +184,7 @@ NanoShell.FullScreenOverlay {
onClicked: window.close(); onClicked: window.close();
PlasmaComponents.Control { PlasmaComponents.Control {
id: contentArea id: contentArea
z: 1
x: drawerX x: drawerX
width: drawerWidth width: drawerWidth
} }

View file

@ -70,7 +70,8 @@ PlasmaCore.ColorScope {
var fullContainer = fullContainerComponent.createObject(fullRepresentationView.contentItem); var fullContainer = fullContainerComponent.createObject(fullRepresentationView.contentItem);
applet.fullRepresentationItem.parent = fullContainer; applet.fullRepresentationItem.parent = fullContainer;
fullContainer.applet = applet; fullContainer.applet = applet;
applet.fullRepresentationItem.anchors.fill = fullContainer; fullContainer.contentItem = applet.fullRepresentationItem;
//applet.fullRepresentationItem.anchors.fill = fullContainer;
} }
Component.onCompleted: { Component.onCompleted: {
@ -121,12 +122,12 @@ PlasmaCore.ColorScope {
Component { Component {
id: fullContainerComponent id: fullContainerComponent
Item { DrawerBackground {
id: fullContainer id: fullContainer
property Item applet property Item applet
visible: applet && (applet.status != PlasmaCore.Types.HiddenStatus && applet.status != PlasmaCore.Types.PassiveStatus) visible: applet && (applet.status != PlasmaCore.Types.HiddenStatus && applet.status != PlasmaCore.Types.PassiveStatus)
height: parent.height height: parent.height
width: visible ? fullRepresentationView.width : 0 width: visible ? quickSettingsParent.width : 0
Layout.minimumHeight: applet && applet.switchHeight Layout.minimumHeight: applet && applet.switchHeight
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
@ -282,46 +283,56 @@ PlasmaCore.ColorScope {
} }
} }
DrawerBackground {
id: fullRepresentationDrawer ListView {
id: fullRepresentationView
parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
y: quickSettingsParent.height - height * (1-opacity) y: quickSettingsParent.height - height * (1-opacity)
opacity: slidingPanel.offset/panelContents.height opacity: fullRepresentationModel.count > 0 && slidingPanel.offset/panelContents.height
height: Math.min(plasmoid.screenGeometry.height - quickSettingsParent.y - quickSettingsParent.height, implicitHeight) height: Math.min(plasmoid.screenGeometry.height - slidingPanel.headerHeight - quickSettingsParent.height - bottomBar.height, implicitHeight)
contentItem: ListView { leftMargin: slidingPanel.drawerX
id: fullRepresentationView preferredHighlightBegin: slidingPanel.drawerX
implicitHeight: 300 implicitHeight: units.gridUnit * 20
cacheBuffer: width * 100 cacheBuffer: width * 100
highlightFollowsCurrentItem: true highlightFollowsCurrentItem: true
highlightRangeMode: ListView.StrictlyEnforceRange highlightRangeMode: ListView.StrictlyEnforceRange
highlightMoveDuration: units.longDuration highlightMoveDuration: units.longDuration
snapMode: ListView.SnapOneItem snapMode: slidingPanel.wideScreen ? ListView.NoSnap : ListView.SnapOneItem
model: ObjectModel { model: ObjectModel {
id: fullRepresentationModel id: fullRepresentationModel
}
orientation: ListView.Horizontal
//implicitHeight: fullRepresentationLayout.implicitHeight
clip: true
} }
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 id: bottomBar
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
opacity: fullRepresentationDrawer.opacity
visible: fullRepresentationModel.count > 1 parent: slidingPanel.fixedArea
opacity: fullRepresentationView.opacity
visible: !slidingPanel.wideScreen && fullRepresentationModel.count > 1
//height: 40 //height: 40
z: 100 z: 100
contentItem: RowLayout { contentItem: RowLayout {
@ -329,7 +340,9 @@ PlasmaCore.ColorScope {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
position: PlasmaComponents.TabBar.Footer position: PlasmaComponents.TabBar.Footer
Text {
text:fullRepresentationModel.count
}
Repeater { Repeater {
model: fullRepresentationView.count model: fullRepresentationView.count
delegate: PlasmaComponents.TabButton { delegate: PlasmaComponents.TabButton {