2021-12-22 23:29:00 +00:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
2023-05-13 02:07:48 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls as QQC2
|
|
|
|
|
import QtQuick.Layouts
|
2021-12-22 23:29:00 +00:00
|
|
|
|
|
|
|
|
import org.kde.kirigami 2.12 as Kirigami
|
2023-07-09 22:50:33 +00:00
|
|
|
import org.kde.ksvg 1.0 as KSvg
|
2021-12-22 23:29:00 +00:00
|
|
|
|
2023-09-05 15:34:49 +00:00
|
|
|
import org.kde.plasma.core as PlasmaCore
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2021-12-22 23:29:00 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Quick settings drawer pulled down from the top (for portrait mode).
|
|
|
|
|
* For the landscape view quicksettings container, see QuickSettingsPanel.
|
|
|
|
|
*/
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.BaseItem {
|
2021-12-22 23:29:00 +00:00
|
|
|
id: root
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
required property var actionDrawer
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* The amount of height to add to the panel (increasing the height of the quick settings area).
|
|
|
|
|
*/
|
|
|
|
|
property real addedHeight: 0
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* The maximum amount of added height to snap to the full height of the quick settings panel.
|
|
|
|
|
*/
|
|
|
|
|
readonly property real maxAddedHeight: quickSettings.fullHeight - minimizedQuickSettingsHeight // first row is part of minimized height
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* Height of panel when in minimized mode.
|
|
|
|
|
*/
|
|
|
|
|
readonly property real minimizedHeight: bottomPadding + topPadding + statusBar.height + minimizedQuickSettingsHeight + mediaWidget.height + handle.fullHeight
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* Height of just the QuickSettings component in minimized mode.
|
|
|
|
|
*/
|
2023-07-25 01:13:52 +00:00
|
|
|
readonly property real minimizedQuickSettingsHeight: quickSettings.minimizedRowHeight + Kirigami.Units.gridUnit
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* Progress of showing the full quick settings view from pinned.
|
|
|
|
|
*/
|
|
|
|
|
property real minimizedToFullProgress: 1
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
// we need extra padding if the background side border is enabled
|
2024-07-27 03:47:44 +00:00
|
|
|
topPadding: Kirigami.Units.smallSpacing
|
|
|
|
|
leftPadding: Kirigami.Units.smallSpacing
|
2023-07-25 01:13:52 +00:00
|
|
|
rightPadding: Kirigami.Units.smallSpacing
|
|
|
|
|
bottomPadding: Kirigami.Units.smallSpacing * 4
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2023-07-09 22:50:33 +00:00
|
|
|
background: KSvg.FrameSvgItem {
|
2023-09-27 04:18:39 +00:00
|
|
|
enabledBorders: KSvg.FrameSvgItem.BottomBorder
|
2021-12-22 23:29:00 +00:00
|
|
|
imagePath: "widgets/background"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
|
id: containerItem
|
|
|
|
|
implicitHeight: column.implicitHeight
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
// use container item so that our column doesn't get stretched if base item is anchored
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: column
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
spacing: 0
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.StatusBar {
|
2021-12-22 23:29:00 +00:00
|
|
|
id: statusBar
|
|
|
|
|
Layout.fillWidth: true
|
2023-11-02 11:08:17 +00:00
|
|
|
Layout.preferredHeight: MobileShell.Constants.topPanelHeight + Kirigami.Units.gridUnit * 0.8
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2023-07-25 02:24:10 +00:00
|
|
|
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
|
|
|
|
Kirigami.Theme.inherit: false
|
|
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
backgroundColor: "transparent"
|
|
|
|
|
showSecondRow: true
|
|
|
|
|
showDropShadow: false
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2022-04-07 18:11:08 +00:00
|
|
|
// security reasons, system tray also doesn't work on lockscreen
|
|
|
|
|
disableSystemTray: actionDrawer.restrictedPermissions
|
2021-12-22 23:29:00 +00:00
|
|
|
}
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.QuickSettings {
|
2021-12-22 23:29:00 +00:00
|
|
|
id: quickSettings
|
|
|
|
|
Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight
|
2023-07-25 01:13:52 +00:00
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing
|
2021-12-22 23:29:00 +00:00
|
|
|
Layout.fillWidth: true
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2022-12-11 02:05:13 +00:00
|
|
|
mode: QuickSettings.Pages
|
2021-12-22 23:29:00 +00:00
|
|
|
actionDrawer: root.actionDrawer
|
|
|
|
|
minimizedViewProgress: 1 - root.minimizedToFullProgress
|
|
|
|
|
fullViewProgress: root.minimizedToFullProgress
|
|
|
|
|
height: root.minimizedQuickSettingsHeight + root.addedHeight
|
|
|
|
|
width: parent.width
|
|
|
|
|
}
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.MediaControlsWidget {
|
2021-12-22 23:29:00 +00:00
|
|
|
id: mediaWidget
|
|
|
|
|
property real fullHeight: height + Layout.topMargin
|
|
|
|
|
Layout.fillWidth: true
|
2023-07-25 01:13:52 +00:00
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing
|
2023-11-08 17:57:27 +00:00
|
|
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
|
|
|
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
2021-12-22 23:29:00 +00:00
|
|
|
}
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
Handle {
|
|
|
|
|
id: handle
|
|
|
|
|
property real fullHeight: height + Layout.topMargin
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2023-07-25 01:13:52 +00:00
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing * 2
|
2024-07-27 03:47:44 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
onTapped: {
|
|
|
|
|
if (root.minimizedToFullProgress < 0.5) {
|
|
|
|
|
root.actionDrawer.expand();
|
|
|
|
|
} else {
|
|
|
|
|
root.actionDrawer.open();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|