diff --git a/look-and-feel/contents/components/DialerButton.qml b/look-and-feel/contents/components/DialerButton.qml new file mode 100644 index 00000000..4f529cd7 --- /dev/null +++ b/look-and-feel/contents/components/DialerButton.qml @@ -0,0 +1,66 @@ +/* + * Copyright 2016 Marco Martin + * + * 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 + } +} diff --git a/look-and-feel/contents/components/DialerIconButton.qml b/look-and-feel/contents/components/DialerIconButton.qml new file mode 100644 index 00000000..86483711 --- /dev/null +++ b/look-and-feel/contents/components/DialerIconButton.qml @@ -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); + } + } + } +} diff --git a/look-and-feel/contents/components/InfoPane.qml b/look-and-feel/contents/components/InfoPane.qml new file mode 100644 index 00000000..2045fc5b --- /dev/null +++ b/look-and-feel/contents/components/InfoPane.qml @@ -0,0 +1,91 @@ +/* + * Copyright 2014 David Edmundson + * Copyright (C) 2014 by Aleix Pol Gonzalez + * + * 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 + } + +} diff --git a/look-and-feel/contents/components/SatelliteStripe.qml b/look-and-feel/contents/components/SatelliteStripe.qml deleted file mode 100644 index 03e1aa91..00000000 --- a/look-and-feel/contents/components/SatelliteStripe.qml +++ /dev/null @@ -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 -} diff --git a/look-and-feel/contents/components/artwork/background.png b/look-and-feel/contents/components/artwork/background.png new file mode 100644 index 00000000..6ba40403 Binary files /dev/null and b/look-and-feel/contents/components/artwork/background.png differ diff --git a/look-and-feel/contents/defaults b/look-and-feel/contents/defaults deleted file mode 100644 index f3192714..00000000 --- a/look-and-feel/contents/defaults +++ /dev/null @@ -1,11 +0,0 @@ -[kdeglobals][KDE] -widgetStyle=breeze - -[kdeglobals][General] -ColorScheme=Breeze - -[kdeglobals][Icons] -Theme=breeze - -[plasmarc][Theme] -name=default diff --git a/look-and-feel/contents/lockscreen/Dialer.qml b/look-and-feel/contents/lockscreen/Dialer.qml new file mode 100644 index 00000000..6e0df659 --- /dev/null +++ b/look-and-feel/contents/lockscreen/Dialer.qml @@ -0,0 +1,54 @@ +/* + * Copyright 2014 Aaron Seigo + * Copyright 2014 Marco Martin + * + * 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: "#" } +} + diff --git a/look-and-feel/contents/lockscreen/Leaves.qml b/look-and-feel/contents/lockscreen/Leaves.qml deleted file mode 100644 index a957b9f1..00000000 --- a/look-and-feel/contents/lockscreen/Leaves.qml +++ /dev/null @@ -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 + +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 . +*********************************************************************/ + 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; } } } diff --git a/look-and-feel/contents/lockscreen/MainBlock.qml b/look-and-feel/contents/lockscreen/MainBlock.qml new file mode 100644 index 00000000..8f7076ba --- /dev/null +++ b/look-and-feel/contents/lockscreen/MainBlock.qml @@ -0,0 +1,146 @@ +/******************************************************************** + This file is part of the KDE project. + +Copyright (C) 2014 Aleix Pol Gonzalez + +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 . +*********************************************************************/ + +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(); + } + } + } + } +} diff --git a/look-and-feel/contents/lockscreen/images/backgroundLeaves.jpg b/look-and-feel/contents/lockscreen/images/backgroundLeaves.jpg deleted file mode 100755 index 08be1675..00000000 Binary files a/look-and-feel/contents/lockscreen/images/backgroundLeaves.jpg and /dev/null differ diff --git a/look-and-feel/contents/lockscreen/images/realLeaf1.png b/look-and-feel/contents/lockscreen/images/realLeaf1.png deleted file mode 100644 index 6cabf29e..00000000 Binary files a/look-and-feel/contents/lockscreen/images/realLeaf1.png and /dev/null differ diff --git a/look-and-feel/contents/lockscreen/images/realLeaf2.png b/look-and-feel/contents/lockscreen/images/realLeaf2.png deleted file mode 100644 index bfeca861..00000000 Binary files a/look-and-feel/contents/lockscreen/images/realLeaf2.png and /dev/null differ diff --git a/look-and-feel/contents/lockscreen/images/realLeaf3.png b/look-and-feel/contents/lockscreen/images/realLeaf3.png deleted file mode 100644 index b1071e86..00000000 Binary files a/look-and-feel/contents/lockscreen/images/realLeaf3.png and /dev/null differ diff --git a/look-and-feel/contents/lockscreen/images/realLeaf4.png b/look-and-feel/contents/lockscreen/images/realLeaf4.png deleted file mode 100644 index d61d53d1..00000000 Binary files a/look-and-feel/contents/lockscreen/images/realLeaf4.png and /dev/null differ diff --git a/look-and-feel/contents/lockscreen/images/symbols.svgz b/look-and-feel/contents/lockscreen/images/symbols.svgz deleted file mode 100644 index b5edcc99..00000000 Binary files a/look-and-feel/contents/lockscreen/images/symbols.svgz and /dev/null differ