2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Window
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls as QQC2
|
|
|
|
|
|
|
|
|
|
import org.kde.kirigami 2.20 as Kirigami
|
|
|
|
|
|
|
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2023-10-22 03:59:27 +00:00
|
|
|
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
|
|
|
|
|
|
|
|
|
import '../delegate'
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
2024-06-21 04:42:14 +00:00
|
|
|
property Folio.HomeScreen folio
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
property var homeScreen
|
|
|
|
|
property real settingsModeHomeScreenScale
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
readonly property bool homeScreenInteractive: !appletListViewer.open
|
|
|
|
|
|
2025-04-25 01:23:48 +00:00
|
|
|
property real bottomMargin: 0
|
|
|
|
|
property real leftMargin: 0
|
|
|
|
|
property real rightMargin: 0
|
|
|
|
|
|
2024-07-26 20:34:12 +00:00
|
|
|
Connections {
|
|
|
|
|
target: folio.HomeScreenState
|
|
|
|
|
|
|
|
|
|
// Close applet viewer when settings view closes
|
|
|
|
|
function onViewStateChanged() {
|
|
|
|
|
if (folio.HomeScreenState.viewState !== Folio.HomeScreenState.SettingsView) {
|
|
|
|
|
appletListViewer.requestClose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
MouseArea {
|
|
|
|
|
id: closeSettings
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.closeSettingsView();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: settingsBar
|
|
|
|
|
|
|
|
|
|
Kirigami.Theme.inherit: false
|
|
|
|
|
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
|
|
|
|
|
2025-04-25 01:23:48 +00:00
|
|
|
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
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-04-25 01:23:48 +00:00
|
|
|
GridLayout {
|
2023-10-22 03:59:27 +00:00
|
|
|
id: settingsOptions
|
2025-04-25 01:23:48 +00:00
|
|
|
flow: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Bottom ? GridLayout.LeftToRight : GridLayout.TopToBottom
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
2023-10-23 15:40:26 +00:00
|
|
|
PC3.ToolButton {
|
2023-11-14 04:26:45 +00:00
|
|
|
opacity: 0.9
|
2023-10-22 03:59:27 +00:00
|
|
|
implicitHeight: Kirigami.Units.gridUnit * 4
|
|
|
|
|
implicitWidth: Kirigami.Units.gridUnit * 5
|
2023-11-14 04:26:45 +00:00
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
|
spacing: Kirigami.Units.largeSpacing
|
|
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
|
|
|
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
|
source: 'edit-image'
|
|
|
|
|
}
|
2024-06-21 04:42:14 +00:00
|
|
|
|
2023-11-14 04:26:45 +00:00
|
|
|
QQC2.Label {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
|
|
|
text: i18n('Wallpapers')
|
|
|
|
|
font.bold: true
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-02 03:30:55 +00:00
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
wallpaperSelectorLoader.active = true;
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.closeSettingsView();
|
2024-01-02 03:30:55 +00:00
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-10-23 15:40:26 +00:00
|
|
|
PC3.ToolButton {
|
2023-11-14 04:26:45 +00:00
|
|
|
opacity: 0.9
|
2023-10-22 03:59:27 +00:00
|
|
|
implicitHeight: Kirigami.Units.gridUnit * 4
|
|
|
|
|
implicitWidth: Kirigami.Units.gridUnit * 5
|
|
|
|
|
|
2023-11-14 04:26:45 +00:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
|
spacing: Kirigami.Units.largeSpacing
|
|
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
|
|
|
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
|
source: 'settings-configure'
|
|
|
|
|
}
|
2024-06-21 04:42:14 +00:00
|
|
|
|
2023-11-14 04:26:45 +00:00
|
|
|
QQC2.Label {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
|
|
|
text: i18n('Settings')
|
|
|
|
|
font.bold: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 17:20:32 +00:00
|
|
|
onClicked: {
|
|
|
|
|
// ensure that if the window is already opened, it gets raised to the top
|
|
|
|
|
settingsWindow.hide();
|
|
|
|
|
settingsWindow.showMaximized();
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-10-23 15:40:26 +00:00
|
|
|
PC3.ToolButton {
|
2023-11-14 04:26:45 +00:00
|
|
|
opacity: 0.9
|
2023-10-22 03:59:27 +00:00
|
|
|
implicitHeight: Kirigami.Units.gridUnit * 4
|
|
|
|
|
implicitWidth: Kirigami.Units.gridUnit * 5
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2023-11-14 04:26:45 +00:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
|
spacing: Kirigami.Units.largeSpacing
|
|
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
|
|
|
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
|
source: 'widget-alternatives'
|
|
|
|
|
}
|
2024-06-21 04:42:14 +00:00
|
|
|
|
2023-11-14 04:26:45 +00:00
|
|
|
QQC2.Label {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
|
|
|
text: i18n('Widgets')
|
|
|
|
|
font.bold: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
onClicked: {
|
|
|
|
|
appletListViewer.open = true;
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-25 01:23:48 +00:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
AppletListViewer {
|
|
|
|
|
id: appletListViewer
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
2023-11-05 05:14:39 +00:00
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
|
|
property bool open: false
|
|
|
|
|
onRequestClose: open = false
|
|
|
|
|
|
|
|
|
|
opacity: open ? 1 : 0
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
y: (opacity === 0) ? appletListViewer.height : 0
|
|
|
|
|
|
|
|
|
|
homeScreen: root.homeScreen
|
|
|
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
|
NumberAnimation { duration: Kirigami.Units.shortDuration }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
SettingsWindow {
|
|
|
|
|
id: settingsWindow
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
2023-10-22 03:59:27 +00:00
|
|
|
visible: false
|
|
|
|
|
|
|
|
|
|
onRequestConfigureMenu: {
|
|
|
|
|
homeScreen.openConfigure()
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-02 03:30:55 +00:00
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: wallpaperSelectorLoader
|
|
|
|
|
asynchronous: true
|
|
|
|
|
active: false
|
|
|
|
|
|
|
|
|
|
onLoaded: {
|
|
|
|
|
wallpaperSelectorLoader.item.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceComponent: MobileShell.WallpaperSelector {
|
|
|
|
|
horizontal: root.width > root.height
|
|
|
|
|
edge: horizontal ? Qt.LeftEdge : Qt.BottomEdge
|
|
|
|
|
bottomMargin: root.homeScreen.bottomMargin
|
|
|
|
|
leftMargin: root.homeScreen.leftMargin
|
|
|
|
|
rightMargin: root.homeScreen.rightMargin
|
|
|
|
|
onClosed: {
|
|
|
|
|
wallpaperSelectorLoader.active = false;
|
|
|
|
|
}
|
2024-07-03 22:38:10 +00:00
|
|
|
|
|
|
|
|
onWallpaperSettingsRequested: {
|
|
|
|
|
close();
|
|
|
|
|
homeScreen.openConfigure();
|
|
|
|
|
}
|
2024-01-02 03:30:55 +00:00
|
|
|
}
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|