homescreen: Add button to wallpaper selector to go to advanced settings

Currently you need to go from Settings -> "Switch between homescreens and more wallpaper options" to access the advanced wallpaper settings. Add a button directly into the wallpaper selector for this.
This commit is contained in:
Devin Lin 2024-07-03 18:38:10 -04:00
parent 1fc13f6d0f
commit 56ca0db5c6
3 changed files with 50 additions and 9 deletions

View file

@ -15,24 +15,26 @@ import org.kde.plasma.private.mobileshell.wallpaperimageplugin as WallpaperImage
Controls.Drawer {
id: imageWallpaperDrawer
dragMargin: 0
required property bool horizontal
signal wallpaperSettingsRequested()
onOpened: {
wallpapersView.forceActiveFocus()
}
implicitWidth: Kirigami.Units.gridUnit * 10
implicitHeight: Kirigami.Units.gridUnit * 8
width: imageWallpaperDrawer.horizontal ? implicitWidth : parent.width
height: imageWallpaperDrawer.horizontal ? parent.height : implicitHeight
Wallpaper.ImageBackend {
id: imageWallpaper
}
background: null
ListView {
id: wallpapersView
anchors.fill: parent
@ -45,7 +47,37 @@ Controls.Drawer {
snapMode: ListView.SnapToItem
model: imageWallpaper.wallpaperModel
// onCountChanged: currentIndex = Math.min(model.indexOf(configDialog.wallpaperConfiguration["Image"]), model.rowCount()-1)
headerPositioning: ListView.PullBackHeader
headerPositioning: ListView.InlineHeader
header: Controls.ItemDelegate {
id: openSettings
width: imageWallpaperDrawer.horizontal ? parent.width : height * (imageWallpaperDrawer.width / imageWallpaperDrawer.Screen.height)
height: imageWallpaperDrawer.horizontal ? width / (imageWallpaperDrawer.Screen.width / imageWallpaperDrawer.Screen.height) : parent.height
padding: Kirigami.Units.gridUnit / 2
leftPadding: padding
topPadding: padding
rightPadding: padding
bottomPadding: padding
background: Rectangle {
color: Qt.rgba(255, 255, 255, (openSettings.down || openSettings.highlighted) ? 0.3 : 0.2)
radius: Kirigami.Units.gridUnit / 4
anchors.fill: parent
anchors.margins: Kirigami.Units.gridUnit / 4
}
contentItem: Item {
Kirigami.Icon {
anchors.centerIn: parent
implicitHeight: Kirigami.Units.iconSizes.large
implicitWidth: Kirigami.Units.iconSizes.large
source: 'list-add'
}
}
onClicked: imageWallpaperDrawer.wallpaperSettingsRequested()
Keys.onReturnPressed: clicked();
}
delegate: Controls.ItemDelegate {
width: imageWallpaperDrawer.horizontal ? parent.width : height * (imageWallpaperDrawer.width / imageWallpaperDrawer.Screen.height)
@ -68,7 +100,7 @@ Controls.Drawer {
wallpapersView.currentIndex = index;
}
}
z: wallpapersView.currentIndex === index ? 2 : 0
contentItem: Item {
Kirigami.Icon {

View file

@ -190,6 +190,11 @@ Item {
onClosed: {
wallpaperSelectorLoader.active = false;
}
onWallpaperSettingsRequested: {
close();
homeScreen.openConfigure();
}
}
}
}

View file

@ -65,7 +65,7 @@ Item {
implicitHeight: Kirigami.Units.iconSizes.smallMedium
source: 'edit-image'
}
QQC2.Label {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
text: i18n('Wallpapers')
@ -93,7 +93,7 @@ Item {
implicitHeight: Kirigami.Units.iconSizes.smallMedium
source: 'settings-configure'
}
QQC2.Label {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
text: i18n('Settings')
@ -127,6 +127,10 @@ Item {
onClosed: {
wallpaperSelectorLoader.active = false;
}
onWallpaperSettingsRequested: {
close();
root.homeScreen.openContainmentSettings();
}
}
}
}