Warning, /plasma/plasma-mobile/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsDrawer.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls as QQC2 0009 import QtQuick.Layouts 0010 0011 import org.kde.kirigami 2.12 as Kirigami 0012 import org.kde.ksvg 1.0 as KSvg 0013 0014 import org.kde.plasma.core as PlasmaCore 0015 import org.kde.plasma.private.mobileshell as MobileShell 0016 0017 /** 0018 * Quick settings drawer pulled down from the top (for portrait mode). 0019 * For the landscape view quicksettings container, see QuickSettingsPanel. 0020 */ 0021 MobileShell.BaseItem { 0022 id: root 0023 0024 required property var actionDrawer 0025 0026 /** 0027 * The amount of height to add to the panel (increasing the height of the quick settings area). 0028 */ 0029 property real addedHeight: 0 0030 0031 /** 0032 * The maximum amount of added height to snap to the full height of the quick settings panel. 0033 */ 0034 readonly property real maxAddedHeight: quickSettings.fullHeight - minimizedQuickSettingsHeight // first row is part of minimized height 0035 0036 /** 0037 * Height of panel when in minimized mode. 0038 */ 0039 readonly property real minimizedHeight: bottomPadding + topPadding + statusBar.height + minimizedQuickSettingsHeight + mediaWidget.height + handle.fullHeight 0040 0041 /** 0042 * Height of just the QuickSettings component in minimized mode. 0043 */ 0044 readonly property real minimizedQuickSettingsHeight: quickSettings.minimizedRowHeight + Kirigami.Units.gridUnit 0045 0046 /** 0047 * Progress of showing the full quick settings view from pinned. 0048 */ 0049 property real minimizedToFullProgress: 1 0050 0051 // we need extra padding if the background side border is enabled 0052 topPadding: Kirigami.Units.smallSpacing 0053 leftPadding: Kirigami.Units.smallSpacing 0054 rightPadding: Kirigami.Units.smallSpacing 0055 bottomPadding: Kirigami.Units.smallSpacing * 4 0056 0057 background: KSvg.FrameSvgItem { 0058 enabledBorders: KSvg.FrameSvgItem.BottomBorder 0059 imagePath: "widgets/background" 0060 } 0061 0062 contentItem: Item { 0063 id: containerItem 0064 implicitHeight: column.implicitHeight 0065 0066 // use container item so that our column doesn't get stretched if base item is anchored 0067 ColumnLayout { 0068 id: column 0069 anchors.left: parent.left 0070 anchors.right: parent.right 0071 anchors.top: parent.top 0072 spacing: 0 0073 0074 MobileShell.StatusBar { 0075 id: statusBar 0076 Layout.fillWidth: true 0077 Layout.preferredHeight: MobileShell.Constants.topPanelHeight + Kirigami.Units.gridUnit * 0.8 0078 0079 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0080 Kirigami.Theme.inherit: false 0081 0082 backgroundColor: "transparent" 0083 showSecondRow: true 0084 showDropShadow: false 0085 0086 // security reasons, system tray also doesn't work on lockscreen 0087 disableSystemTray: actionDrawer.restrictedPermissions 0088 } 0089 0090 MobileShell.QuickSettings { 0091 id: quickSettings 0092 Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight 0093 Layout.topMargin: Kirigami.Units.smallSpacing 0094 Layout.fillWidth: true 0095 0096 mode: QuickSettings.Pages 0097 actionDrawer: root.actionDrawer 0098 minimizedViewProgress: 1 - root.minimizedToFullProgress 0099 fullViewProgress: root.minimizedToFullProgress 0100 height: root.minimizedQuickSettingsHeight + root.addedHeight 0101 width: parent.width 0102 } 0103 0104 MobileShell.MediaControlsWidget { 0105 id: mediaWidget 0106 property real fullHeight: height + Layout.topMargin 0107 Layout.fillWidth: true 0108 Layout.topMargin: Kirigami.Units.smallSpacing 0109 Layout.leftMargin: Kirigami.Units.largeSpacing 0110 Layout.rightMargin: Kirigami.Units.largeSpacing 0111 } 0112 0113 Handle { 0114 id: handle 0115 property real fullHeight: height + Layout.topMargin 0116 Layout.alignment: Qt.AlignHCenter 0117 Layout.topMargin: Kirigami.Units.smallSpacing * 2 0118 0119 onTapped: { 0120 if (root.minimizedToFullProgress < 0.5) { 0121 root.actionDrawer.expand(); 0122 } else { 0123 root.actionDrawer.open(); 0124 } 0125 } 0126 } 0127 } 0128 } 0129 }