2016-04-04 16:33:08 +02:00
|
|
|
import QtQuick 2.0
|
2016-04-06 18:22:43 +02:00
|
|
|
import QtGraphicalEffects 1.0
|
2016-04-04 16:33:08 +02:00
|
|
|
import SddmComponents 2.0
|
|
|
|
|
2016-04-05 17:13:59 +02:00
|
|
|
Item {
|
2016-04-06 18:22:43 +02:00
|
|
|
id: frame
|
2016-04-05 17:13:59 +02:00
|
|
|
property int sessionIndex: sessionModel.lastIndex
|
|
|
|
property string userName: userModel.lastUser
|
2016-04-06 18:22:43 +02:00
|
|
|
property bool isProcessing: glowAnimation.running
|
2016-04-09 05:02:10 +02:00
|
|
|
property alias input: passwdInput
|
2016-04-05 13:42:21 +02:00
|
|
|
|
2016-04-06 18:22:43 +02:00
|
|
|
Connections {
|
|
|
|
target: sddm
|
|
|
|
onLoginSucceeded: {
|
2016-04-09 08:11:23 +02:00
|
|
|
glowAnimation.running = false
|
2016-04-12 18:04:43 +02:00
|
|
|
Qt.quit()
|
2016-04-06 18:22:43 +02:00
|
|
|
}
|
|
|
|
onLoginFailed: {
|
|
|
|
passwdInput.echoMode = TextInput.Normal
|
|
|
|
passwdInput.text = textConstants.loginFailed
|
|
|
|
passwdInput.focus = false
|
|
|
|
passwdInput.color = "#e7b222"
|
|
|
|
glowAnimation.running = false
|
2016-04-05 13:42:21 +02:00
|
|
|
}
|
|
|
|
}
|
2016-04-04 16:33:08 +02:00
|
|
|
|
|
|
|
Item {
|
2016-04-09 08:11:23 +02:00
|
|
|
id: loginItem
|
2016-04-04 16:33:08 +02:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: parent.width
|
2016-04-09 08:11:23 +02:00
|
|
|
height: parent.height
|
2016-04-04 16:33:08 +02:00
|
|
|
|
2016-04-09 08:11:23 +02:00
|
|
|
UserAvatar {
|
|
|
|
id: userIconRec
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
2020-03-17 18:16:10 +01:00
|
|
|
topMargin: parent.height / 2.15
|
2016-04-09 08:11:23 +02:00
|
|
|
horizontalCenter: parent.horizontalCenter
|
2016-04-04 16:33:08 +02:00
|
|
|
}
|
2020-03-17 18:16:10 +01:00
|
|
|
width: 122
|
|
|
|
height: 122
|
2016-04-09 08:11:23 +02:00
|
|
|
source: userFrame.currentIconPath
|
|
|
|
onClicked: {
|
|
|
|
root.state = "stateUser"
|
|
|
|
userFrame.focus = true
|
|
|
|
}
|
|
|
|
}
|
2016-04-04 16:33:08 +02:00
|
|
|
|
2016-04-09 08:11:23 +02:00
|
|
|
Glow {
|
|
|
|
id: avatarGlow
|
|
|
|
anchors.fill: userIconRec
|
|
|
|
radius: 0
|
|
|
|
samples: 17
|
|
|
|
color: "#99ffffff"
|
|
|
|
source: userIconRec
|
2016-04-06 18:22:43 +02:00
|
|
|
|
2016-04-09 08:11:23 +02:00
|
|
|
SequentialAnimation on radius {
|
|
|
|
id: glowAnimation
|
|
|
|
running: false
|
|
|
|
alwaysRunToEnd: true
|
|
|
|
loops: Animation.Infinite
|
2020-03-17 18:16:10 +01:00
|
|
|
PropertyAnimation { to: 20; duration: 1000 }
|
|
|
|
PropertyAnimation { to: 0; duration: 1000 }
|
2016-04-06 18:22:43 +02:00
|
|
|
}
|
2016-04-09 08:11:23 +02:00
|
|
|
}
|
2016-04-06 18:22:43 +02:00
|
|
|
|
2016-04-09 08:11:23 +02:00
|
|
|
Text {
|
|
|
|
id: userNameText
|
|
|
|
anchors {
|
|
|
|
top: userIconRec.bottom
|
|
|
|
topMargin: 10
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
2016-04-04 16:33:08 +02:00
|
|
|
}
|
|
|
|
|
2016-04-09 08:11:23 +02:00
|
|
|
text: userName
|
|
|
|
color: textColor
|
|
|
|
font.pointSize: 15
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: passwdInputRec
|
2020-03-17 18:16:10 +01:00
|
|
|
visible: !isProcessing
|
2016-04-09 08:11:23 +02:00
|
|
|
anchors {
|
|
|
|
top: userNameText.bottom
|
|
|
|
topMargin: 10
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
width: 300
|
|
|
|
height: 35
|
|
|
|
radius: 3
|
|
|
|
color: "#55000000"
|
2016-04-04 16:33:08 +02:00
|
|
|
|
2016-04-09 08:11:23 +02:00
|
|
|
TextInput {
|
|
|
|
id: passwdInput
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: 8
|
|
|
|
anchors.rightMargin: 8 + 36
|
|
|
|
clip: true
|
|
|
|
focus: true
|
|
|
|
color: textColor
|
|
|
|
font.pointSize: 15
|
|
|
|
selectByMouse: true
|
|
|
|
selectionColor: "#a8d6ec"
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
verticalAlignment: TextInput.AlignVCenter
|
|
|
|
onFocusChanged: {
|
2020-03-17 18:16:10 +01:00
|
|
|
if(focus) {
|
2016-04-09 08:11:23 +02:00
|
|
|
color = textColor
|
|
|
|
echoMode = TextInput.Password
|
|
|
|
text = ""
|
2016-04-04 16:33:08 +02:00
|
|
|
}
|
2016-04-09 08:11:23 +02:00
|
|
|
}
|
|
|
|
onAccepted: {
|
|
|
|
glowAnimation.running = true
|
2020-03-17 18:16:10 +01:00
|
|
|
sddm.login(userNameText.text,
|
|
|
|
passwdInput.text,
|
|
|
|
sessionIndex)
|
2016-04-09 08:11:23 +02:00
|
|
|
}
|
|
|
|
KeyNavigation.backtab: {
|
2020-03-17 18:16:10 +01:00
|
|
|
if(sessionButton.visible) {
|
2016-04-09 08:11:23 +02:00
|
|
|
return sessionButton
|
2016-04-06 18:22:43 +02:00
|
|
|
}
|
2020-03-17 18:16:10 +01:00
|
|
|
else if(userButton.visible) {
|
2016-04-09 08:11:23 +02:00
|
|
|
return userButton
|
2016-04-09 05:02:10 +02:00
|
|
|
}
|
2016-04-09 08:11:23 +02:00
|
|
|
else {
|
|
|
|
return shutdownButton
|
2016-04-09 05:02:10 +02:00
|
|
|
}
|
2016-04-04 16:33:08 +02:00
|
|
|
}
|
2016-04-09 08:11:23 +02:00
|
|
|
KeyNavigation.tab: loginButton
|
|
|
|
Timer {
|
|
|
|
interval: 200
|
|
|
|
running: true
|
|
|
|
onTriggered: passwdInput.forceActiveFocus()
|
|
|
|
}
|
|
|
|
}
|
2016-04-04 16:33:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|