2021-12-22 23:29:00 +00:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.1
|
|
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
|
|
|
|
|
|
import org.kde.kirigami 2.12 as Kirigami
|
|
|
|
|
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
|
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
2022-04-29 20:15:53 +00:00
|
|
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
2021-12-22 23:29:00 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
|
|
|
|
|
|
|
|
|
import "../../components" as Components
|
|
|
|
|
|
|
|
|
|
QuickSettingsDelegate {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
iconItem: icon
|
|
|
|
|
|
2022-04-07 01:55:06 +00:00
|
|
|
// scale animation on press
|
2022-04-30 15:07:07 +00:00
|
|
|
zoomScale: (MobileShell.MobileShellSettings.animationsEnabled && mouseArea.pressed) ? 0.9 : 1
|
2022-04-07 01:55:06 +00:00
|
|
|
|
2022-06-03 23:29:46 +00:00
|
|
|
background: Item {
|
|
|
|
|
// very simple shadow for performance
|
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: 1
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
|
|
radius: PlasmaCore.Units.smallSpacing
|
|
|
|
|
color: Qt.rgba(0, 0, 0, 0.075)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// background
|
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
radius: PlasmaCore.Units.smallSpacing
|
|
|
|
|
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
|
|
|
|
|
color: {
|
|
|
|
|
if (root.enabled) {
|
|
|
|
|
return mouseArea.pressed ? root.enabledButtonPressedColor : root.enabledButtonColor
|
|
|
|
|
} else {
|
|
|
|
|
return mouseArea.pressed ? root.disabledButtonPressedColor : root.disabledButtonColor
|
|
|
|
|
}
|
2021-12-22 23:29:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentItem: MouseArea {
|
|
|
|
|
id: mouseArea
|
2022-04-29 20:15:53 +00:00
|
|
|
|
2022-11-11 16:21:12 +00:00
|
|
|
onPressed: MobileShell.ShellUtil.buttonVibrate();
|
2021-12-22 23:29:00 +00:00
|
|
|
onClicked: root.delegateClick()
|
2022-04-29 20:15:53 +00:00
|
|
|
onPressAndHold: {
|
2022-11-11 16:21:12 +00:00
|
|
|
MobileShell.ShellUtil.buttonVibrate();
|
2022-04-29 20:15:53 +00:00
|
|
|
root.delegatePressAndHold();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 02:08:47 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2021-12-22 23:29:00 +00:00
|
|
|
|
|
|
|
|
PlasmaCore.IconItem {
|
|
|
|
|
id: icon
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
implicitWidth: PlasmaCore.Units.iconSizes.smallMedium
|
|
|
|
|
implicitHeight: width
|
|
|
|
|
source: root.icon
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|