Initial commit
This commit is contained in:
		
							
								
								
									
										115
									
								
								components/ActionButton.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								components/ActionButton.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,115 @@ | ||||
| /* | ||||
|     SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org> | ||||
|  | ||||
|     SPDX-License-Identifier: LGPL-2.0-or-later | ||||
| */ | ||||
|  | ||||
| import QtQuick 2.8 | ||||
| import org.kde.plasma.core 2.0 as PlasmaCore | ||||
| import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||||
|  | ||||
| Item { | ||||
|     id: root | ||||
|     property alias text: label.text | ||||
|     property alias iconSource: icon.source | ||||
|     property alias containsMouse: mouseArea.containsMouse | ||||
|     property alias font: label.font | ||||
|     property alias labelRendering: label.renderType | ||||
|     property alias circleOpacity: iconCircle.opacity | ||||
|     property alias circleVisiblity: iconCircle.visible | ||||
|     property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 1 | ||||
|     readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software | ||||
|     signal clicked | ||||
|  | ||||
|     activeFocusOnTab: true | ||||
|  | ||||
|     property int iconSize: PlasmaCore.Units.gridUnit * 3 | ||||
|  | ||||
|     implicitWidth: Math.max(iconSize + PlasmaCore.Units.largeSpacing * 2, label.contentWidth) | ||||
|     implicitHeight: iconSize + PlasmaCore.Units.smallSpacing + label.implicitHeight | ||||
|  | ||||
|     opacity: activeFocus || containsMouse ? 1 : 0.85 | ||||
|     Behavior on opacity { | ||||
|         PropertyAnimation { // OpacityAnimator makes it turn black at random intervals | ||||
|             duration: PlasmaCore.Units.longDuration | ||||
|             easing.type: Easing.InOutQuad | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     Rectangle { | ||||
|         id: iconCircle | ||||
|         anchors.centerIn: icon | ||||
|         width: iconSize + PlasmaCore.Units.smallSpacing | ||||
|         height: width | ||||
|         radius: width / 2 | ||||
|         color: softwareRendering ?  PlasmaCore.ColorScope.backgroundColor : PlasmaCore.ColorScope.textColor | ||||
|         opacity: root.activeFocus || containsMouse ? (softwareRendering ? 0.8 : 0.15) : (softwareRendering ? 0.6 : 0) | ||||
|         Behavior on opacity { | ||||
|             PropertyAnimation { // OpacityAnimator makes it turn black at random intervals | ||||
|                 duration: PlasmaCore.Units.longDuration | ||||
|                 easing.type: Easing.InOutQuad | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     Rectangle { | ||||
|         anchors.centerIn: iconCircle | ||||
|         width: iconCircle.width | ||||
|         height: width | ||||
|         radius: width / 2 | ||||
|         scale: mouseArea.containsPress ? 1 : 0 | ||||
|         color: PlasmaCore.ColorScope.textColor | ||||
|         opacity: 0.15 | ||||
|         Behavior on scale { | ||||
|             PropertyAnimation { | ||||
|                 duration: PlasmaCore.Units.shortDuration | ||||
|                 easing.type: Easing.InOutQuart | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     PlasmaCore.IconItem { | ||||
|         id: icon | ||||
|         anchors { | ||||
|             top: parent.top | ||||
|             horizontalCenter: parent.horizontalCenter | ||||
|         } | ||||
|         width: iconSize | ||||
|         height: iconSize | ||||
|  | ||||
|         colorGroup: PlasmaCore.ColorScope.colorGroup | ||||
|         active: mouseArea.containsMouse || root.activeFocus | ||||
|     } | ||||
|  | ||||
|     PlasmaComponents3.Label { | ||||
|         id: label | ||||
|         font.pointSize: root.fontSize | ||||
|         anchors { | ||||
|             top: icon.bottom | ||||
|             topMargin: (softwareRendering ? 1.5 : 1) * PlasmaCore.Units.smallSpacing | ||||
|             left: parent.left | ||||
|             right: parent.right | ||||
|         } | ||||
|         style: softwareRendering ? Text.Outline : Text.Normal | ||||
|         styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter | ||||
|         horizontalAlignment: Text.AlignHCenter | ||||
|         verticalAlignment: Text.AlignTop | ||||
|         wrapMode: Text.WordWrap | ||||
|         font.underline: root.activeFocus | ||||
|     } | ||||
|  | ||||
|     MouseArea { | ||||
|         id: mouseArea | ||||
|         hoverEnabled: true | ||||
|         onClicked: root.clicked() | ||||
|         anchors.fill: parent | ||||
|     } | ||||
|  | ||||
|     Keys.onEnterPressed: clicked() | ||||
|     Keys.onReturnPressed: clicked() | ||||
|     Keys.onSpacePressed: clicked() | ||||
|  | ||||
|     Accessible.onPressAction: clicked() | ||||
|     Accessible.role: Accessible.Button | ||||
|     Accessible.name: label.text | ||||
| } | ||||
							
								
								
									
										43
									
								
								components/Battery.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								components/Battery.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| /* | ||||
|     SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
|  | ||||
|     SPDX-License-Identifier: LGPL-2.0-or-later | ||||
| */ | ||||
|  | ||||
| import QtQuick 2.2 | ||||
|  | ||||
| import org.kde.plasma.core 2.0 as PlasmaCore | ||||
| import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||||
| import org.kde.plasma.workspace.components 2.0 as PW | ||||
|  | ||||
| Row { | ||||
|     id: row | ||||
|  | ||||
|     property int fontSize: PlasmaCore.Theme.defaultFont.pointSize | ||||
|  | ||||
|     spacing: PlasmaCore.Units.smallSpacing | ||||
|     visible: pmSource.data["Battery"]["Has Cumulative"] | ||||
|  | ||||
|     PlasmaCore.DataSource { | ||||
|         id: pmSource | ||||
|         engine: "powermanagement" | ||||
|         connectedSources: ["Battery", "AC Adapter"] | ||||
|     } | ||||
|  | ||||
|     PW.BatteryIcon { | ||||
|         id: battery | ||||
|         hasBattery: pmSource.data["Battery"]["Has Battery"] || false | ||||
|         percent: pmSource.data["Battery"]["Percent"] || 0 | ||||
|         pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false | ||||
|  | ||||
|         height: batteryLabel.height | ||||
|         width: height | ||||
|     } | ||||
|  | ||||
|     PlasmaComponents3.Label { | ||||
|         id: batteryLabel | ||||
|         font.pointSize: row.fontSize | ||||
|         text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","%1%", battery.percent) | ||||
|         Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Battery at %1%", battery.percent) | ||||
|     } | ||||
| } | ||||
							
								
								
									
										109
									
								
								components/SessionManagementScreen.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								components/SessionManagementScreen.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| /* | ||||
|     SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org> | ||||
|  | ||||
|     SPDX-License-Identifier: LGPL-2.0-or-later | ||||
| */ | ||||
|  | ||||
| import QtQuick 2.2 | ||||
|  | ||||
| import QtQuick.Layouts 1.1 | ||||
| import QtQuick.Controls 1.1 | ||||
|  | ||||
| import org.kde.plasma.core 2.0 as PlasmaCore | ||||
| import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||||
|  | ||||
| FocusScope { | ||||
|     id: root | ||||
|  | ||||
|     /* | ||||
|      * Any message to be displayed to the user, visible above the text fields | ||||
|      */ | ||||
|     property alias notificationMessage: notificationsLabel.text | ||||
|  | ||||
|     /* | ||||
|      * A list of Items (typically ActionButtons) to be shown in a Row beneath the prompts | ||||
|      */ | ||||
|     property alias actionItems: actionItemsLayout.children | ||||
|  | ||||
|     /* | ||||
|      * A model with a list of users to show in the view | ||||
|      * The following roles should exist: | ||||
|      *  - name | ||||
|      *  - iconSource | ||||
|      * | ||||
|      * The following are also handled: | ||||
|      *  - vtNumber | ||||
|      *  - displayNumber | ||||
|      *  - session | ||||
|      *  - isTty | ||||
|      */ | ||||
|     property alias userListModel: userListView.model | ||||
|  | ||||
|     /* | ||||
|      * Self explanatory | ||||
|      */ | ||||
|     property alias userListCurrentIndex: userListView.currentIndex | ||||
|     property alias userListCurrentItem: userListView.currentItem | ||||
|     property bool showUserList: true | ||||
|  | ||||
|     property alias userList: userListView | ||||
|  | ||||
|     property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 2 | ||||
|  | ||||
|     default property alias _children: innerLayout.children | ||||
|  | ||||
|     UserList { | ||||
|         id: userListView | ||||
|         visible: showUserList && y > 0 | ||||
|         anchors { | ||||
|             bottom: parent.verticalCenter | ||||
|             left: parent.left | ||||
|             right: parent.right | ||||
|         } | ||||
|         fontSize: root.fontSize | ||||
|     } | ||||
|  | ||||
|     //goal is to show the prompts, in ~16 grid units high, then the action buttons | ||||
|     //but collapse the space between the prompts and actions if there's no room | ||||
|     //ui is constrained to 16 grid units wide, or the screen | ||||
|     ColumnLayout { | ||||
|         id: prompts | ||||
|         anchors.top: parent.verticalCenter | ||||
|         anchors.topMargin: PlasmaCore.Units.gridUnit * 0.5 | ||||
|         anchors.left: parent.left | ||||
|         anchors.right: parent.right | ||||
|         anchors.bottom: parent.bottom | ||||
|         PlasmaComponents3.Label { | ||||
|             id: notificationsLabel | ||||
|             font.pointSize: root.fontSize | ||||
|             Layout.maximumWidth: PlasmaCore.Units.gridUnit * 16 | ||||
|             Layout.alignment: Qt.AlignHCenter | ||||
|             Layout.fillWidth: true | ||||
|             horizontalAlignment: Text.AlignHCenter | ||||
|             wrapMode: Text.WordWrap | ||||
|             font.italic: true | ||||
|         } | ||||
|         ColumnLayout { | ||||
|             Layout.minimumHeight: implicitHeight | ||||
|             Layout.maximumHeight: PlasmaCore.Units.gridUnit * 10 | ||||
|             Layout.maximumWidth: PlasmaCore.Units.gridUnit * 16 | ||||
|             Layout.alignment: Qt.AlignHCenter | ||||
|             ColumnLayout { | ||||
|                 id: innerLayout | ||||
|                 Layout.alignment: Qt.AlignHCenter | ||||
|                 Layout.fillWidth: true | ||||
|             } | ||||
|             Item { | ||||
|                 Layout.fillHeight: true | ||||
|             } | ||||
|         } | ||||
|         Row { //deliberately not rowlayout as I'm not trying to resize child items | ||||
|             id: actionItemsLayout | ||||
|             spacing: PlasmaCore.Units.largeSpacing / 2 | ||||
|             Layout.alignment: Qt.AlignHCenter | Qt.AlignTop | ||||
|         } | ||||
|         Item { | ||||
|             Layout.fillHeight: true | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										180
									
								
								components/UserDelegate.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										180
									
								
								components/UserDelegate.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,180 @@ | ||||
| /* | ||||
|     SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org> | ||||
|     SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> | ||||
|  | ||||
|     SPDX-License-Identifier: LGPL-2.0-or-later | ||||
| */ | ||||
|  | ||||
| import QtQuick 2.8 | ||||
| import QtQuick.Window 2.15 | ||||
| import org.kde.plasma.core 2.0 as PlasmaCore | ||||
| import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||||
|  | ||||
| Item { | ||||
|     id: wrapper | ||||
|  | ||||
|     // If we're using software rendering, draw outlines instead of shadows | ||||
|     // See https://bugs.kde.org/show_bug.cgi?id=398317 | ||||
|     readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software | ||||
|  | ||||
|     property bool isCurrent: true | ||||
|  | ||||
|     property string name | ||||
|     property string userName | ||||
|     property string avatarPath | ||||
|     property string iconSource | ||||
|     property bool needsPassword | ||||
|     property var vtNumber | ||||
|     property bool constrainText: true | ||||
|     property alias nameFontSize: usernameDelegate.font.pointSize | ||||
|     property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 2 | ||||
|     signal clicked() | ||||
|  | ||||
|     property real faceSize: PlasmaCore.Units.gridUnit * 7 | ||||
|  | ||||
|     opacity: isCurrent ? 1.0 : 0.5 | ||||
|  | ||||
|     Behavior on opacity { | ||||
|         OpacityAnimator { | ||||
|             duration: PlasmaCore.Units.longDuration | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Draw a translucent background circle under the user picture | ||||
|     Rectangle { | ||||
|         anchors.centerIn: imageSource | ||||
|         width: imageSource.width - 2 // Subtract to prevent fringing | ||||
|         height: width | ||||
|         radius: width / 2 | ||||
|  | ||||
|         color: PlasmaCore.ColorScope.backgroundColor | ||||
|         opacity: 0.6 | ||||
|     } | ||||
|  | ||||
|     Item { | ||||
|         id: imageSource | ||||
|         anchors { | ||||
|             bottom: usernameDelegate.top | ||||
|             bottomMargin: PlasmaCore.Units.largeSpacing | ||||
|             horizontalCenter: parent.horizontalCenter | ||||
|         } | ||||
|         Behavior on width {  | ||||
|             PropertyAnimation { | ||||
|                 from: faceSize | ||||
|                 duration: PlasmaCore.Units.longDuration; | ||||
|             } | ||||
|         } | ||||
|         width: isCurrent ? faceSize : faceSize - PlasmaCore.Units.largeSpacing | ||||
|         height: width | ||||
|  | ||||
|         //Image takes priority, taking a full path to a file, if that doesn't exist we show an icon | ||||
|         Image { | ||||
|             id: face | ||||
|             source: wrapper.avatarPath | ||||
|             sourceSize: Qt.size(faceSize * Screen.devicePixelRatio, faceSize * Screen.devicePixelRatio) | ||||
|             fillMode: Image.PreserveAspectCrop | ||||
|             anchors.fill: parent | ||||
|         } | ||||
|  | ||||
|         PlasmaCore.IconItem { | ||||
|             id: faceIcon | ||||
|             source: iconSource | ||||
|             visible: (face.status == Image.Error || face.status == Image.Null) | ||||
|             anchors.fill: parent | ||||
|             anchors.margins: PlasmaCore.Units.gridUnit * 0.5 // because mockup says so... | ||||
|             colorGroup: PlasmaCore.ColorScope.colorGroup | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     ShaderEffect { | ||||
|         anchors { | ||||
|             bottom: usernameDelegate.top | ||||
|             bottomMargin: PlasmaCore.Units.largeSpacing | ||||
|             horizontalCenter: parent.horizontalCenter | ||||
|         } | ||||
|  | ||||
|         width: imageSource.width | ||||
|         height: imageSource.height | ||||
|  | ||||
|         supportsAtlasTextures: true | ||||
|  | ||||
|         property var source: ShaderEffectSource { | ||||
|             sourceItem: imageSource | ||||
|             // software rendering is just a fallback so we can accept not having a rounded avatar here | ||||
|             hideSource: wrapper.GraphicsInfo.api !== GraphicsInfo.Software | ||||
|             live: true // otherwise the user in focus will show a blurred avatar | ||||
|         } | ||||
|  | ||||
|         property var colorBorder: PlasmaCore.ColorScope.textColor | ||||
|  | ||||
|         //draw a circle with an antialiased border | ||||
|         //innerRadius = size of the inner circle with contents | ||||
|         //outerRadius = size of the border | ||||
|         //blend = area to blend between two colours | ||||
|         //all sizes are normalised so 0.5 == half the width of the texture | ||||
|  | ||||
|         //if copying into another project don't forget to connect themeChanged to update() | ||||
|         //but in SDDM that's a bit pointless | ||||
|         fragmentShader: " | ||||
|                         varying highp vec2 qt_TexCoord0; | ||||
|                         uniform highp float qt_Opacity; | ||||
|                         uniform lowp sampler2D source; | ||||
|  | ||||
|                         uniform lowp vec4 colorBorder; | ||||
|                         highp float blend = 0.01; | ||||
|                         highp float innerRadius = 0.47; | ||||
|                         highp float outerRadius = 0.49; | ||||
|                         lowp vec4 colorEmpty = vec4(0.0, 0.0, 0.0, 0.0); | ||||
|  | ||||
|                         void main() { | ||||
|                             lowp vec4 colorSource = texture2D(source, qt_TexCoord0.st); | ||||
|  | ||||
|                             highp vec2 m = qt_TexCoord0 - vec2(0.5, 0.5); | ||||
|                             highp float dist = sqrt(m.x * m.x + m.y * m.y); | ||||
|  | ||||
|                             if (dist < innerRadius) | ||||
|                                 gl_FragColor = colorSource; | ||||
|                             else if (dist < innerRadius + blend) | ||||
|                                 gl_FragColor = mix(colorSource, colorBorder, ((dist - innerRadius) / blend)); | ||||
|                             else if (dist < outerRadius) | ||||
|                                 gl_FragColor = colorBorder; | ||||
|                             else if (dist < outerRadius + blend) | ||||
|                                 gl_FragColor = mix(colorBorder, colorEmpty, ((dist - outerRadius) / blend)); | ||||
|                             else | ||||
|                                 gl_FragColor = colorEmpty ; | ||||
|  | ||||
|                             gl_FragColor = gl_FragColor * qt_Opacity; | ||||
|                     } | ||||
|         " | ||||
|     } | ||||
|  | ||||
|     PlasmaComponents3.Label { | ||||
|         id: usernameDelegate | ||||
|  | ||||
|         // Make it bigger than other fonts to match the scale of the avatar better | ||||
|         font.pointSize: wrapper.fontSize + 4 | ||||
|         anchors { | ||||
|             bottom: parent.bottom | ||||
|             horizontalCenter: parent.horizontalCenter | ||||
|         } | ||||
|         width: constrainText ? parent.width : implicitWidth | ||||
|         text: wrapper.name | ||||
|         style: softwareRendering ? Text.Outline : Text.Normal | ||||
|         styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter | ||||
|         elide: Text.ElideRight | ||||
|         horizontalAlignment: Text.AlignHCenter | ||||
|         //make an indication that this has active focus, this only happens when reached with keyboard navigation | ||||
|         font.underline: wrapper.activeFocus | ||||
|     } | ||||
|  | ||||
|     MouseArea { | ||||
|         anchors.fill: parent | ||||
|         hoverEnabled: true | ||||
|  | ||||
|         onClicked: wrapper.clicked(); | ||||
|     } | ||||
|  | ||||
|     Accessible.name: name | ||||
|     Accessible.role: Accessible.Button | ||||
|     function accessiblePressAction() { wrapper.clicked() } | ||||
| } | ||||
							
								
								
									
										88
									
								
								components/UserList.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								components/UserList.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| /* | ||||
|     SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org> | ||||
|  | ||||
|     SPDX-License-Identifier: LGPL-2.0-or-later | ||||
| */ | ||||
|  | ||||
| import QtQuick 2.2 | ||||
| import org.kde.plasma.core 2.0 as PlasmaCore | ||||
|  | ||||
| ListView { | ||||
|     id: view | ||||
|     readonly property string selectedUser: currentItem ? currentItem.userName : "" | ||||
|     readonly property int userItemWidth: PlasmaCore.Units.gridUnit * 8 | ||||
|     readonly property int userItemHeight: PlasmaCore.Units.gridUnit * 8 | ||||
|     property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 2 | ||||
|  | ||||
|     implicitHeight: userItemHeight | ||||
|  | ||||
|     activeFocusOnTab : true | ||||
|  | ||||
|     /* | ||||
|      * Signals that a user was explicitly selected | ||||
|      */ | ||||
|     signal userSelected; | ||||
|  | ||||
|     orientation: ListView.Horizontal | ||||
|     highlightRangeMode: ListView.StrictlyEnforceRange | ||||
|  | ||||
|     //centre align selected item (which implicitly centre aligns the rest | ||||
|     preferredHighlightBegin: width/2 - userItemWidth/2 | ||||
|     preferredHighlightEnd: preferredHighlightBegin | ||||
|  | ||||
|     // Disable flicking if we only have on user (like on the lockscreen) | ||||
|     interactive: count > 1 | ||||
|  | ||||
|     delegate: UserDelegate { | ||||
|         avatarPath: model.icon || "" | ||||
|         iconSource: model.iconName || "user-identity" | ||||
|         fontSize: view.fontSize | ||||
|         vtNumber: model.vtNumber | ||||
|         needsPassword: model.needsPassword | ||||
|  | ||||
|         name: { | ||||
|             var displayName = model.realName || model.name | ||||
|  | ||||
|             if (model.vtNumber === undefined || model.vtNumber < 0) { | ||||
|                 return displayName | ||||
|             } | ||||
|  | ||||
|             if (!model.session) { | ||||
|                 return i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Nobody logged in on that session", "Unused") | ||||
|             } | ||||
|  | ||||
|  | ||||
|             var location = "" | ||||
|             if (model.isTty) { | ||||
|                 location = i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "User logged in on console number", "TTY %1", model.vtNumber) | ||||
|             } else if (model.displayNumber) { | ||||
|                 location = i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "User logged in on console (X display number)", "on TTY %1 (Display %2)", model.vtNumber, model.displayNumber) | ||||
|             } | ||||
|  | ||||
|             if (location) { | ||||
|                 return i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Username (location)", "%1 (%2)", displayName, location) | ||||
|             } | ||||
|  | ||||
|             return displayName | ||||
|         } | ||||
|  | ||||
|         userName: model.name | ||||
|  | ||||
|         width: userItemWidth | ||||
|         height: userItemHeight | ||||
|  | ||||
|         //if we only have one delegate, we don't need to clip the text as it won't be overlapping with anything | ||||
|         constrainText: ListView.view.count > 1 | ||||
|  | ||||
|         isCurrent: ListView.isCurrentItem | ||||
|  | ||||
|         onClicked: { | ||||
|             ListView.view.currentIndex = index; | ||||
|             ListView.view.userSelected(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     Keys.onEscapePressed: view.userSelected() | ||||
|     Keys.onEnterPressed: view.userSelected() | ||||
|     Keys.onReturnPressed: view.userSelected() | ||||
| } | ||||
							
								
								
									
										70
									
								
								components/VirtualKeyboard.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								components/VirtualKeyboard.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| /* | ||||
|     SPDX-FileCopyrightText: 2017 Martin Gräßlin <mgraesslin@kde.org> | ||||
|  | ||||
|     SPDX-License-Identifier: GPL-2.0-or-later | ||||
| */ | ||||
|  | ||||
| import QtQuick 2.5 | ||||
| import QtQuick.VirtualKeyboard 2.1 | ||||
| import org.kde.plasma.core 2.0 as PlasmaCore | ||||
|  | ||||
| InputPanel { | ||||
|     id: inputPanel | ||||
|     property bool activated: false | ||||
|     active: activated && Qt.inputMethod.visible | ||||
|     width: parent.width | ||||
|  | ||||
|     states: [ | ||||
|         State { | ||||
|             name: "visible" | ||||
|             when: inputPanel.active | ||||
|             PropertyChanges { | ||||
|                 target: inputPanel | ||||
|                 y: inputPanel.parent.height - inputPanel.height | ||||
|                 opacity: 1 | ||||
|                 visible: true | ||||
|             } | ||||
|         }, | ||||
|         State { | ||||
|             name: "hidden" | ||||
|             when: !inputPanel.active | ||||
|             PropertyChanges { | ||||
|                 target: inputPanel | ||||
|                 y: inputPanel.parent.height | ||||
|                 opacity: 0 | ||||
|                 visible:false | ||||
|             } | ||||
|         } | ||||
|     ] | ||||
|  | ||||
|     transitions: [ | ||||
|         Transition { | ||||
|             to: "visible" | ||||
|             ParallelAnimation { | ||||
|                 YAnimator { | ||||
|                     // NOTE this is necessary as otherwise the keyboard always starts the transition with Y as 0, due to the internal reparenting happening when becomes active | ||||
|                     from: inputPanel.parent.height | ||||
|                     duration: PlasmaCore.Units.longDuration | ||||
|                     easing.type: Easing.OutQuad | ||||
|                 } | ||||
|                 OpacityAnimator { | ||||
|                     duration: PlasmaCore.Units.longDuration | ||||
|                     easing.type: Easing.OutQuad | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         Transition { | ||||
|             to: "hidden" | ||||
|             ParallelAnimation { | ||||
|                 YAnimator { | ||||
|                     duration: PlasmaCore.Units.longDuration | ||||
|                     easing.type: Easing.InQuad | ||||
|                 } | ||||
|                 OpacityAnimator { | ||||
|                     duration: PlasmaCore.Units.longDuration | ||||
|                     easing.type: Easing.InQuad | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     ] | ||||
| } | ||||
							
								
								
									
										161
									
								
								components/WallpaperFader.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								components/WallpaperFader.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,161 @@ | ||||
| /******************************************************************** | ||||
|  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.6 | ||||
| import QtQuick.Controls 1.1 | ||||
| import QtQuick.Layouts 1.1 | ||||
| import QtGraphicalEffects 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: wallpaperFader | ||||
|     property Item mainStack | ||||
|     property Item footer | ||||
|     property alias source: wallpaperBlur.source | ||||
|     state: lockScreenRoot.uiVisible ? "on" : "off" | ||||
|     property real factor: 20 | ||||
|  | ||||
|     Behavior on factor { | ||||
|         NumberAnimation { | ||||
|             target: wallpaperFader | ||||
|             property: "factor" | ||||
|             duration: 1000 | ||||
|             easing.type: Easing.InOutQuad | ||||
|         } | ||||
|     } | ||||
|     FastBlur { | ||||
|         id: wallpaperBlur | ||||
|         anchors.fill: parent | ||||
|         radius: 50 * wallpaperFader.factor | ||||
|     } | ||||
|     ShaderEffect { | ||||
|         id: wallpaperShader | ||||
|         anchors.fill: parent | ||||
|         supportsAtlasTextures: true | ||||
|         property var source: ShaderEffectSource { | ||||
|             sourceItem: wallpaperBlur | ||||
|             live: true | ||||
|             hideSource: true | ||||
|             textureMirroring: ShaderEffectSource.NoMirroring | ||||
|         } | ||||
|  | ||||
|         readonly property real contrast: 0.45 * wallpaperFader.factor + (1 - wallpaperFader.factor) | ||||
|         readonly property real saturation: 1.7 * wallpaperFader.factor + (1 - wallpaperFader.factor) | ||||
|         readonly property real intensity: wallpaperFader.factor + (1 - wallpaperFader.factor) | ||||
|  | ||||
|         property var colorMatrix: Qt.matrix4x4( | ||||
|             contrast, 0,        0,        0.0, | ||||
|             0,        contrast, 0,        0.0, | ||||
|             0,        0,        contrast, 0.0, | ||||
|             0,        0,        0,        1.0).times(Qt.matrix4x4( | ||||
|                 saturation, 0.0,          0.0,        0.0, | ||||
|                 0,          saturation,   0,          0.0, | ||||
|                 0,          0,            saturation, 0.0, | ||||
|                 0,          0,            0,          1.0)).times(Qt.matrix4x4( | ||||
|                     intensity, 0,         0,         0, | ||||
|                     0,         intensity, 0,         0, | ||||
|                     0,         0,         intensity, 0, | ||||
|                     0,         0,         0,         1 | ||||
|                 )); | ||||
|      | ||||
|  | ||||
|         fragmentShader: " | ||||
|             uniform mediump mat4 colorMatrix; | ||||
|             uniform mediump sampler2D source; | ||||
|             varying mediump vec2 qt_TexCoord0; | ||||
|             uniform lowp float qt_Opacity; | ||||
|  | ||||
|             void main(void) | ||||
|             { | ||||
|                 mediump vec4 tex = texture2D(source, qt_TexCoord0); | ||||
|                 gl_FragColor = tex * colorMatrix * qt_Opacity; | ||||
|             }" | ||||
|     } | ||||
|  | ||||
|     states: [ | ||||
|         State { | ||||
|             name: "on" | ||||
|             PropertyChanges { | ||||
|                 target: mainStack | ||||
|                 opacity: 1 | ||||
|             } | ||||
|             PropertyChanges { | ||||
|                 target: footer | ||||
|                 opacity: 1 | ||||
|             } | ||||
|             PropertyChanges { | ||||
|                 target: wallpaperFader | ||||
|                 factor: 1 | ||||
|             } | ||||
|         }, | ||||
|         State { | ||||
|             name: "off" | ||||
|             PropertyChanges { | ||||
|                 target: mainStack | ||||
|                 opacity: 0 | ||||
|             } | ||||
|             PropertyChanges { | ||||
|                 target: footer | ||||
|                 opacity: 0 | ||||
|             } | ||||
|             PropertyChanges { | ||||
|                 target: wallpaperFader | ||||
|                 factor: 0 | ||||
|             } | ||||
|         } | ||||
|     ] | ||||
|     transitions: [ | ||||
|         Transition { | ||||
|             from: "off" | ||||
|             to: "on" | ||||
|             //Note: can't use animators as they don't play well with parallelanimations | ||||
|             ParallelAnimation { | ||||
|                 NumberAnimation { | ||||
|                     target: mainStack | ||||
|                     property: "opacity" | ||||
|                     duration: units.longDuration | ||||
|                     easing.type: Easing.InOutQuad | ||||
|                 } | ||||
|                 NumberAnimation { | ||||
|                     target: footer | ||||
|                     property: "opacity" | ||||
|                     duration: units.longDuration | ||||
|                     easing.type: Easing.InOutQuad | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         Transition { | ||||
|             from: "on" | ||||
|             to: "off" | ||||
|             ParallelAnimation { | ||||
|                 NumberAnimation { | ||||
|                     target: mainStack | ||||
|                     property: "opacity" | ||||
|                     duration: 500 | ||||
|                     easing.type: Easing.InOutQuad | ||||
|                 } | ||||
|                 NumberAnimation { | ||||
|                     target: footer | ||||
|                     property: "opacity" | ||||
|                     duration: 500 | ||||
|                     easing.type: Easing.InOutQuad | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     ] | ||||
| } | ||||
							
								
								
									
										117
									
								
								components/resources/reboot.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								components/resources/reboot.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,117 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||
| <svg | ||||
|    xmlns:dc="http://purl.org/dc/elements/1.1/" | ||||
|    xmlns:cc="http://creativecommons.org/ns#" | ||||
|    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||||
|    xmlns:svg="http://www.w3.org/2000/svg" | ||||
|    xmlns="http://www.w3.org/2000/svg" | ||||
|    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||||
|    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||||
|    width="16" | ||||
|    viewBox="0 0 16 16" | ||||
|    height="16" | ||||
|    id="svg4310" | ||||
|    version="1.1" | ||||
|    inkscape:version="0.91 r13725" | ||||
|    sodipodi:docname="reboot.svg"> | ||||
|   <metadata | ||||
|      id="metadata4322"> | ||||
|     <rdf:RDF> | ||||
|       <cc:Work | ||||
|          rdf:about=""> | ||||
|         <dc:format>image/svg+xml</dc:format> | ||||
|         <dc:type | ||||
|            rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||||
|         <dc:title></dc:title> | ||||
|       </cc:Work> | ||||
|     </rdf:RDF> | ||||
|   </metadata> | ||||
|   <sodipodi:namedview | ||||
|      pagecolor="#ffffff" | ||||
|      bordercolor="#666666" | ||||
|      borderopacity="1" | ||||
|      objecttolerance="10" | ||||
|      gridtolerance="10" | ||||
|      guidetolerance="10" | ||||
|      inkscape:pageopacity="0" | ||||
|      inkscape:pageshadow="2" | ||||
|      inkscape:window-width="1600" | ||||
|      inkscape:window-height="882" | ||||
|      id="namedview4320" | ||||
|      showgrid="false" | ||||
|      inkscape:zoom="32" | ||||
|      inkscape:cx="13.934533" | ||||
|      inkscape:cy="6.236298" | ||||
|      inkscape:window-x="0" | ||||
|      inkscape:window-y="18" | ||||
|      inkscape:window-maximized="0" | ||||
|      inkscape:current-layer="svg4310" | ||||
|      fit-margin-top="0" | ||||
|      fit-margin-left="0" | ||||
|      fit-margin-right="0" | ||||
|      fit-margin-bottom="0" /> | ||||
|   <defs | ||||
|      id="defs4312" /> | ||||
|   <g | ||||
|      id="g4763"> | ||||
|     <g | ||||
|        id="g4734"> | ||||
|       <path | ||||
|          inkscape:connector-curvature="0" | ||||
|          id="path4316" | ||||
|          d="M 5.5333883,0.50031154 C 2.3637866,1.5487935 0.08838834,4.561747 0.08838834,8.0490615 c 0,4.3456995 3.54457456,7.9509375 7.91999996,7.9509375 1.9927677,-0.0156 1.9799356,-1.959831 0,-1.949062 -3.2764839,0 -5.94,-2.668512 -5.94,-6.0018755 0,-2.4345676 1.4293399,-4.5021282 3.465,-5.445 z" | ||||
|          style="color:#000000;line-height:normal;fill:#dc322f;fill-opacity:1" | ||||
|          sodipodi:nodetypes="csccscc" /> | ||||
|       <rect | ||||
|          style="fill:#dc322f;fill-opacity:1" | ||||
|          id="rect4318" | ||||
|          transform="scale(-1,1)" | ||||
|          height="2.872442" | ||||
|          ry="0" | ||||
|          rx="0.99000001" | ||||
|          y="13.024178" | ||||
|          x="-8.0297537" | ||||
|          width="1.98" /> | ||||
|       <rect | ||||
|          style="fill:#dc322f;fill-opacity:1" | ||||
|          id="rect4318-3" | ||||
|          transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)" | ||||
|          height="3.809942" | ||||
|          ry="0" | ||||
|          rx="0.99000001" | ||||
|          y="13.739765" | ||||
|          x="3.6503892" | ||||
|          width="1.98" /> | ||||
|     </g> | ||||
|     <g | ||||
|        id="g4734-3" | ||||
|        transform="matrix(-1,0,0,-1,16.074522,16.031405)"> | ||||
|       <path | ||||
|          inkscape:connector-curvature="0" | ||||
|          id="path4316-2" | ||||
|          d="M 5.5333883,0.50031154 C 2.3637866,1.5487935 0.08838834,4.561747 0.08838834,8.0490615 c 0,4.3456995 3.54457456,7.9509375 7.91999996,7.9509375 1.9927677,-0.0156 1.9799356,-1.959831 0,-1.949062 -3.2764839,0 -5.94,-2.668512 -5.94,-6.0018755 0,-2.4345676 1.4293399,-4.5021282 3.465,-5.445 z" | ||||
|          style="color:#000000;line-height:normal;fill:#dc322f;fill-opacity:1" | ||||
|          sodipodi:nodetypes="csccscc" /> | ||||
|       <rect | ||||
|          style="fill:#dc322f;fill-opacity:1" | ||||
|          id="rect4318-9" | ||||
|          transform="scale(-1,1)" | ||||
|          height="2.872442" | ||||
|          ry="0" | ||||
|          rx="0.99000001" | ||||
|          y="13.024178" | ||||
|          x="-8.0297537" | ||||
|          width="1.98" /> | ||||
|       <rect | ||||
|          style="fill:#dc322f;fill-opacity:1" | ||||
|          id="rect4318-3-1" | ||||
|          transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)" | ||||
|          height="3.809942" | ||||
|          ry="0" | ||||
|          rx="0.99000001" | ||||
|          y="13.739765" | ||||
|          x="3.6503892" | ||||
|          width="1.98" /> | ||||
|     </g> | ||||
|   </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 3.7 KiB | 
							
								
								
									
										75
									
								
								components/resources/shutdown.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								components/resources/shutdown.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||
| <svg | ||||
|    xmlns:dc="http://purl.org/dc/elements/1.1/" | ||||
|    xmlns:cc="http://creativecommons.org/ns#" | ||||
|    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||||
|    xmlns:svg="http://www.w3.org/2000/svg" | ||||
|    xmlns="http://www.w3.org/2000/svg" | ||||
|    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||||
|    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||||
|    width="16" | ||||
|    viewBox="0 0 16 16" | ||||
|    height="16" | ||||
|    id="svg4310" | ||||
|    version="1.1" | ||||
|    inkscape:version="0.91 r13725" | ||||
|    sodipodi:docname="shutdown.svg"> | ||||
|   <metadata | ||||
|      id="metadata4322"> | ||||
|     <rdf:RDF> | ||||
|       <cc:Work | ||||
|          rdf:about=""> | ||||
|         <dc:format>image/svg+xml</dc:format> | ||||
|         <dc:type | ||||
|            rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||||
|         <dc:title></dc:title> | ||||
|       </cc:Work> | ||||
|     </rdf:RDF> | ||||
|   </metadata> | ||||
|   <sodipodi:namedview | ||||
|      pagecolor="#ffffff" | ||||
|      bordercolor="#666666" | ||||
|      borderopacity="1" | ||||
|      objecttolerance="10" | ||||
|      gridtolerance="10" | ||||
|      guidetolerance="10" | ||||
|      inkscape:pageopacity="0" | ||||
|      inkscape:pageshadow="2" | ||||
|      inkscape:window-width="1600" | ||||
|      inkscape:window-height="882" | ||||
|      id="namedview4320" | ||||
|      showgrid="false" | ||||
|      inkscape:zoom="11.313709" | ||||
|      inkscape:cx="0.11494684" | ||||
|      inkscape:cy="0.7780831" | ||||
|      inkscape:window-x="0" | ||||
|      inkscape:window-y="18" | ||||
|      inkscape:window-maximized="0" | ||||
|      inkscape:current-layer="svg4310" | ||||
|      fit-margin-top="0" | ||||
|      fit-margin-left="0" | ||||
|      fit-margin-right="0" | ||||
|      fit-margin-bottom="0" /> | ||||
|   <defs | ||||
|      id="defs4312" /> | ||||
|   <g | ||||
|      style="fill:#dc322f;fill-opacity:1" | ||||
|      id="g4314" | ||||
|      transform="matrix(0.99,0,0,0.99,0.08838834,0.12906154)"> | ||||
|     <path | ||||
|        style="color:#000000;line-height:normal;fill:#dc322f;fill-opacity:1" | ||||
|        d="M 5.5,0.375 C 2.2983821,1.4340727 0,4.4774601 0,8 c 0,4.389595 3.5803783,8.03125 8,8.03125 4.419622,0 8,-3.641655 8,-8.03125 0,-3.5219879 -2.299024,-6.5653698 -5.5,-7.625 l 0,2.15625 C 12.541964,3.493202 14,5.5609693 14,8 14,11.367034 11.30958,14.0625 8,14.0625 4.6904203,14.0625 2,11.367034 2,8 2,5.5408408 3.4437776,3.4523957 5.5,2.5 l 0,-2.125 z" | ||||
|        id="path4316" | ||||
|        inkscape:connector-curvature="0" /> | ||||
|     <rect | ||||
|        width="2" | ||||
|        x="-9" | ||||
|        y="0.024" | ||||
|        rx="0.83700001" | ||||
|        ry="0" | ||||
|        height="8" | ||||
|        transform="scale(-1,1)" | ||||
|        id="rect4318" | ||||
|        style="fill:#dc322f;fill-opacity:1" /> | ||||
|   </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 2.4 KiB | 
							
								
								
									
										
											BIN
										
									
								
								components/resources/warning_red.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								components/resources/warning_red.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 252 B | 
		Reference in New Issue
	
	Block a user