mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
New lockscreen design
This commit is contained in:
parent
c178478b3a
commit
dd215efb50
4 changed files with 153 additions and 224 deletions
31
look-and-feel/contents/lockscreen/Clock.qml
Normal file
31
look-and-feel/contents/lockscreen/Clock.qml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
import QtQuick 2.8
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Controls 2.5
|
||||||
|
import org.kde.plasma.core 2.0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: Qt.formatTime(timeSource.data["Local"]["DateTime"])
|
||||||
|
color: ColorScope.textColor
|
||||||
|
style: softwareRendering ? Text.Outline : Text.Normal
|
||||||
|
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
|
||||||
|
font.pointSize: 40
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate)
|
||||||
|
color: ColorScope.textColor
|
||||||
|
style: softwareRendering ? Text.Outline : Text.Normal
|
||||||
|
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
|
||||||
|
font.pointSize: 16
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
DataSource {
|
||||||
|
id: timeSource
|
||||||
|
engine: "time"
|
||||||
|
connectedSources: ["Local"]
|
||||||
|
interval: 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
|
||||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Library General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import QtQuick 2.0
|
|
||||||
import QtQuick.Layouts 1.1
|
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
||||||
import "../components"
|
|
||||||
|
|
||||||
|
|
||||||
GridLayout {
|
|
||||||
id: pad
|
|
||||||
columns: 3
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
function addNumber(number) {
|
|
||||||
passwordInput.text += number;
|
|
||||||
}
|
|
||||||
|
|
||||||
DialerButton { id: one; text: "1" }
|
|
||||||
DialerButton { text: "2" }
|
|
||||||
DialerButton { text: "3" }
|
|
||||||
|
|
||||||
DialerButton { text: "4" }
|
|
||||||
DialerButton { text: "5" }
|
|
||||||
DialerButton { text: "6" }
|
|
||||||
|
|
||||||
DialerButton { text: "7" }
|
|
||||||
DialerButton { text: "8" }
|
|
||||||
DialerButton { text: "9" }
|
|
||||||
|
|
||||||
DialerButton { text: "*"; }
|
|
||||||
DialerButton { text: "0"; sub: "+"; }
|
|
||||||
DialerButton { text: "#" }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2014 David Edmundson <davidedmundson@kde.org>
|
|
||||||
* Copyright (C) 2014 by Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import QtQuick 2.2
|
|
||||||
import QtQuick.Layouts 1.1
|
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
||||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
|
||||||
import org.kde.plasma.workspace.components 2.0 as PW
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
PlasmaComponents.Label { //should be a heading but we want it _loads_ bigger
|
|
||||||
text: Qt.formatTime(timeSource.data["Local"]["DateTime"])
|
|
||||||
//we fill the width then align the text so that we can make the text shrink to fit
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
|
|
||||||
font.weight: Font.DemiBold
|
|
||||||
fontSizeMode: Text.HorizontalFit
|
|
||||||
font.pointSize: 36
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate);
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
visible: pmSource.data["Battery"]["Has Cumulative"]
|
|
||||||
|
|
||||||
PW.BatteryIcon {
|
|
||||||
id: battery
|
|
||||||
hasBattery: true
|
|
||||||
percent: pmSource.data["Battery"]["Percent"]
|
|
||||||
pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false
|
|
||||||
|
|
||||||
height: batteryLabel.height
|
|
||||||
width: batteryLabel.height
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
id: batteryLabel
|
|
||||||
text: {
|
|
||||||
var state = pmSource.data["Battery"] ? pmSource.data["Battery"]["State"] : "";
|
|
||||||
switch(state) {
|
|
||||||
case "Charging":
|
|
||||||
return i18nd("plasma_lookandfeel_org.kde.lookandfeel","%1%. Charging", battery.percent)
|
|
||||||
case "FullyCharged":
|
|
||||||
return i18nd("plasma_lookandfeel_org.kde.lookandfeel","Fully charged")
|
|
||||||
default:
|
|
||||||
return i18nd("plasma_lookandfeel_org.kde.lookandfeel","%1% battery remaining", battery.percent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
|
||||||
id: pmSource
|
|
||||||
engine: "powermanagement"
|
|
||||||
connectedSources: ["Battery", "AC Adapter"]
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
|
||||||
id: timeSource
|
|
||||||
engine: "time"
|
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 1000
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
/********************************************************************
|
/*
|
||||||
This file is part of the KDE project.
|
Copyright (C) 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
||||||
|
|
||||||
Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -10,116 +8,161 @@ the Free Software Foundation; either version 2 of the License, or
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.13
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtGraphicalEffects 1.12
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.workspace.keyboardlayout 1.0
|
import org.kde.plasma.workspace.keyboardlayout 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
PlasmaCore.ColorScope {
|
PlasmaCore.ColorScope {
|
||||||
id: block
|
id: root
|
||||||
|
|
||||||
|
property string password
|
||||||
|
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Rectangle {
|
FastBlur {
|
||||||
anchors.top: parent.top
|
id: blur
|
||||||
anchors.left: parent.left
|
anchors.fill: parent
|
||||||
anchors.right: parent.right
|
source: wallpaper
|
||||||
|
radius: 32
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiPointTouchArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
onGestureStarted: {
|
||||||
|
numBlock.visible = true
|
||||||
|
blur.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DropShadow {
|
||||||
|
id: clockShadow
|
||||||
|
anchors.fill: clock
|
||||||
|
source: clock
|
||||||
|
horizontalOffset: 1
|
||||||
|
verticalOffset: 1
|
||||||
|
radius: 6
|
||||||
|
samples: 14
|
||||||
|
spread: 0.3
|
||||||
color: PlasmaCore.ColorScope.backgroundColor
|
color: PlasmaCore.ColorScope.backgroundColor
|
||||||
opacity: 0.8
|
Behavior on opacity {
|
||||||
height: infoPane.height + units.largeSpacing * 2
|
OpacityAnimator {
|
||||||
|
duration: 1000
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoPane {
|
Clock {
|
||||||
id: infoPane
|
id: clock
|
||||||
|
|
||||||
|
property Item shadow: clockShadow
|
||||||
|
|
||||||
|
anchors.leftMargin: units.gridUnit
|
||||||
|
anchors.rightMargin: units.gridUnit
|
||||||
|
anchors.topMargin: units.gridUnit * 3
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: units.largeSpacing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Row {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: numBlock.top
|
||||||
|
anchors.bottomMargin: units.gridUnit * 2
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: root.password.length
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: units.gridUnit * 2
|
||||||
|
height: width
|
||||||
|
radius: width
|
||||||
|
color: Qt.rgba(PlasmaCore.ColorScope.backgroundColor.r, PlasmaCore.ColorScope.backgroundColor.g, PlasmaCore.ColorScope.backgroundColor.b, 0.6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
id: numBlock
|
||||||
|
visible: false
|
||||||
|
property string thePw
|
||||||
|
|
||||||
|
height: units.gridUnit * 16
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: PlasmaCore.ColorScope.backgroundColor
|
anchors.bottomMargin: units.gridUnit
|
||||||
opacity: 0.8
|
anchors.leftMargin: units.gridUnit * 2
|
||||||
height: mainLayout.height + units.largeSpacing * 2
|
anchors.rightMargin: units.gridUnit *2
|
||||||
}
|
rowSpacing: units.gridUnit
|
||||||
|
|
||||||
ColumnLayout {
|
columns: 3
|
||||||
id: mainLayout
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: units.largeSpacing
|
|
||||||
}
|
|
||||||
spacing: units.largeSpacing
|
|
||||||
RowLayout {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
|
|
||||||
PlasmaComponents.TextField {
|
Repeater {
|
||||||
id: passwordInput
|
model: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "R", "0", "E"]
|
||||||
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Password")
|
delegate: Item {
|
||||||
echoMode: TextInput.Password
|
Layout.fillWidth: true
|
||||||
enabled: !authenticator.graceLocked
|
Layout.fillHeight: true
|
||||||
onAccepted: actionButton.clicked(null)
|
|
||||||
focus: false
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
Rectangle {
|
||||||
if (visible) {
|
anchors.centerIn: parent
|
||||||
forceActiveFocus();
|
width: units.gridUnit * 3
|
||||||
}
|
height: width
|
||||||
text = "";
|
radius: 12
|
||||||
}
|
color: Qt.rgba(PlasmaCore.ColorScope.backgroundColor.r, PlasmaCore.ColorScope.backgroundColor.g, PlasmaCore.ColorScope.backgroundColor.b, ma.pressed ? 0.8 : 0.3)
|
||||||
onTextChanged: {
|
visible: modelData.length > 0
|
||||||
if (text == "") {
|
|
||||||
clearTimer.stop();
|
MouseArea {
|
||||||
} else {
|
id: ma
|
||||||
clearTimer.restart();
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
if (modelData === "R") {
|
||||||
|
root.password = root.password.substr(0, root.password.length - 1);
|
||||||
|
} else if (modelData === "E") {
|
||||||
|
authenticator.tryUnlock(root.password);
|
||||||
|
} else {
|
||||||
|
root.password += modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
PlasmaComponents.Label {
|
||||||
id: clearTimer
|
visible: modelData !== "R" && modelData !== "E"
|
||||||
interval: 30000
|
text: modelData
|
||||||
repeat: false
|
anchors.centerIn: parent
|
||||||
onTriggered: {
|
font.pointSize: 20
|
||||||
passwordInput.text = "";
|
}
|
||||||
}
|
|
||||||
|
PlasmaCore.IconItem {
|
||||||
|
visible: modelData === "R"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
source: "edit-clear"
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.IconItem {
|
||||||
|
visible: modelData === "E"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
source: "go-next"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DialerIconButton {
|
|
||||||
source: "edit-clear"
|
|
||||||
callback: function() {
|
|
||||||
if (passwordInput.text.length > 0) {
|
|
||||||
passwordInput.text = passwordInput.text.substr(0, passwordInput.text.length - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Dialer {
|
|
||||||
id: dialer
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
id: actionButton
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
Layout.minimumWidth: passwordInput.width
|
|
||||||
text: i18n("Unlock")
|
|
||||||
enabled: !authenticator.graceLocked
|
|
||||||
onClicked: authenticator.tryUnlock(passwordInput.text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue