mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +00:00
lockscreen: Refactor and lazy load notifications
This commit is contained in:
parent
c4472ca39a
commit
2a779900f3
5 changed files with 310 additions and 294 deletions
|
|
@ -12,20 +12,15 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
import org.kde.notificationmanager 1.0 as NotificationManager
|
import org.kde.notificationmanager 1.0 as NotificationManager
|
||||||
|
|
||||||
Loader {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property real openFactor
|
required property real openFactor
|
||||||
|
required property real statusBarHeight
|
||||||
readonly property real statusBarHeight: PlasmaCore.Units.gridUnit * 1.25
|
|
||||||
|
|
||||||
property var notificationsModel: []
|
property var notificationsModel: []
|
||||||
|
|
||||||
signal passwordRequested()
|
signal passwordRequested()
|
||||||
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
sourceComponent: Item {
|
|
||||||
// top status bar
|
// top status bar
|
||||||
MobileShell.StatusBar {
|
MobileShell.StatusBar {
|
||||||
id: statusBar
|
id: statusBar
|
||||||
|
|
@ -57,6 +52,7 @@ Loader {
|
||||||
id: drawer
|
id: drawer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
visible: offset !== 0
|
||||||
restrictedPermissions: true
|
restrictedPermissions: true
|
||||||
|
|
||||||
notificationSettings: NotificationManager.Settings {}
|
notificationSettings: NotificationManager.Settings {}
|
||||||
|
|
@ -88,4 +84,3 @@ Loader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import org.kde.kirigami 2.12 as Kirigami
|
||||||
*
|
*
|
||||||
* Special attention must be paid to ensuring the GUI loads as fast as possible.
|
* Special attention must be paid to ensuring the GUI loads as fast as possible.
|
||||||
*/
|
*/
|
||||||
PlasmaCore.ColorScope {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var lockScreenState: LockScreenState {}
|
property var lockScreenState: LockScreenState {}
|
||||||
|
|
@ -33,9 +33,6 @@ PlasmaCore.ColorScope {
|
||||||
readonly property bool drawerOpen: flickable.openFactor >= 1
|
readonly property bool drawerOpen: flickable.openFactor >= 1
|
||||||
property var passwordBar: keypadLoader.item.passwordBar
|
property var passwordBar: keypadLoader.item.passwordBar
|
||||||
|
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
// listen for keyboard events, and focus on input area
|
// listen for keyboard events, and focus on input area
|
||||||
Component.onCompleted: forceActiveFocus();
|
Component.onCompleted: forceActiveFocus();
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
|
|
@ -66,17 +63,6 @@ PlasmaCore.ColorScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// header bar and action drawer
|
|
||||||
HeaderComponent {
|
|
||||||
id: headerBar
|
|
||||||
z: 1 // on top of flick area
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
openFactor: flickable.openFactor
|
|
||||||
notificationsModel: root.notifModel
|
|
||||||
onPasswordRequested: root.askPassword()
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.lockScreenState
|
target: root.lockScreenState
|
||||||
|
|
||||||
|
|
@ -86,6 +72,27 @@ PlasmaCore.ColorScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlasmaCore.ColorScope {
|
||||||
|
anchors.fill: parent
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
|
||||||
|
// header bar and action drawer
|
||||||
|
Loader {
|
||||||
|
id: headerBarLoader
|
||||||
|
z: 1 // on top of flick area
|
||||||
|
readonly property real statusBarHeight: PlasmaCore.Units.gridUnit * 1.25
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
sourceComponent: HeaderComponent {
|
||||||
|
statusBarHeight: headerBarLoader.statusBarHeight
|
||||||
|
openFactor: flickable.openFactor
|
||||||
|
notificationsModel: root.notifModel
|
||||||
|
onPasswordRequested: root.askPassword()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FlickContainer {
|
FlickContainer {
|
||||||
id: flickable
|
id: flickable
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -158,7 +165,7 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
onPasswordRequested: flickable.goToOpenPosition()
|
onPasswordRequested: flickable.goToOpenPosition()
|
||||||
|
|
||||||
anchors.topMargin: headerBar.statusBarHeight
|
anchors.topMargin: headerBarLoader.statusBarHeight
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: scrollUpIconLoader.top
|
anchors.bottom: scrollUpIconLoader.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
@ -246,3 +253,4 @@ PlasmaCore.ColorScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ Loader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var lockScreenState
|
required property var lockScreenState
|
||||||
property var notificationsModel: []
|
|
||||||
|
|
||||||
|
property var notificationsModel: []
|
||||||
property bool notificationsShown: false
|
property bool notificationsShown: false
|
||||||
|
|
||||||
property real fullHeight
|
property real fullHeight
|
||||||
|
|
@ -27,11 +27,11 @@ Loader {
|
||||||
onLoaded: loadTimer.restart();
|
onLoaded: loadTimer.restart();
|
||||||
Timer {
|
Timer {
|
||||||
id: loadTimer
|
id: loadTimer
|
||||||
interval: PlasmaCore.Units.longDuration
|
interval: 200
|
||||||
}
|
}
|
||||||
|
|
||||||
// move while swiping up
|
// move while swiping up
|
||||||
transform: Translate { y: Math.round((1 - phoneComponent.opacity) * (-root.height / 6)) }
|
transform: Translate { y: Math.round((1 - root.opacity) * (-root.height / 6)) }
|
||||||
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceComponent: Item {
|
sourceComponent: Item {
|
||||||
|
|
@ -47,8 +47,8 @@ Loader {
|
||||||
// animate
|
// animate
|
||||||
Behavior on anchors.topMargin {
|
Behavior on anchors.topMargin {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: loadTimer.running ? 0 : PlasmaCore.Units.longDuration
|
duration: loadTimer.running ? 0 : PlasmaCore.Units.veryLongDuration
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutExpo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ Loader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var lockScreenState
|
required property var lockScreenState
|
||||||
property var notificationsModel: []
|
|
||||||
|
|
||||||
|
property var notificationsModel: []
|
||||||
property bool notificationsShown: false
|
property bool notificationsShown: false
|
||||||
|
|
||||||
signal passwordRequested()
|
signal passwordRequested()
|
||||||
|
|
|
||||||
|
|
@ -14,23 +14,30 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
import org.kde.notificationmanager 1.0 as NotificationManager
|
import org.kde.notificationmanager 1.0 as NotificationManager
|
||||||
|
|
||||||
Rectangle {
|
Loader {
|
||||||
id: root
|
id: root
|
||||||
required property var lockScreenState
|
required property var lockScreenState
|
||||||
|
|
||||||
property var notificationsModel: []
|
property var notificationsModel: []
|
||||||
property var notificationSettings: NotificationManager.Settings {}
|
property var notificationSettings: NotificationManager.Settings {}
|
||||||
|
|
||||||
readonly property bool notificationsShown: notificationsList.hasNotifications
|
|
||||||
|
|
||||||
signal passwordRequested()
|
|
||||||
|
|
||||||
property real leftMargin: 0
|
property real leftMargin: 0
|
||||||
property real rightMargin: 0
|
property real rightMargin: 0
|
||||||
property real topMargin: 0
|
property real topMargin: 0
|
||||||
property real bottomMargin: 0
|
property real bottomMargin: 0
|
||||||
|
readonly property bool notificationsShown: item && item.notificationsList.hasNotifications
|
||||||
|
|
||||||
color: "transparent"
|
property var notificationsList: item ? item.notificationsList : null
|
||||||
clip: true
|
|
||||||
|
signal passwordRequested()
|
||||||
|
|
||||||
|
// perform delayed loading of notifications
|
||||||
|
active: false
|
||||||
|
Timer {
|
||||||
|
interval: 500
|
||||||
|
running: true
|
||||||
|
onTriggered: root.active = true
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: lockScreenState
|
target: lockScreenState
|
||||||
|
|
@ -48,6 +55,11 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceComponent: Item {
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
property alias notificationsList: notificationsList
|
||||||
|
|
||||||
PlasmaCore.ColorScope {
|
PlasmaCore.ColorScope {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: root.topMargin
|
anchors.topMargin: root.topMargin
|
||||||
|
|
@ -74,3 +86,4 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue