first commit

This commit is contained in:
Luc Bijl 2022-08-10 17:13:05 +02:00
commit 561fdb59e1
56 changed files with 3204 additions and 0 deletions

View file

@ -0,0 +1,102 @@
/*
* Copyright 2018 Marian Arlt <marianarlt@icloud.com>
* Copyright 2016 David Edmundson <davidedmundson@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 3 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.Controls 1.4
Item {
id: root
anchors.top: parent.bottom
anchors.topMargin: icon.height
property alias text: label.text
property alias iconSource: icon.source
property alias font: label.font
signal clicked
activeFocusOnTab: true
property int iconSize
opacity: activeFocus ? 1 : 0.6
implicitWidth: Math.max(icon.implicitWidth, label.contentWidth)
implicitHeight: Math.max(icon.implicitHeight + label.height * 2, label.height)
Image {
id: icon
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
width: config.PowerIconSize || iconSize
height: config.PowerIconSize || iconSize
}
Label {
id: label
font.pointSize: iconSize / 3
renderType: Text.QtRendering
anchors {
top: icon.bottom
left: parent.left
right: parent.right
topMargin: label.height / 2
}
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
color: "white"
font.underline: root.activeFocus
}
MouseArea {
id: mouseArea
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
onEntered: fadeIn.start()
onExited: fadeOut.start()
anchors.fill: root
}
PropertyAnimation {
id: fadeIn
target: root
properties: "opacity"
to: 1
duration: 200
}
PropertyAnimation {
id: fadeOut
target: root
properties: "opacity"
to: 0.6
duration: 200
}
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
Keys.onSpacePressed: clicked()
Accessible.onPressAction: clicked()
Accessible.role: Accessible.Button
Accessible.name: label.text
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2018 Marian Arlt <marianarlt@icloud.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 3 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.Controls 1.4
import QtQuick.Controls.Styles 1.4
Button {
id: keyboardLayoutButton
property int currentIndex
visible: keyboard.layouts.length > 1
style: ButtonStyle {
label: Image {
id: buttonLabel
source: "../assets/keyboard.svgz"
fillMode: Image.PreserveAspectFit
transform: Translate { x: 5 }
smooth: false
}
background: Rectangle {
radius: 3
color: keyboardLayoutButton.activeFocus ? "white" : "transparent"
opacity: keyboardLayoutButton.activeFocus ? 0.3 : 1
}
}
menu: Menu {
id: keyboardLayoutMenu
Instantiator {
id: instantiator
model: keyboard.layouts
onObjectAdded: keyboardLayoutMenu.insertItem(index, object)
onObjectRemoved: keyboardLayoutMenu.removeItem( object )
delegate: MenuItem {
text: modelData.longName
property string shortName: modelData.shortName
onTriggered: {
keyboard.currentLayout = model.index
}
}
}
}
Component.onCompleted: currentIndex = Qt.binding(function() {
return keyboard.currentLayout
});
}

View file

@ -0,0 +1,138 @@
/*
* Copyright 2018 Marian Arlt <marianarlt@icloud.com>
* Copyright 2016 David Edmundson <davidedmundson@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 3 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 QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
LoginFormLayout {
property string lastUserName
property bool passwordFieldOutlined: config.PasswordFieldOutlined == "true"
property int inputSpacing: 8
signal loginRequest(string username, string password)
function startLogin() {
var username = userList.selectedUser
var password = passwordField.text
loginRequest(username, password);
}
RowLayout {
Layout.leftMargin: loginButton.width + inputSpacing * 2
Layout.minimumWidth: passwordField.width + loginButton.width + inputSpacing * 2
TextField {
id: passwordField
placeholderText: textConstants.password
echoMode: TextInput.Password
onAccepted: startLogin()
focus: true
font.pointSize: usernameFontSize * 0.9
implicitWidth: root.width / 5
implicitHeight: usernameFontSize * 2.75
opacity: 0.5
style: TextFieldStyle {
textColor: passwordFieldOutlined ? "white" : "black"
placeholderTextColor: passwordFieldOutlined ? "white" : "black"
background: Rectangle {
radius: 3
border.color: "white"
border.width: 1
color: passwordFieldOutlined ? "transparent" : "white"
}
}
Keys.onEscapePressed: {
loginFormStack.currentItem.forceActiveFocus();
}
Keys.onPressed: {
if (event.key == Qt.Key_Left && !text) {
userList.decrementCurrentIndex();
event.accepted = true
}
if (event.key == Qt.Key_Right && !text) {
userList.incrementCurrentIndex();
event.accepted = true
}
}
Keys.onReleased: {
if (loginButton.opacity == 0 && length > 0) {
showLoginButton.start()
}
if (loginButton.opacity > 0 && length == 0) {
hideLoginButton.start()
}
}
Connections {
target: sddm
onLoginFailed: {
passwordField.selectAll()
passwordField.forceActiveFocus()
}
}
}
Image {
id: loginButton
Layout.leftMargin: inputSpacing
source: "../assets/login.svgz"
sourceSize: Qt.size(passwordField.height, passwordField.height)
smooth: true
opacity: 0
visible: opacity > 0
MouseArea {
anchors.fill: parent
onClicked: startLogin();
}
PropertyAnimation {
id: showLoginButton
target: loginButton
properties: "opacity"
to: 0.75
duration: 100
}
PropertyAnimation {
id: hideLoginButton
target: loginButton
properties: "opacity"
to: 0
duration: 80
}
}
}
}

View file

@ -0,0 +1,99 @@
/*
* Copyright 2018 Marian Alexander Arlt <marianarlt@icloud.com>
* Copyright 2016 David Edmundson <davidedmundson@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 3 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.Controls 1.4
import QtQuick.Layouts 1.1
Item {
id: root
property alias userListModel: userListView.model
property alias actionItems: actionItemsLayout.children
property alias notificationMessage: notificationsLabel.text
property alias faceSize: userListView.avatarSize
property alias usernameFontSize: userListView.rootFontSize
property alias usernameFontColor: userListView.rootFontColor
property bool showUserList: true
property alias userList: userListView
property alias userListCurrentIndex: userListView.currentIndex
property var userListCurrentModelData: userListView.currentItem === null ? [] : userListView.currentItem.m
default property alias _children: innerLayout.children
UserList {
id: userListView
visible: showUserList && y > 0
anchors {
bottom: parent.verticalCenter
left: parent.left
right: parent.right
}
}
ColumnLayout {
id: prompts
anchors.top: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
ColumnLayout {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
ColumnLayout {
id: innerLayout
Layout.topMargin: faceSize * 0.5
}
Label {
id: notificationsLabel
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: usernameFontSize / 2
color: usernameFontColor
font.italic: true
opacity: notificationMessage ? 1 : 0
Behavior on opacity {
OpacityAnimator {
duration: 100
}
}
}
}
RowLayout {
id: actionItemsLayout
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: actionItemsLayout.height * 4
spacing: usernameFontSize * 2
}
}
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2018 Marian Alexander Arlt <marianarlt@icloud.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 3 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.Controls 1.4
import QtQuick.Controls.Styles 1.4
ToolButton {
id: root
property int currentIndex: -1
property int rootFontSize
property string rootFontColor
visible: menu.items.length > 1
opacity: root.activeFocus ? 1 : 0.5
style: ButtonStyle {
label: Label {
id: buttonLabel
color: rootFontColor
font.pointSize: rootFontSize
renderType: Text.QtRendering
text: instantiator.objectAt(currentIndex).text || ""
font.underline: root.activeFocus
}
background: Rectangle {
color: "transparent"
}
}
Component.onCompleted: {
currentIndex = sessionModel.lastIndex
}
menu: Menu {
id: menu
Instantiator {
id: instantiator
model: sessionModel
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem( object )
delegate: MenuItem {
text: model.name
onTriggered: {
root.currentIndex = model.index
}
}
}
}
}

View file

@ -0,0 +1,107 @@
/*
* Copyright 2018 Marian Alexander Arlt <marianarlt@icloud.com>
* Copyright 2014 David Edmundson <davidedmundson@kde.org>
* Copyright 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 Library General Public License as
* published by the Free Software Foundation; either version 3 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.Controls 1.4
import QtGraphicalEffects 1.0
Item {
id: wrapper
property bool isCurrent: true
property bool constrainText: true
property string name
property string userName
property string avatarPath
property string iconSource
property int usernameFontSize
property string usernameFontColor
property real faceSize
readonly property var m: model
signal clicked()
opacity: isCurrent ? 1.0 : 0.3
Behavior on opacity {
OpacityAnimator {
duration: 150
}
}
Item {
id: imageSource
width: faceSize
height: faceSize
anchors.horizontalCenter: parent.horizontalCenter
// 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, faceSize)
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
smooth: true
visible: false
}
Image {
id: mask
source: "../assets/mask.svgz"
sourceSize: Qt.size(faceSize, faceSize)
smooth: true
}
OpacityMask {
anchors.fill: face
source: face
maskSource: mask
cached: true
}
}
Label {
id: usernameLabel
color: usernameFontColor
font.capitalization: Font.Capitalize
font.pointSize: usernameFontSize * 1.2
renderType: Text.QtRendering
anchors.top: imageSource.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: usernameLabel.height / 1.2
text: wrapper.name
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() }
}

View file

@ -0,0 +1,97 @@
/*
* Copyright 2018 Marian Alexander Arlt <marianarlt@icloud.com>
* Copyright 2014 David Edmundson <davidedmundson@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 3 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
ListView {
id: view
readonly property string selectedUser: currentItem ? currentItem.userName : ""
readonly property int userItemWidth: root.width / 10
readonly property int userItemHeight: avatarSize + passwordField.height / 2
property int rootFontSize
property string rootFontColor
property int avatarSize
implicitHeight: userItemHeight
activeFocusOnTab : true
signal userSelected;
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
preferredHighlightBegin: width / 2 - userItemWidth / 2
preferredHighlightEnd: preferredHighlightBegin
delegate: UserDelegate {
avatarPath: model.icon || ""
usernameFontSize : rootFontSize
usernameFontColor: rootFontColor
faceSize: avatarSize
name: {
var displayName = model.realName || model.name
if (model.vtNumber === undefined || model.vtNumber < 0) {
return displayName
}
if (!model.session) {
return "Nobody logged in on that session", "Unused"
}
var location = ""
if (model.isTty) {
location = "User logged in on console number", "TTY %1", model.vtNumber
} else if (model.displayNumber) {
location = "User logged in on console (X display number)", "on TTY %1 (Display %2)", model.vtNumber, model.displayNumber
}
if (location) {
return "Username (location)", "%1 (%2)", displayName, location
}
return displayName
}
userName: model.name
width: userItemWidth
height: userItemHeight
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()
}

View file

@ -0,0 +1,28 @@
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2017 Martin Gräßlin <mgraesslin@kde.org>
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.5
import QtQuick.VirtualKeyboard 2.1
InputPanel {
id: inputPanel
property bool activated: false
active: activated && Qt.inputMethod.visible
visible: active
width: parent.width
}

View file

@ -0,0 +1,53 @@
/*
* Copyright 2018 Marian Arlt <marianarlt@icloud.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 3 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 QtGraphicalEffects 1.0
FocusScope {
id: backgroundComponent
property alias imageSource: backgroundImage.source
property bool configBlur: config.blur == "true"
Image {
id: backgroundImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
clip: true
focus: true
smooth: true
}
RecursiveBlur {
id: backgroundBlur
anchors.fill: backgroundImage
source: backgroundImage
radius: configBlur ? config.recursiveBlurRadius : 0
loops: configBlur ? config.recursiveBlurLoops : 0
}
MouseArea {
anchors.fill: parent
onClicked: container.focus = true
}
}