mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-30 16:24:45 +00:00
130 lines
3.9 KiB
QML
130 lines
3.9 KiB
QML
|
|
// SPDX-FileCopyrightText: 2023-2025 Devin Lin <devin@kde.org>
|
||
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||
|
|
|
||
|
|
import QtQuick
|
||
|
|
import QtQuick.Window
|
||
|
|
import QtQuick.Layouts
|
||
|
|
import QtQuick.Dialogs
|
||
|
|
import QtQuick.Controls as QQC2
|
||
|
|
|
||
|
|
import org.kde.plasma.plasmoid
|
||
|
|
import org.kde.kirigami as Kirigami
|
||
|
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||
|
|
|
||
|
|
Window {
|
||
|
|
id: root
|
||
|
|
|
||
|
|
flags: Qt.FramelessWindowHint
|
||
|
|
color: 'transparent'
|
||
|
|
|
||
|
|
onVisibleChanged: {
|
||
|
|
if (visible) {
|
||
|
|
opacityAnim.to = 1;
|
||
|
|
opacityAnim.restart();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
onClosing: (close) => {
|
||
|
|
if (applicationItem.opacity !== 0) {
|
||
|
|
close.accepted = false;
|
||
|
|
opacityAnim.to = 0;
|
||
|
|
opacityAnim.restart();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
signal requestConfigureMenu()
|
||
|
|
|
||
|
|
Kirigami.ApplicationItem {
|
||
|
|
id: applicationItem
|
||
|
|
anchors.fill: parent
|
||
|
|
|
||
|
|
opacity: 0
|
||
|
|
|
||
|
|
NumberAnimation on opacity {
|
||
|
|
id: opacityAnim
|
||
|
|
duration: 200
|
||
|
|
easing.type: Easing.OutCubic
|
||
|
|
onFinished: {
|
||
|
|
if (applicationItem.opacity === 0) {
|
||
|
|
root.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
scale: 0.7 + 0.3 * applicationItem.opacity
|
||
|
|
|
||
|
|
pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar
|
||
|
|
pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.NoNavigationButtons;
|
||
|
|
|
||
|
|
pageStack.initialPage: Kirigami.ScrollablePage {
|
||
|
|
id: page
|
||
|
|
opacity: applicationItem.opacity
|
||
|
|
|
||
|
|
titleDelegate: RowLayout {
|
||
|
|
QQC2.ToolButton {
|
||
|
|
Layout.leftMargin: -Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
|
||
|
|
icon.name: "arrow-left"
|
||
|
|
onClicked: root.close()
|
||
|
|
}
|
||
|
|
|
||
|
|
Kirigami.Heading {
|
||
|
|
level: 1
|
||
|
|
text: page.title
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
title: i18n("Homescreen Settings")
|
||
|
|
|
||
|
|
topPadding: 0
|
||
|
|
bottomPadding: 0
|
||
|
|
leftPadding: 0
|
||
|
|
rightPadding: 0
|
||
|
|
|
||
|
|
ColumnLayout {
|
||
|
|
|
||
|
|
FormCard.FormHeader {
|
||
|
|
title: i18n("Homescreen")
|
||
|
|
}
|
||
|
|
|
||
|
|
FormCard.FormCard {
|
||
|
|
FormCard.FormSwitchDelegate {
|
||
|
|
id: showWallpaperBlur
|
||
|
|
text: i18nc("@option:check", "Show wallpaper blur effect")
|
||
|
|
checked: Plasmoid.settings.showWallpaperBlur
|
||
|
|
onCheckedChanged: {
|
||
|
|
if (checked != Plasmoid.settings.showWallpaperBlur) {
|
||
|
|
Plasmoid.settings.showWallpaperBlur = checked;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
FormCard.FormDelegateSeparator { above: showWallpaperBlur; below: doubleTapToSleepSwitch }
|
||
|
|
|
||
|
|
FormCard.FormSwitchDelegate {
|
||
|
|
id: doubleTapToSleepSwitch
|
||
|
|
text: i18n("Double tap to lock device")
|
||
|
|
checked: Plasmoid.settings.doubleTapToSleep
|
||
|
|
onCheckedChanged: {
|
||
|
|
if (checked != Plasmoid.settings.doubleTapToSleep) {
|
||
|
|
Plasmoid.settings.doubleTapToSleep = checked;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
FormCard.FormCard {
|
||
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
||
|
|
Layout.bottomMargin: Kirigami.Units.gridUnit
|
||
|
|
|
||
|
|
FormCard.FormButtonDelegate {
|
||
|
|
id: containmentSettings
|
||
|
|
text: i18nc("@action:button", "Switch between homescreens and more wallpaper options")
|
||
|
|
icon.name: 'settings-configure'
|
||
|
|
onClicked: root.requestConfigureMenu()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|