mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
brand new lockscreen
This commit is contained in:
parent
ad10cc0025
commit
8ea5c5ff21
17 changed files with 470 additions and 383 deletions
66
look-and-feel/contents/components/DialerButton.qml
Normal file
66
look-and-feel/contents/components/DialerButton.qml
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright 2016 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 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 org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
PlasmaComponents.Label {
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: units.gridUnit * 3
|
||||
property alias sub: longHold.text
|
||||
property var callback
|
||||
Layout.fillWidth: true
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (longHold.visible) {
|
||||
addNumber(longHold.text);
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: longHold
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
visible: text.length > 0
|
||||
opacity: 0.7
|
||||
|
||||
font.pixelSize: parent.pixelSize * .8
|
||||
}
|
||||
}
|
||||
38
look-and-feel/contents/components/DialerIconButton.qml
Normal file
38
look-and-feel/contents/components/DialerIconButton.qml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
width: units.iconSizes.smallMedium
|
||||
height: width
|
||||
property var callback
|
||||
property string text
|
||||
property string sub
|
||||
property alias source: icon.source
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (parent.sub.length > 0) {
|
||||
addNumber(parent.sub);
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
91
look-and-feel/contents/components/InfoPane.qml
Normal file
91
look-and-feel/contents/components/InfoPane.qml
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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.AlignRight
|
||||
|
||||
font.weight: Font.DemiBold
|
||||
fontSizeMode: Text.HorizontalFit
|
||||
font.pointSize: 36
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate);
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
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.AlignRight
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: pmSource
|
||||
engine: "powermanagement"
|
||||
connectedSources: ["Battery", "AC Adapter"]
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: timeSource
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 1000
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Rectangle {
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: "#FFEDDF00" }
|
||||
GradientStop { position: 3.0; color: "#00EDDF00" }
|
||||
}
|
||||
|
||||
opacity: 0.6
|
||||
height: Math.max(100, units.gridUnit * 2.5)
|
||||
width: parent.width
|
||||
y: parent.height / 2 - height / 2
|
||||
x: 0
|
||||
}
|
||||
BIN
look-and-feel/contents/components/artwork/background.png
Normal file
BIN
look-and-feel/contents/components/artwork/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
|
|
@ -1,11 +0,0 @@
|
|||
[kdeglobals][KDE]
|
||||
widgetStyle=breeze
|
||||
|
||||
[kdeglobals][General]
|
||||
ColorScheme=Breeze
|
||||
|
||||
[kdeglobals][Icons]
|
||||
Theme=breeze
|
||||
|
||||
[plasmarc][Theme]
|
||||
name=default
|
||||
54
look-and-feel/contents/lockscreen/Dialer.qml
Normal file
54
look-and-feel/contents/lockscreen/Dialer.qml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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,167 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Item {
|
||||
width: 360
|
||||
height: 600
|
||||
|
||||
Image {
|
||||
source: "images/backgroundLeaves.jpg"
|
||||
anchors.fill: parent
|
||||
}
|
||||
ParticleSystem {
|
||||
anchors.fill: parent
|
||||
Emitter {
|
||||
width: parent.width
|
||||
emitRate: 4
|
||||
lifeSpan: 14000
|
||||
size: 80
|
||||
velocity: PointDirection { y: 50 }
|
||||
}
|
||||
Wander {
|
||||
anchors.fill: parent
|
||||
anchors.bottomMargin: 100
|
||||
xVariance: 60
|
||||
pace: 60
|
||||
}
|
||||
|
||||
//! [0]
|
||||
Affector {
|
||||
property real coefficient: 2.0
|
||||
property real velocity: 1.5
|
||||
width: parent.width
|
||||
height: parent.height - 100
|
||||
onAffectParticles: {
|
||||
/* //Linear movement
|
||||
if (particle.r == 0) {
|
||||
particle.r = Math.random() > 0.5 ? -1 : 1;
|
||||
} else if (particle.r == 1) {
|
||||
particle.rotation += velocity * dt;
|
||||
if (particle.rotation >= maxAngle)
|
||||
particle.r = -1;
|
||||
} else if (particle.r == -1) {
|
||||
particle.rotation -= velocity * dt;
|
||||
if (particle.rotation <= -1 * maxAngle)
|
||||
particle.r = 1;
|
||||
}
|
||||
*/
|
||||
//Wobbly movement
|
||||
for (var i=0; i<particles.length; i++) {
|
||||
var particle = particles[i];
|
||||
if (particle.r == 0.0) {
|
||||
particle.r = Math.random() + 0.01;
|
||||
}
|
||||
particle.rotation += velocity * particle.r * dt;
|
||||
particle.r -= particle.rotation * coefficient;
|
||||
if (particle.r == 0.0)
|
||||
particle.r -= particle.rotation * 0.000001;
|
||||
particle.update = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
Affector {//Custom Friction, adds some 'randomness'
|
||||
x: -60
|
||||
width: parent.width + 120
|
||||
height: 100
|
||||
anchors.bottom: parent.bottom
|
||||
onAffectParticles: {
|
||||
for (var i=0; i<particles.length; i++) {
|
||||
var particle = particles[i];
|
||||
var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
|
||||
var yslow = dt * pseudoRand * 0.5 + 1;
|
||||
var xslow = dt * pseudoRand * 0.05 + 1;
|
||||
if (particle.vy < 1)
|
||||
particle.vy = 0;
|
||||
else
|
||||
particle.vy = (particle.vy / yslow);
|
||||
if (particle.vx < 1)
|
||||
particle.vx = 0;
|
||||
else
|
||||
particle.vx = (particle.vx / xslow);
|
||||
particle.update = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//! [1]
|
||||
|
||||
ImageParticle {
|
||||
anchors.fill: parent
|
||||
id: particles
|
||||
sprites: [Sprite {
|
||||
source: "images/realLeaf1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 1
|
||||
to: {"a":1, "b":1, "c":1, "d":1}
|
||||
}, Sprite {
|
||||
name: "a"
|
||||
source: "images/realLeaf1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "b"
|
||||
source: "images/realLeaf2.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "c"
|
||||
source: "images/realLeaf3.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "d"
|
||||
source: "images/realLeaf4.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
}
|
||||
]
|
||||
|
||||
z:4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
color: "#00000000"
|
||||
property int value: 0
|
||||
property alias elementId: glyph.elementId
|
||||
width: parent.width / 4
|
||||
height: parent.height
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
id: glyph
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: Math.min(parent.height, parent.width)
|
||||
height: parent.height
|
||||
|
||||
svg: symbolsSvg
|
||||
}
|
||||
}
|
||||
|
|
@ -1,188 +1,94 @@
|
|||
/********************************************************************
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2014 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 General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, 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 General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.private.sessions 2.0
|
||||
import "../components"
|
||||
|
||||
Leaves {
|
||||
id: lockscreen
|
||||
signal tryUnlock(string code)
|
||||
Image {
|
||||
id: root
|
||||
property bool viewVisible: false
|
||||
property bool debug: false
|
||||
property string notification
|
||||
property Item userSelect: null
|
||||
property int interfaceVersion: org_kde_plasma_screenlocker_greeter_interfaceVersion ? org_kde_plasma_screenlocker_greeter_interfaceVersion : 0
|
||||
signal clearPassword()
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: symbolsSvg
|
||||
imagePath: Qt.resolvedUrl("images/symbols.svgz")
|
||||
source: backgroundPath || "../components/artwork/background.png"
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
|
||||
onStatusChanged: {
|
||||
if (status == Image.Error) {
|
||||
source = "../components/artwork/background.png";
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
stripe.opacity = 1;
|
||||
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
|
||||
LayoutMirroring.childrenInherit: true
|
||||
|
||||
Connections {
|
||||
target: authenticator
|
||||
onFailed: {
|
||||
root.notification = i18nd("plasma_lookandfeel_org.kde.lookandfeel","Unlocking failed");
|
||||
}
|
||||
onGraceLockedChanged: {
|
||||
if (!authenticator.graceLocked) {
|
||||
root.notification = "";
|
||||
root.clearPassword();
|
||||
}
|
||||
}
|
||||
onMessage: {
|
||||
root.notification = msg;
|
||||
}
|
||||
onError: {
|
||||
root.notification = err;
|
||||
}
|
||||
}
|
||||
|
||||
SessionsModel {
|
||||
id: sessionsModel
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: dataSource
|
||||
engine: "time"
|
||||
connectedSources: "Local"
|
||||
interval: 30000
|
||||
id: keystateSource
|
||||
engine: "keystate"
|
||||
connectedSources: "Caps Lock"
|
||||
}
|
||||
|
||||
onDataChanged: {
|
||||
var date = new Date(data["Local"]["DateTime"]);
|
||||
hour.text = date.getHours();
|
||||
minute.text = date.getMinutes();
|
||||
}
|
||||
StackView {
|
||||
id: stackView
|
||||
anchors.fill: parent
|
||||
|
||||
Component.onCompleted: {
|
||||
onDataChanged();
|
||||
initialItem: Loader {
|
||||
active: root.viewVisible
|
||||
source: "MainBlock.qml"
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: hour
|
||||
|
||||
onTextChanged: {
|
||||
if (text.length < 2) {
|
||||
minute.text = "0" + text;
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: stripe.top
|
||||
}
|
||||
color: "white" // FIXME: base on wallpaper?
|
||||
text: "00"
|
||||
font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2)
|
||||
horizontalAlignment: Qt.AlignCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
SatelliteStripe {
|
||||
id: stripe
|
||||
opacity: 0
|
||||
|
||||
property string code
|
||||
|
||||
function lockKeyPressed(id) {
|
||||
hideTimer.stop();
|
||||
code += id;
|
||||
}
|
||||
|
||||
function lockKeyReleased(id) {
|
||||
hideTimer.start();
|
||||
code += id;
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 500
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
if (stripe.opacity < 1) {
|
||||
stripe.opacity = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
stripe.lockKeyPressed(stripe.childAt(mouseX, mouseY).value);
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
if (stripe.opacity < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
stripe.lockKeyReleased(stripe.childAt(mouseX, mouseY).value);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 1000
|
||||
running: parent.opacity == 1
|
||||
onTriggered: {
|
||||
stripe.opacity = 0;
|
||||
lockscreen.tryUnlock(stripe.code);
|
||||
stripe.code = '';
|
||||
}
|
||||
}
|
||||
|
||||
LockKey {
|
||||
id: square
|
||||
value: 1
|
||||
anchors.left: parent.left
|
||||
elementId: "square"
|
||||
}
|
||||
|
||||
LockKey {
|
||||
id: circle
|
||||
value: 2
|
||||
anchors.left: square.right
|
||||
|
||||
elementId: "circle"
|
||||
}
|
||||
|
||||
LockKey {
|
||||
id: ex
|
||||
value: 3
|
||||
anchors.left: circle.right
|
||||
|
||||
elementId: "ex"
|
||||
|
||||
}
|
||||
|
||||
LockKey {
|
||||
id: triangle
|
||||
value: 4
|
||||
anchors.left: ex.right
|
||||
|
||||
elementId: "triangle"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
id: minute
|
||||
|
||||
onTextChanged: {
|
||||
if (text.length < 2) {
|
||||
minute.text = "0" + text;
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
top: stripe.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
color: hour.color
|
||||
text: "00"
|
||||
font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2)
|
||||
horizontalAlignment: Qt.AlignCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
id: emergencyCall
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
horizontalAlignment: Qt.AlignCenter
|
||||
color: minute.color
|
||||
text: i18n("Emergency Call")
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: { print("FIXME: Launch the dialer service!") }
|
||||
Component.onCompleted: {
|
||||
// version support checks
|
||||
if (root.interfaceVersion < 1) {
|
||||
// ksmserver of 5.4, with greeter of 5.5
|
||||
root.viewVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
146
look-and-feel/contents/lockscreen/MainBlock.qml
Normal file
146
look-and-feel/contents/lockscreen/MainBlock.qml
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/********************************************************************
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2014 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 General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, 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 General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.1
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.workspace.keyboardlayout 1.0
|
||||
import "../components"
|
||||
|
||||
PlasmaCore.ColorScope {
|
||||
id: block
|
||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||
anchors.fill: parent
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
height: infoPane.height + units.largeSpacing * 2
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: PlasmaCore.ColorScope.backgroundColor
|
||||
opacity: 0.8
|
||||
}
|
||||
InfoPane {
|
||||
id: infoPane
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
height: mainLayout.height + units.largeSpacing * 2
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: PlasmaCore.ColorScope.backgroundColor
|
||||
opacity: 0.8
|
||||
}
|
||||
function unlockFunction() {
|
||||
authenticator.tryUnlock(passwordInput.text);
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
spacing: units.largeSpacing
|
||||
RowLayout {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
|
||||
PlasmaComponents.TextField {
|
||||
id: passwordInput
|
||||
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Password")
|
||||
echoMode: TextInput.Password
|
||||
enabled: !authenticator.graceLocked
|
||||
onAccepted: actionButton.clicked(null)
|
||||
focus: false
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
forceActiveFocus();
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
onTextChanged: {
|
||||
if (text == "") {
|
||||
clearTimer.stop();
|
||||
} else {
|
||||
clearTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: clearTimer
|
||||
interval: 30000
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
passwordInput.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DialerIconButton {
|
||||
source: "edit-clear"
|
||||
callback: function() {
|
||||
if (passwordInput.text.length > 0) {
|
||||
passwordInput.text = passwordInput.text.substr(0, passwordInput.text.length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
onClearPassword: {
|
||||
passwordInput.selectAll();
|
||||
passwordInput.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
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: {
|
||||
unlockFunction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 77 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
Loading…
Reference in a new issue