From 73efc8a59dc78c35a63e8eb9b69255b8d002ba2b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 8 Apr 2021 18:57:20 +0200 Subject: [PATCH] show last page with a + when dragging --- .../contents/ui/launcher/AppDrawer.qml | 1 + .../contents/ui/launcher/FlickablePages.qml | 25 +++++++++++++++++++ .../homescreen/package/contents/ui/main.qml | 10 +++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml b/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml index 07cba518..8953e2a7 100644 --- a/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml +++ b/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml @@ -126,6 +126,7 @@ Item { } OpenDrawerButton { + id: openDrawerButton anchors { left: parent.left right: parent.right diff --git a/containments/homescreen/package/contents/ui/launcher/FlickablePages.qml b/containments/homescreen/package/contents/ui/launcher/FlickablePages.qml index 575c90bc..950b03c1 100644 --- a/containments/homescreen/package/contents/ui/launcher/FlickablePages.qml +++ b/containments/homescreen/package/contents/ui/launcher/FlickablePages.qml @@ -40,6 +40,7 @@ Flickable { scale: (3 - appDrawer.openFactor) /3 clip: true + property bool showAddPageIndicator: false //bottomMargin: favoriteStrip.height contentHeight: height //interactive: !plasmoid.editMode && !launcherDragManager.active @@ -148,6 +149,7 @@ Flickable { PlasmaComponents.PageIndicator { + id: pageIndicator anchors { bottom: parent.bottom horizontalCenter: parent.horizontalCenter @@ -159,6 +161,29 @@ Flickable { count: mainFlickable.totalPages visible: count > 1 currentIndex: Math.round(mainFlickable.contentX / mainFlickable.width) + delegate: Rectangle { + property bool isAddPageIndicator: index === pageIndicator.count-1 && mainFlickable.showAddPageIndicator + implicitWidth: PlasmaCore.Units.gridUnit/2 + implicitHeight: implicitWidth + + radius: width + color: isAddPageIndicator ? "transparent" : PlasmaCore.ColorScope.textColor + + + PlasmaComponents.Label { + anchors.centerIn: parent + visible: parent.isAddPageIndicator + text: "⊕" + } + + opacity: index === currentIndex ? 0.9 : pressed ? 0.7 : 0.5 + Behavior on opacity { + OpacityAnimator { + duration: PlasmaCore.Units.longDuration + easing.type: Easing.InOutQuad + } + } + } } Private.ScrollIndicator { diff --git a/containments/homescreen/package/contents/ui/main.qml b/containments/homescreen/package/contents/ui/main.qml index 236a8f4f..2b905a78 100644 --- a/containments/homescreen/package/contents/ui/main.qml +++ b/containments/homescreen/package/contents/ui/main.qml @@ -105,11 +105,13 @@ FocusScope { bottomMargin: /*favoriteStrip.height +*/ plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y } - footer: favoriteStrip + //TODO: favorite strip disappearing with everything else + //footer: favoriteStrip appletsLayout: homeScreenContents.appletsLayout appDrawer: appDrawer contentWidth: Math.max(width, width * Math.ceil(homeScreenContents.itemsBoundingRect.width/width)) + (launcherDragManager.active ? width : 0) + showAddPageIndicator: launcherDragManager.active Launcher.HomeScreenContents { id: homeScreenContents @@ -123,17 +125,17 @@ FocusScope { anchors.fill: parent topPadding: plasmoid.availableScreenRect.y - bottomPadding: /*favoriteStrip.height + */plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y + bottomPadding: favoriteStrip.height + plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y } Launcher.FavoriteStrip { id: favoriteStrip - /* anchors { + anchors { left: parent.left right: parent.right bottom: parent.bottom bottomMargin: plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y - }*/ + } appletsLayout: homeScreenContents.appletsLayout visible: flow.children.length > 0 || launcherDragManager.active || homeScreenContents.containsDrag