2024-06-26 02:57:42 +00:00
|
|
|
// SPDX-FileCopyrightText: 2021-2024 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Effects
|
|
|
|
|
|
|
|
|
|
import org.kde.kirigami 2.20 as Kirigami
|
|
|
|
|
import org.kde.plasma.workspace.keyboardlayout 1.0
|
|
|
|
|
import org.kde.notificationmanager as Notifications
|
|
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
required property bool isVertical
|
2025-03-20 02:06:33 +00:00
|
|
|
required property var lockScreenState
|
|
|
|
|
|
|
|
|
|
readonly property bool listOverflowing: notificationComponent.listOverflowing
|
2024-06-26 02:57:42 +00:00
|
|
|
|
|
|
|
|
property var notificationsModel: []
|
|
|
|
|
property bool notificationsShown: false
|
|
|
|
|
|
2025-03-20 02:06:33 +00:00
|
|
|
property bool scrollLock: false
|
2024-06-26 02:57:42 +00:00
|
|
|
|
|
|
|
|
signal passwordRequested()
|
|
|
|
|
|
|
|
|
|
// Vertical layout
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: verticalLayout
|
|
|
|
|
visible: root.isVertical
|
|
|
|
|
spacing: 0
|
|
|
|
|
|
2024-07-30 02:53:33 +00:00
|
|
|
anchors.topMargin: Kirigami.Units.gridUnit * 3.5
|
|
|
|
|
anchors.bottomMargin: Kirigami.Units.gridUnit * 2
|
2024-06-26 02:57:42 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
LayoutItemProxy { target: clockAndMediaWidget }
|
|
|
|
|
LayoutItemProxy { target: notificationComponent }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Horizontal layout (landscape on smaller devices)
|
|
|
|
|
Item {
|
|
|
|
|
id: horizontalLayout
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
visible: !root.isVertical
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: leftLayout
|
|
|
|
|
width: parent.width / 2
|
|
|
|
|
anchors {
|
|
|
|
|
top: parent.top
|
|
|
|
|
bottom: parent.bottom
|
|
|
|
|
left: parent.left
|
|
|
|
|
leftMargin: Kirigami.Units.gridUnit * 3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LayoutItemProxy { target: clockAndMediaWidget }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: rightLayout
|
|
|
|
|
anchors {
|
|
|
|
|
top: parent.top
|
|
|
|
|
bottom: parent.bottom
|
|
|
|
|
left: leftLayout.right
|
|
|
|
|
right: parent.right
|
|
|
|
|
rightMargin: Kirigami.Units.gridUnit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LayoutItemProxy { target: notificationComponent }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Clock and media widget column
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: clockAndMediaWidget
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: root.isVertical
|
2024-07-30 02:53:33 +00:00
|
|
|
spacing: Kirigami.Units.gridUnit
|
2024-06-26 02:57:42 +00:00
|
|
|
|
|
|
|
|
Clock {
|
|
|
|
|
layoutAlignment: root.isVertical ? Qt.AlignHCenter : Qt.AlignLeft
|
|
|
|
|
Layout.alignment: root.isVertical ? Qt.AlignHCenter : Qt.AlignLeft
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MobileShell.MediaControlsWidget {
|
2025-03-20 02:06:33 +00:00
|
|
|
id: mediaControlsWidget
|
2024-06-26 02:57:42 +00:00
|
|
|
Layout.alignment: root.isVertical ? Qt.AlignHCenter : Qt.AlignLeft
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.maximumWidth: Kirigami.Units.gridUnit * 25
|
|
|
|
|
Layout.leftMargin: root.isVertical ? Kirigami.Units.gridUnit : 0
|
|
|
|
|
Layout.rightMargin: root.isVertical ? Kirigami.Units.gridUnit : 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-20 02:06:33 +00:00
|
|
|
// notification widget column
|
2024-06-26 02:57:42 +00:00
|
|
|
NotificationsComponent {
|
|
|
|
|
id: notificationComponent
|
|
|
|
|
lockScreenState: root.lockScreenState
|
|
|
|
|
notificationsModel: root.notificationsModel
|
|
|
|
|
|
2025-03-20 02:06:33 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
2024-06-26 02:57:42 +00:00
|
|
|
Layout.fillWidth: true
|
2025-03-20 02:06:33 +00:00
|
|
|
Layout.fillHeight: true
|
2024-06-26 02:57:42 +00:00
|
|
|
Layout.maximumWidth: Kirigami.Units.gridUnit * (25 + 2) // clip margins
|
|
|
|
|
|
2025-03-20 02:06:33 +00:00
|
|
|
topPadding: root.isVertical ? (mediaControlsWidget.visible ? Kirigami.Units.smallSpacing : Kirigami.Units.gridUnit) : Kirigami.Units.gridUnit
|
|
|
|
|
|
2024-06-26 02:57:42 +00:00
|
|
|
leftMargin: root.isVertical ? 0 : Kirigami.Units.gridUnit
|
|
|
|
|
rightMargin: root.isVertical ? 0 : Kirigami.Units.gridUnit
|
2025-03-20 02:06:33 +00:00
|
|
|
topMargin: root.isVertical ? 0 : MobileShell.Constants.topPanelHeight
|
|
|
|
|
bottomMargin: Kirigami.Units.gridUnit * 2
|
|
|
|
|
scrollLock: root.scrollLock
|
2024-06-26 02:57:42 +00:00
|
|
|
|
|
|
|
|
onPasswordRequested: root.passwordRequested()
|
|
|
|
|
onNotificationsShownChanged: root.notificationsShown = notificationsShown
|
|
|
|
|
}
|
2024-07-30 02:53:33 +00:00
|
|
|
}
|