-
Notifications
You must be signed in to change notification settings - Fork 12
/
Main.qml
208 lines (200 loc) · 4.18 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import QtQuick 2.5
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4 as Qqc
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
import QtMultimedia 5.5
import SddmComponents 2.0
Rectangle {
color: "black"
width: Window.width
height: Window.height
Connections {
target: sddm
onLoginSucceeded: {
}
onLoginFailed: {
denied.play()
}
}
AnimatedImage {
width: parent.width
height: parent.height
fillMode: Image.Tile
source: "bgN5.gif"
}
ColumnLayout {
width: parent.width
height: parent.height
AnimatedImage{
Layout.alignment: Qt.AlignCenter
Layout.topMargin: 2
width: 192
height: 192
source: "WiredLogIn.gif"
}
AnimatedImage{
Layout.alignment: Qt.AlignCenter
Layout.bottomMargin: 20
height: 50
source: "whoIsUser.gif"
}
Qqc.Label {
Layout.alignment: Qt.AlignCenter
text: "User ID:"
color: "#c1b492"
font.pixelSize: 16
}
Qqc.TextField {
id: username
Layout.alignment: Qt.AlignCenter
text: userModel.lastUser
style: TextFieldStyle {
textColor: "#c1b492"
background: Rectangle {
color: "#000"
implicitWidth: 200
border.color: "#d2738a"
}
}
KeyNavigation.backtab: shutdownBtn; KeyNavigation.tab: password
Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
sddm.login(username.text, password.text, session.index)
event.accepted = true
}
}
}
Qqc.Label {
Layout.alignment: Qt.AlignCenter
text: "Password:"
color: "#c1b492"
font.pixelSize: 16
}
Qqc.TextField {
id: password
echoMode: TextInput.Password
Layout.alignment: Qt.AlignCenter
style: TextFieldStyle {
textColor: "#c1b492"
background: Rectangle {
color: "#000"
implicitWidth: 200
border.color: "#d2738a"
}
}
KeyNavigation.backtab: username; KeyNavigation.tab: session
Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
sddm.login(username.text, password.text, session.index)
event.accepted = true
}
}
}
ColumnLayout {
Layout.alignment: Qt.AlignCenter
Layout.topMargin: 4
Layout.bottomMargin: 50
width: 200
Rectangle {
anchors.fill: parent
color: "#d2738a"
}
Qqc.Label {
Layout.alignment: Qt.AlignCenter
text: "Login"
color: "#c1b492"
font.pixelSize: 20
}
MouseArea {
anchors.fill: parent
onClicked: sddm.login(username.text, password.text, session.index)
}
}
}
AnimatedImage {
id: shutdownBtn
height: 80
width: 80
y: 10
x: Window.width - width - 10
source: "VisLain.gif"
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
hoverEnabled: true
onClicked: sddm.powerOff()
onEntered: {
var component = Qt.createComponent("ShutdownToolTip.qml");
if (component.status == Component.Ready) {
var tooltip = component.createObject(shutdownBtn);
tooltip.x = -45
tooltip.y = 60
tooltip.destroy(600);
}
}
}
}
AnimatedImage {
id: rebootBtn
anchors.right: shutdownBtn.left
anchors.rightMargin: 5
y: shutdownBtn.y + 10
height: 70
width: 60
source: "lain_myese.gif"
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
hoverEnabled: true
onClicked: sddm.reboot()
onEntered: {
var component = Qt.createComponent("RebootToolTip.qml");
if (component.status == Component.Ready) {
var tooltip = component.createObject(rebootBtn);
tooltip.x = -45
tooltip.y = 50
tooltip.destroy(600);
}
}
}
}
ComboBox {
id: session
height: 30
width: 200
x: 15
y: 20
model: sessionModel
index: sessionModel.lastIndex
color: "#000"
borderColor: "#d2738a"
focusColor: "#d2738a"
hoverColor: "#d2738a"
textColor: "#c1b492"
arrowIcon: "angle-down.png"
KeyNavigation.backtab: password; KeyNavigation.tab: rebootBtn;
}
Audio {
id: bgMusic
source: "bg_music.wav"
autoPlay: true
loops: Audio.Infinite
}
Audio {
id: welcome
source: "welcome.wav"
autoPlay: true
}
Audio {
id: denied
source: "denied.wav"
}
Component.onCompleted: {
if (username.text == "") {
username.focus = true
} else {
password.focus = true
}
}
}