-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.qml
128 lines (107 loc) · 2.54 KB
/
Main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import QtQuick 2.8
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
import SddmComponents 2.0 as SddmComponents
Rectangle {
LayoutMirroring.enabled: Qt.locale().textDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
color: config.backgroundColor ? config.backgroundColor : "#808080"
Item {
id: style
/* Hack: Use DialogButtonBox spacing to detect current style */
/* Style order: Default, Fusion, Universal, Material */
property var buttonSpacings: [1, 6, 4, 8]
property var spacings: [8, 6, 12, 12]
property int id: {
let index = buttonSpacings.indexOf(buttons.spacing)
index < 0 ? 0 : index
}
property int spacing: spacings[id]
}
SddmComponents.TextConstants {
id: textConstants
}
Connections {
target: sddm
function onLoginFailed() {
dialog.title = textConstants.loginFailed
passwordEntry.text = ""
passwordEntry.focus = true
}
}
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
Binding on source {
when: config.backgroundImage != undefined
value: config.backgroundImage
}
}
DropShadow {
width: dialog.width
height: dialog.height
x: dialog.x
y: dialog.y
source: dialog.background
samples: 33
opacity: 0.33
}
Dialog {
id: dialog
anchors.centerIn: parent
closePolicy: Popup.NoAutoClose
focus: true
visible: true
title: textConstants.welcomeText.arg(sddm.hostName)
footer: DialogButtonBox {
id: buttons
Button {
text: textConstants.login
onClicked: sddm.login(userNameEntry.text, passwordEntry.text, sessionEntry.currentIndex)
}
Button {
text: textConstants.shutdown
onClicked: sddm.powerOff()
}
Button {
text: textConstants.reboot
onClicked: sddm.reboot()
}
}
Grid {
columns: 2
spacing: style.spacing
verticalItemAlignment: Grid.AlignVCenter
Label {
text: textConstants.userName + ":"
}
TextField {
id: userNameEntry
width: height*10
text: userModel.lastUser
onAccepted: sddm.login(userNameEntry.text, passwordEntry.text, sessionEntry.currentIndex)
}
Label {
text: textConstants.password + ":"
}
TextField {
id: passwordEntry
width: height*10
echoMode: TextInput.Password
focus: true
onAccepted: sddm.login(userNameEntry.text, passwordEntry.text, sessionEntry.currentIndex)
}
Label {
text: textConstants.session + ":"
}
ComboBox {
id: sessionEntry
width: height*10
height: userNameEntry.height
model: sessionModel
textRole: "name"
currentIndex: sessionModel.lastIndex
}
}
}
}