mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 01:07:33 +00:00
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:
parent
1fc13f6d0f
commit
56ca0db5c6
3 changed files with 50 additions and 9 deletions
|
|
@ -15,24 +15,26 @@ import org.kde.plasma.private.mobileshell.wallpaperimageplugin as WallpaperImage
|
||||||
Controls.Drawer {
|
Controls.Drawer {
|
||||||
id: imageWallpaperDrawer
|
id: imageWallpaperDrawer
|
||||||
dragMargin: 0
|
dragMargin: 0
|
||||||
|
|
||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
|
|
||||||
|
signal wallpaperSettingsRequested()
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
wallpapersView.forceActiveFocus()
|
wallpapersView.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitWidth: Kirigami.Units.gridUnit * 10
|
implicitWidth: Kirigami.Units.gridUnit * 10
|
||||||
implicitHeight: Kirigami.Units.gridUnit * 8
|
implicitHeight: Kirigami.Units.gridUnit * 8
|
||||||
width: imageWallpaperDrawer.horizontal ? implicitWidth : parent.width
|
width: imageWallpaperDrawer.horizontal ? implicitWidth : parent.width
|
||||||
height: imageWallpaperDrawer.horizontal ? parent.height : implicitHeight
|
height: imageWallpaperDrawer.horizontal ? parent.height : implicitHeight
|
||||||
|
|
||||||
Wallpaper.ImageBackend {
|
Wallpaper.ImageBackend {
|
||||||
id: imageWallpaper
|
id: imageWallpaper
|
||||||
}
|
}
|
||||||
|
|
||||||
background: null
|
background: null
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: wallpapersView
|
id: wallpapersView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -45,7 +47,37 @@ Controls.Drawer {
|
||||||
snapMode: ListView.SnapToItem
|
snapMode: ListView.SnapToItem
|
||||||
model: imageWallpaper.wallpaperModel
|
model: imageWallpaper.wallpaperModel
|
||||||
// onCountChanged: currentIndex = Math.min(model.indexOf(configDialog.wallpaperConfiguration["Image"]), model.rowCount()-1)
|
// 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 {
|
delegate: Controls.ItemDelegate {
|
||||||
width: imageWallpaperDrawer.horizontal ? parent.width : height * (imageWallpaperDrawer.width / imageWallpaperDrawer.Screen.height)
|
width: imageWallpaperDrawer.horizontal ? parent.width : height * (imageWallpaperDrawer.width / imageWallpaperDrawer.Screen.height)
|
||||||
|
|
@ -68,7 +100,7 @@ Controls.Drawer {
|
||||||
wallpapersView.currentIndex = index;
|
wallpapersView.currentIndex = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
z: wallpapersView.currentIndex === index ? 2 : 0
|
z: wallpapersView.currentIndex === index ? 2 : 0
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,11 @@ Item {
|
||||||
onClosed: {
|
onClosed: {
|
||||||
wallpaperSelectorLoader.active = false;
|
wallpaperSelectorLoader.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onWallpaperSettingsRequested: {
|
||||||
|
close();
|
||||||
|
homeScreen.openConfigure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ Item {
|
||||||
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
source: 'edit-image'
|
source: 'edit-image'
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||||
text: i18n('Wallpapers')
|
text: i18n('Wallpapers')
|
||||||
|
|
@ -93,7 +93,7 @@ Item {
|
||||||
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
source: 'settings-configure'
|
source: 'settings-configure'
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||||
text: i18n('Settings')
|
text: i18n('Settings')
|
||||||
|
|
@ -127,6 +127,10 @@ Item {
|
||||||
onClosed: {
|
onClosed: {
|
||||||
wallpaperSelectorLoader.active = false;
|
wallpaperSelectorLoader.active = false;
|
||||||
}
|
}
|
||||||
|
onWallpaperSettingsRequested: {
|
||||||
|
close();
|
||||||
|
root.homeScreen.openContainmentSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue