-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.qml
187 lines (162 loc) · 6.21 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import QtQuick 2.0
import SddmComponents 2.0
import "SimpleControls" as Simple
Rectangle {
width: 640
height: 480
LayoutMirroring.enabled: Qt.locale().textDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
TextConstants { id: textConstants }
Connections {
target: sddm
onLoginSucceeded: {}
onLoginFailed: {
pw_entry.text = ""
pw_entry.focus = true
}
}
Background {
anchors.fill: parent
source: config.background
fillMode: Image.PreserveAspectCrop
onStatusChanged: {
if (status == Image.Error && source != config.defaultBackground) {
source = config.defaultBackground
}
}
}
Rectangle {
anchors.fill: parent
color: "transparent"
Rectangle {
width: 400
height: 250
color: "transparent"
anchors.centerIn: parent
anchors.verticalCenterOffset: height / 2
Rectangle {
id: entries
width: parent.width
height: 200
color: "transparent"
radius: 4
Column {
anchors.centerIn: parent
spacing: 20
Row {
TextBox {
id: user_entry
radius: 3
width: 250
anchors.verticalCenter: parent.verticalCenter
text: userModel.lastUser
font.pixelSize: 16
color: Qt.rgba(0, 0, 0, 0.2)
borderColor: "transparent"
focusColor: Qt.rgba(0, 0, 0, 0.25)
hoverColor: Qt.rgba(0, 0, 0, 0.2)
textColor: "white"
KeyNavigation.backtab: session; KeyNavigation.tab: pw_entry
}
}
Row {
PasswordBox {
id: pw_entry
radius: 3
width: 250
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 15
color: Qt.rgba(0, 0, 0, 0.2)
borderColor: "transparent"
focusColor: Qt.rgba(0, 0, 0, 0.25)
hoverColor: Qt.rgba(0, 0, 0, 0.2)
textColor: "white"
focus: true
KeyNavigation.backtab: user_entry; KeyNavigation.tab: loginButton
Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
sddm.login(user_entry.text, pw_entry.text, session.index)
event.accepted = true
}
}
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
Button {
id: loginButton
radius: 3
text: textConstants.login
width: 250
color: Qt.rgba(0, 0, 0, 0.2)
activeColor: Qt.rgba(0, 0, 0, 0.2)
pressedColor: Qt.rgba(0, 0, 0, 0.25)
font.pixelSize: 15
font.bold: false
onClicked: sddm.login(user_entry.text, pw_entry.text, session.index)
KeyNavigation.backtab: pw_entry; KeyNavigation.tab: restart
}
}
}
}
}
}
Rectangle {
width: parent.width - 10
height: 40
color: "transparent"
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
Simple.SimpleComboBox {
id: session
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: 160
color: Qt.rgba(0, 0, 0, 0.2)
dropDownColor: Qt.rgba(0, 0, 0, 0.2)
borderColor: "transparent"
textColor: "white"
arrowIcon: "images/arrow-down.png"
arrowColor: "transparent"
model: sessionModel
index: sessionModel.lastIndex
font.pixelSize: 13
KeyNavigation.backtab: shutdown; KeyNavigation.tab: user_entry
}
Button {
id: restart
anchors.verticalCenter: parent.verticalCenter
anchors.right: shutdown.left
anchors.rightMargin: 10
text: textConstants.reboot
color: Qt.rgba(0, 0, 0, 0.2)
pressedColor: Qt.rgba(0, 0, 0, 0.25)
activeColor: Qt.rgba(0, 0, 0, 0.2)
font.pixelSize: 13
font.bold: false
radius: 3
onClicked: sddm.reboot()
KeyNavigation.backtab: loginButton; KeyNavigation.tab: shutdown
}
Button {
id: shutdown
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
text: textConstants.shutdown
color: Qt.rgba(0, 0, 0, 0.2)
pressedColor: Qt.rgba(0, 0, 0, 0.25)
activeColor: Qt.rgba(0, 0, 0, 0.2)
font.pixelSize: 13
font.bold: false
radius: 3
onClicked: sddm.powerOff()
KeyNavigation.backtab: restart; KeyNavigation.tab: session
}
}
Component.onCompleted: {
if (user_entry.text === "")
user_entry.focus = true
else
pw_entry.focus = true
}
}