-
Notifications
You must be signed in to change notification settings - Fork 7
/
Main.qml
158 lines (120 loc) · 3.35 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
// Copyright © 2018 Michał Szczepaniak <[email protected]>
// This work is free. You can redistribute it and/or modify it under the
// terms of the Do What The Fuck You Want To Public License, Version 2,
// as published by Sam Hocevar. See the COPYING file for more details.
import QtQuick 2.0
import SddmComponents 2.0
import "./components"
Rectangle {
id : amadeus_root
property var scalingX: 1920/bg.paintedWidth
property var scalingY: 1080/bg.paintedHeight
property var diffX: (amadeus_root.width - bg.paintedWidth)/2
property var diffY: (amadeus_root.height - bg.paintedHeight)/2
property var inputColor: "#debf54"
property var glow: "#60e6b656"
property bool isPrimary: (config.MirrorScreens === "true") || primaryScreen
signal tryLogin()
onTryLogin : {
sddm.login(amadeus_username.text, amadeus_password.text, sessionModel.lastIndex);
}
FontLoader {
id: takao_mincho
source: "fonts/TakaoMincho.ttf"
}
TextConstants { id: textConstants }
Loader {
id: vkloader
source: "vk.qml"
}
Connections {
target: sddm
onLoginSucceeded: {
}
onLoginFailed: {
}
}
Repeater {
model: screenModel
Item {
Rectangle {
x : geometry.x
y : geometry.y
width : geometry.width
height : geometry.height
color : "black"
}
}
}
Image {
id: bg
anchors.fill: parent
source: isPrimary ? "amadeus-background.png" : "amadeus-secondary.png"
fillMode: Image.PreserveAspectFit
clip: true
focus: true
smooth: true
}
SpTextBox {
id: amadeus_username
x: 683/amadeus_root.scalingX + diffX
y: 633/amadeus_root.scalingY + diffY
width: 560/amadeus_root.scalingX
height: 42/amadeus_root.scalingY
visible: isPrimary
color: "black"
borderColor: "black"
focusColor: "#000"
hoverColor: "#000"
textColor: inputColor
glowColor: glow
font.family: takao_mincho.name
font.pixelSize: 27/amadeus_root.scalingY
font.letterSpacing: 1.4
font.bold: true
KeyNavigation.tab: amadeus_password
}
SpTextBox {
id: amadeus_password
x: 683/amadeus_root.scalingX + diffX
y: 699/amadeus_root.scalingY + diffY
width: 560/amadeus_root.scalingX
height: 46/amadeus_root.scalingY
echoMode: TextInput.Password
visible: isPrimary
color: "black"
borderColor: "black"
focusColor: "#000"
hoverColor: "#000"
textColor: inputColor
glowColor: glow
font.family: takao_mincho.name
font.pixelSize: 27/amadeus_root.scalingY
KeyNavigation.tab: amadeus_login
KeyNavigation.backtab: amadeus_username
Keys.onPressed: {
if ((event.key === Qt.Key_Return) || (event.key === Qt.Key_Enter)) {
amadeus_root.tryLogin()
event.accepted = true;
}
}
}
MouseArea {
id: amadeus_login
x : 1254/amadeus_root.scalingX + diffX
y : 695/amadeus_root.scalingY + diffY
width : 50/amadeus_root.scalingX
height : 50/amadeus_root.scalingY
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
enabled: true
acceptedButtons: Qt.LeftButton
onClicked: { amadeus_root.tryLogin() }
}
Component.onCompleted: {
if (amadeus_username.text === "")
amadeus_username.focus = true
else
amadeus_password.focus = true
}
}