shift-shell/components/mobileshell/qml/actiondrawer/private/QuickSettingsPanel.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 lines
4.2 KiB
QML
Raw Normal View History

// SPDX-FileCopyrightText: 2021-2024 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
import QtQuick.Effects
import org.kde.kirigami as Kirigami
import org.kde.ksvg 1.0 as KSvg
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
/**
* Quick settings panel for landscape view (right sidebar).
* For the portrait view quicksettings container, see QuickSettingsDrawer.
*/
MobileShell.BaseItem {
id: root
2024-07-27 03:47:44 +00:00
required property var actionDrawer
2024-07-27 03:47:44 +00:00
property QS.QuickSettingsModel quickSettingsModel
/**
* The height of the entire screen the panel opens in.
*/
required property real fullScreenHeight
2024-07-27 03:47:44 +00:00
/**
* Implicit height of the contents of the panel.
*/
readonly property real contentImplicitHeight: column.implicitHeight
2026-05-19 07:13:08 +00:00
readonly property bool isConvergence: ShellSettings.Settings.convergenceModeEnabled
readonly property real panelPadding: isConvergence ? Kirigami.Units.smallSpacing : Kirigami.Units.smallSpacing * 4
2024-07-27 03:47:44 +00:00
property alias quickSettings: quickSettingsProxy.contentItem
property alias statusBar: statusBarProxy.contentItem
readonly property double brightnessPressedValue: quickSettings.brightnessPressedValue
2026-05-19 07:13:08 +00:00
topPadding: panelPadding
leftPadding: panelPadding
rightPadding: panelPadding
bottomPadding: panelPadding
2024-07-27 03:47:44 +00:00
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Window
background: MobileShell.PanelBackground {
anchors.fill: parent
2026-05-19 07:13:08 +00:00
anchors.margins: root.isConvergence ? 0 : Kirigami.Units.largeSpacing
panelType: root.isConvergence ? MobileShell.PanelBackground.PanelType.Flat : MobileShell.PanelBackground.PanelType.Base
radius: root.isConvergence ? 0 : Kirigami.Units.cornerRadius
opacity: brightnessPressedValue
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Window
}
contentItem: Item {
id: containerItem
2024-07-27 03:47:44 +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
height: root.fullScreenHeight
spacing: 0
2024-07-27 03:47:44 +00:00
MobileShell.BaseItem {
id: statusBarProxy
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
// Hide status bar in convergence — already visible in the top panel
visible: !ShellSettings.Settings.convergenceModeEnabled
// Align these to double pixels to aid vertical alignment and sharper icon rendering
Layout.preferredHeight: visible ? Math.round(Kirigami.Units.gridUnit * 1.5 * ShellSettings.Settings.statusBarScaleFactor / 2) * 2 : 0
Layout.maximumHeight: visible ? Math.round(Kirigami.Units.gridUnit * 1.5 * ShellSettings.Settings.statusBarScaleFactor / 2) * 2 : 0
2024-07-27 03:47:44 +00:00
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
}
2024-07-27 03:47:44 +00:00
MobileShell.BaseItem {
id: quickSettingsProxy
2022-05-12 13:20:39 +00:00
width: column.width
implicitHeight: quickSettings.fullHeight
2024-07-27 03:47:44 +00:00
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.maximumHeight: root.fullScreenHeight - root.topPadding - root.bottomPadding - statusBarProxy.height - Kirigami.Units.smallSpacing
Layout.maximumWidth: column.width
}
2024-07-27 03:47:44 +00:00
// add extra space here to prevent the bottom handle from overlapping with the BrightnessItem
Item { Layout.fillHeight: true; height: Kirigami.Units.largeSpacing }
}
2024-07-27 03:47:44 +00:00
Handle {
id: handle
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
visible: !ShellSettings.Settings.convergenceModeEnabled
opacity: brightnessPressedValue
}
}
}