From 06e5a89ca7ff075d559a4b01cc1eb40ed6d7f7ed Mon Sep 17 00:00:00 2001 From: Micah Stanley Date: Fri, 25 Apr 2025 01:23:48 +0000 Subject: [PATCH] Folio: Make SettingsComponent Buttons Match FavoritesBar Location This merge request makes the SettingsComponent buttons match the FavoritesBar location. This helps better utilize the available screen space as before the buttons would exclusively remain at the bottom and could cause them to overlap with the HomeScreenPage or navbar. Before: ![Screenshot_20250424_093156](/uploads/be3b3ef255333052a8f2b74b8645a906/Screenshot_20250424_093156.png) After: ![Screenshot_20250423_181926](/uploads/7823b8e2d1ba41c376bc83b80ea56136/Screenshot_20250423_181926.png) --- .../folio/package/contents/ui/HomeScreen.qml | 4 + .../ui/settings/SettingsComponent.qml | 89 ++++++++++++++++--- 2 files changed, 81 insertions(+), 12 deletions(-) diff --git a/containments/homescreens/folio/package/contents/ui/HomeScreen.qml b/containments/homescreens/folio/package/contents/ui/HomeScreen.qml index e03f5d5f..cb07b95f 100644 --- a/containments/homescreens/folio/package/contents/ui/HomeScreen.qml +++ b/containments/homescreens/folio/package/contents/ui/HomeScreen.qml @@ -148,6 +148,10 @@ Item { opacity: folio.HomeScreenState.settingsOpenProgress z: 1 + bottomMargin: root.bottomMargin + leftMargin: root.leftMargin + rightMargin: root.rightMargin + // move the settings out of the way if it is not visible // NOTE: we do this instead of setting visible to false, because // it doesn't mess with widget drag and drop diff --git a/containments/homescreens/folio/package/contents/ui/settings/SettingsComponent.qml b/containments/homescreens/folio/package/contents/ui/settings/SettingsComponent.qml index a2666e60..059b9653 100644 --- a/containments/homescreens/folio/package/contents/ui/settings/SettingsComponent.qml +++ b/containments/homescreens/folio/package/contents/ui/settings/SettingsComponent.qml @@ -23,6 +23,10 @@ Item { readonly property bool homeScreenInteractive: !appletListViewer.open + property real bottomMargin: 0 + property real leftMargin: 0 + property real rightMargin: 0 + Connections { target: folio.HomeScreenState @@ -37,11 +41,6 @@ Item { MouseArea { id: closeSettings - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: settingsBar.top - onClicked: { folio.HomeScreenState.closeSettingsView(); } @@ -53,16 +52,15 @@ Item { Kirigami.Theme.inherit: false Kirigami.Theme.colorSet: Kirigami.Theme.Complementary - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: Kirigami.Units.largeSpacing - height: root.height * (1 - settingsModeHomeScreenScale) + anchors.bottomMargin: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Bottom ? Kirigami.Units.largeSpacing + Math.round(root.bottomMargin / 2) : 0 + anchors.rightMargin: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Right ? Kirigami.Units.largeSpacing + Math.round(root.rightMargin / 2) : 0 + anchors.leftMargin: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Left ? Kirigami.Units.largeSpacing + Math.round(root.leftMargin / 2) : 0 - RowLayout { + GridLayout { id: settingsOptions + flow: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Bottom ? GridLayout.LeftToRight : GridLayout.TopToBottom + anchors.centerIn: parent - spacing: Kirigami.Units.largeSpacing PC3.ToolButton { opacity: 0.9 @@ -150,6 +148,73 @@ Item { } } + states: [ + State { + name: "bottom" + when: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Bottom + PropertyChanges { + target: settingsBar + height: root.height * (1 - root.settingsModeHomeScreenScale) + } + AnchorChanges { + target: settingsBar + anchors.top: undefined + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } + AnchorChanges { + target: closeSettings + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: settingsBar.top + } + }, State { + name: "left" + when: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Left + PropertyChanges { + target: settingsBar + width: root.width * (1 - root.settingsModeHomeScreenScale) + } + AnchorChanges { + target: settingsBar + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: undefined + } + AnchorChanges { + target: closeSettings + anchors.top: parent.top + anchors.left: settingsBar.right + anchors.right: parent.right + anchors.bottom: parent.bottom + } + }, State { + name: "right" + when: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Right + PropertyChanges { + target: settingsBar + width: root.width * (1 - root.settingsModeHomeScreenScale) + } + AnchorChanges { + target: settingsBar + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: undefined + anchors.right: parent.right + } + AnchorChanges { + target: closeSettings + anchors.top: parent.top + anchors.left: parent.left + anchors.right: settingsBar.left + anchors.bottom: parent.bottom + } + } + ] + AppletListViewer { id: appletListViewer folio: root.folio