2020-02-01 14:21:24 +00:00
|
|
|
/*
|
2022-02-12 05:19:44 +00:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
2022-02-17 05:52:34 +00:00
|
|
|
* SPDX-FileCopyrightText: 2021-2022 Devin Lin <espidev@gmail.com>
|
2022-02-12 05:19:44 +00:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
*/
|
2014-08-20 10:10:58 +00:00
|
|
|
|
2020-02-01 17:08:06 +00:00
|
|
|
import QtQuick 2.12
|
2016-02-24 19:15:15 +00:00
|
|
|
import QtQuick.Controls 1.1
|
2019-10-31 06:20:36 +00:00
|
|
|
import QtQuick.Layouts 1.1
|
2021-12-22 23:29:00 +00:00
|
|
|
|
2016-02-24 19:15:15 +00:00
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2020-08-31 01:38:46 +00:00
|
|
|
import org.kde.notificationmanager 1.1 as Notifications
|
2021-12-22 23:29:00 +00:00
|
|
|
|
2019-10-31 06:20:36 +00:00
|
|
|
PlasmaCore.ColorScope {
|
2020-02-01 14:21:24 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property string password
|
2020-08-31 01:38:46 +00:00
|
|
|
|
|
|
|
|
property bool isWidescreen: root.height < root.width * 0.75
|
2021-05-05 19:48:06 +00:00
|
|
|
property bool notificationsShown: false
|
2020-09-17 16:04:49 +00:00
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
readonly property bool drawerOpen: flickable.openFactor >= 1
|
2020-07-12 03:33:54 +00:00
|
|
|
|
2020-11-19 11:24:29 +00:00
|
|
|
function askPassword() {
|
2022-02-12 05:19:44 +00:00
|
|
|
flickable.goToOpenPosition();
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
Notifications.WatchedNotificationsModel {
|
|
|
|
|
id: notifModel
|
2020-11-19 11:24:29 +00:00
|
|
|
}
|
2022-02-12 05:19:44 +00:00
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
// wallpaper blur
|
|
|
|
|
Loader {
|
2020-02-01 14:21:24 +00:00
|
|
|
anchors.fill: parent
|
2022-02-17 05:52:34 +00:00
|
|
|
asynchronous: true
|
|
|
|
|
sourceComponent: WallpaperBlur {
|
|
|
|
|
source: wallpaper
|
|
|
|
|
blur: root.notificationsShown || root.drawerOpen // only blur once animation finished for performance
|
2020-08-31 01:38:46 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-05-05 19:48:06 +00:00
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
FlickContainer {
|
|
|
|
|
id: flickable
|
|
|
|
|
anchors.fill: parent
|
2020-08-31 01:38:46 +00:00
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
property real openFactor: position / keypadHeight
|
|
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
keypadHeight: PlasmaCore.Units.gridUnit * 20
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
flickable.position = 0;
|
|
|
|
|
flickable.goToClosePosition();
|
|
|
|
|
}
|
2022-02-12 05:19:44 +00:00
|
|
|
|
|
|
|
|
onPositionChanged: {
|
|
|
|
|
if (position > keypadHeight) {
|
|
|
|
|
position = keypadHeight;
|
|
|
|
|
} else if (position < 0) {
|
|
|
|
|
position = 0;
|
2020-08-31 01:38:46 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
Item {
|
|
|
|
|
width: flickable.width
|
|
|
|
|
height: flickable.height
|
|
|
|
|
y: flickable.contentY // effectively anchored to the screen
|
2020-08-31 01:38:46 +00:00
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
// header bar
|
2022-02-17 05:52:34 +00:00
|
|
|
StatusBarComponent {
|
|
|
|
|
id: statusBar
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2022-02-12 05:19:44 +00:00
|
|
|
opacity: 1 - flickable.openFactor
|
2021-05-05 19:48:06 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
LockScreenNarrowContent {
|
2022-02-12 05:19:44 +00:00
|
|
|
id: phoneComponent
|
|
|
|
|
visible: !isWidescreen
|
|
|
|
|
active: visible
|
|
|
|
|
opacity: 1 - flickable.openFactor
|
|
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
fullHeight: root.height
|
2022-02-12 05:19:44 +00:00
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.bottom: scrollUpIcon.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2021-05-05 19:48:06 +00:00
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
// move while swiping up
|
|
|
|
|
transform: Translate { y: Math.round((1 - phoneComponent.opacity) * (-root.height / 6)) }
|
2021-05-05 19:48:06 +00:00
|
|
|
}
|
2022-02-12 05:19:44 +00:00
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
LockScreenWideScreenContent {
|
2022-02-12 05:19:44 +00:00
|
|
|
id: tabletComponent
|
|
|
|
|
visible: isWidescreen
|
|
|
|
|
active: visible
|
|
|
|
|
opacity: 1 - flickable.openFactor
|
2021-05-05 19:48:06 +00:00
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
anchors.top: statusBar.bottom
|
|
|
|
|
anchors.bottom: scrollUpIcon.top
|
2022-02-12 05:19:44 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2021-05-05 19:48:06 +00:00
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
// move while swiping up
|
|
|
|
|
transform: Translate { y: Math.round((1 - phoneComponent.opacity) * (-root.height / 6)) }
|
2020-07-12 03:33:54 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
// scroll up icon
|
2020-08-31 01:38:46 +00:00
|
|
|
PlasmaCore.IconItem {
|
2022-02-12 05:19:44 +00:00
|
|
|
id: scrollUpIcon
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: PlasmaCore.Units.gridUnit + flickable.position * 0.5
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-01-14 01:50:36 +00:00
|
|
|
implicitWidth: PlasmaCore.Units.iconSizes.smallMedium
|
2022-02-12 05:19:44 +00:00
|
|
|
implicitHeight: PlasmaCore.Units.iconSizes.smallMedium
|
|
|
|
|
opacity: 1 - flickable.openFactor
|
|
|
|
|
|
2020-08-31 01:38:46 +00:00
|
|
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
2022-02-12 05:19:44 +00:00
|
|
|
source: "arrow-up"
|
2020-07-12 03:33:54 +00:00
|
|
|
}
|
2022-02-12 05:19:44 +00:00
|
|
|
|
|
|
|
|
// password keypad
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: passwordLayout
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
transform: Translate { y: flickable.keypadHeight - flickable.position }
|
|
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
spacing: PlasmaCore.Units.gridUnit
|
|
|
|
|
|
|
|
|
|
// scroll down icon
|
|
|
|
|
PlasmaCore.IconItem {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
implicitWidth: PlasmaCore.Units.iconSizes.smallMedium
|
|
|
|
|
implicitHeight: PlasmaCore.Units.iconSizes.smallMedium
|
|
|
|
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
|
|
|
|
source: "arrow-down"
|
|
|
|
|
opacity: Math.sin((Math.PI / 2) * flickable.openFactor + 1.5 * Math.PI) + 1
|
|
|
|
|
}
|
2014-08-19 15:50:59 +00:00
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
Keypad {
|
|
|
|
|
id: keypad
|
2022-02-17 05:52:34 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2022-02-12 05:19:44 +00:00
|
|
|
focus: true
|
|
|
|
|
swipeProgress: flickable.openFactor
|
2022-02-17 05:52:34 +00:00
|
|
|
onPasswordChanged: flickable.goToOpenPosition()
|
2021-10-16 15:31:42 +00:00
|
|
|
}
|
2019-10-31 06:20:36 +00:00
|
|
|
}
|
2014-08-28 13:21:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|