Warning, /plasma/plasma-mobile/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com>
0003  *   SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
0004  *
0005  *   SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick 2.15
0009 import QtQuick.Layouts 1.1
0010 
0011 import org.kde.kirigami 2.12 as Kirigami
0012 
0013 import org.kde.plasma.core as PlasmaCore
0014 import org.kde.plasma.private.mobileshell as MobileShell
0015 import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
0016 import org.kde.plasma.components 3.0 as PlasmaComponents
0017 
0018 QuickSettingsDelegate {
0019     id: root
0020     
0021     padding: Kirigami.Units.smallSpacing * 2
0022     iconItem: icon
0023     
0024     // scale animation on press
0025     zoomScale: (ShellSettings.Settings.animationsEnabled && mouseArea.pressed) ? 0.9 : 1
0026     
0027     background: Item {
0028         // very simple shadow for performance
0029         Rectangle {
0030             anchors.top: parent.top
0031             anchors.topMargin: 1
0032             anchors.left: parent.left
0033             anchors.right: parent.right
0034             height: parent.height
0035             
0036             radius: Kirigami.Units.smallSpacing
0037             color: Qt.rgba(0, 0, 0, 0.075)
0038         }
0039     
0040         // background color
0041         Rectangle {
0042             anchors.fill: parent
0043             radius: Kirigami.Units.smallSpacing
0044             border.width: 1
0045             border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
0046             color: {
0047                 if (root.enabled) {
0048                     return mouseArea.pressed ? root.enabledButtonPressedColor : root.enabledButtonColor
0049                 } else {
0050                     return mouseArea.pressed ? root.disabledButtonPressedColor : root.disabledButtonColor
0051                 }
0052             }
0053         }
0054     }
0055     
0056     MobileShell.HapticsEffect {
0057         id: haptics
0058     }
0059     
0060     contentItem: MouseArea {
0061         id: mouseArea
0062         
0063         onPressed: haptics.buttonVibrate()
0064         onClicked: root.delegateClick()
0065         onPressAndHold: {
0066             haptics.buttonVibrate();
0067             root.delegatePressAndHold();
0068         }
0069         
0070         cursorShape: Qt.PointingHandCursor
0071         
0072         Kirigami.Icon {
0073             id: icon
0074             anchors.top: parent.top
0075             anchors.left: parent.left
0076             implicitWidth: Kirigami.Units.iconSizes.small
0077             implicitHeight: width
0078             source: root.icon
0079         }
0080         
0081         ColumnLayout {
0082             id: column
0083             spacing: Kirigami.Units.smallSpacing
0084             anchors.right: parent.right
0085             anchors.left: parent.left
0086             anchors.bottom: parent.bottom
0087 
0088             PlasmaComponents.Label {
0089                 Layout.fillWidth: true
0090                 elide: Text.ElideRight
0091                 text: root.text
0092                 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.75 // TODO base height off of size of delegate
0093                 font.weight: Font.Bold
0094             }
0095 
0096             MobileShell.MarqueeLabel {
0097                 // if no status is given, just use On/Off
0098                 inputText: root.status ? root.status : (root.enabled ? i18n("On") : i18n("Off"))
0099                 opacity: 0.6
0100 
0101                 Layout.fillWidth: true
0102                 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.75
0103             }
0104         }
0105     }
0106 }
0107