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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
|
// Config created by Keyitdev https://git.rp1.hu/gabeszm/sddm-rave-theme
// Copyright (C) 2022-2025 Keyitdev
// Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Effects
Column {
id: inputContainer
Layout.fillWidth: true
property ComboBox exposeSession: sessionSelect.exposeSession
property bool failed
Item {
id: errorMessageField
// change also in selectSession
height: root.font.pointSize * 2
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
Label {
id: errorMessage
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : null
font.pointSize: root.font.pointSize * 0.8
font.italic: true
color: config.WarningColor
opacity: 0
states: [
State {
name: "fail"
when: failed
PropertyChanges {
target: errorMessage
opacity: 1
}
},
State {
name: "capslock"
when: keyboard.capsLock
PropertyChanges {
target: errorMessage
opacity: 1
}
}
]
transitions: [
Transition {
PropertyAnimation {
properties: "opacity"
duration: 100
}
}
]
}
}
// Profilkép + felhasználóváltó
Item {
id: avatarField
height: root.font.pointSize * 12
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
property string userIconPath: {
var icon = userModel.data(userModel.index(selectUser.currentIndex, 0), Qt.UserRole + 4)
return (icon && icon !== "") ? icon : ""
}
Column {
anchors.centerIn: parent
spacing: root.font.pointSize * 0.8
// Avatar kör
Rectangle {
id: avatarCircle
anchors.horizontalCenter: parent.horizontalCenter
width: root.font.pointSize * 7
height: root.font.pointSize * 7
radius: width / 2
clip: true
color: Qt.rgba(0.10, 0.10, 0.15, 0.65)
// The source image (invisible)
Image {
id: avatarPhoto
anchors.fill: parent
source: avatarField.userIconPath !== "" ? avatarField.userIconPath : ""
fillMode: Image.PreserveAspectCrop
smooth: true
mipmap: true
visible: false
}
// The mask source
Item {
id: avatarMask
anchors.fill: parent
visible: false
layer.enabled: true
Rectangle {
anchors.fill: parent
radius: parent.width / 2
color: "black"
}
}
// Apply MultiEffect to mask the avatarPhoto
MultiEffect {
anchors.fill: parent
source: avatarPhoto
visible: avatarPhoto.status === Image.Ready && avatarField.userIconPath !== ""
maskEnabled: true
maskSource: avatarMask
maskThresholdMin: 0.5
maskSpreadAtMin: 1.0
}
Image {
id: avatarFallback
anchors.centerIn: parent
width: parent.width * 0.55
height: parent.height * 0.55
source: Qt.resolvedUrl("../Assets/User.svg")
fillMode: Image.PreserveAspectFit
smooth: true
visible: avatarField.userIconPath === "" || avatarPhoto.status !== Image.Ready
opacity: 0.75
}
// Draw the border on top of everything!
Rectangle {
anchors.fill: parent
radius: parent.width / 2
color: "transparent"
border.color: Qt.rgba(1, 1, 1, 0.30)
border.width: 2
}
}
// Felhasználóváltó gomb (csak ha több user van)
UserSwitcher {
id: userSwitcher
anchors.horizontalCenter: parent.horizontalCenter
selectedIndex: selectUser.currentIndex
onUserSwitched: function(idx, name) {
selectUser.currentIndex = idx
username.text = name
}
}
}
}
Item {
id: usernameField
height: root.font.pointSize * 4.5
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
Button {
id: staticUserIcon
width: parent.height
height: parent.height
anchors.left: parent.left
z: 2
visible: userModel.count <= 1
enabled: false
icon.height: parent.height * 0.25
icon.width: parent.height * 0.25
icon.color: config.UserIconColor
icon.source: Qt.resolvedUrl("../Assets/User.svg")
background: Rectangle {
color: "transparent"
border.color: "transparent"
}
}
ComboBox {
id: selectUser
width: parent.height
height: parent.height
anchors.left: parent.left
z: 2
visible: userModel.count > 1
model: userModel
currentIndex: model.lastIndex
textRole: "name"
hoverEnabled: true
onActivated: {
username.text = currentText;
}
property var popkey: config.RightToLeftLayout == "true" ? Qt.Key_Right : Qt.Key_Left
Keys.onPressed: function (event) {
if (event.key == Qt.Key_Down && !popup.opened)
username.forceActiveFocus();
if ((event.key == Qt.Key_Up || event.key == popkey) && !popup.opened)
popup.open();
}
KeyNavigation.down: username
KeyNavigation.right: username
delegate: ItemDelegate {
// minus padding
width: popupHandler.width - 20
anchors.horizontalCenter: popupHandler.horizontalCenter
contentItem: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: model.name
font.pointSize: root.font.pointSize * 0.8
font.capitalization: Font.AllLowercase
font.family: root.font.family
color: config.DropdownTextColor
}
background: Rectangle {
color: selectUser.highlightedIndex === index ? Qt.rgba(1, 1, 1, 0.15) : "transparent"
radius: config.RoundCorners !== "" ? parseInt(config.RoundCorners) / 4 : 5
}
}
indicator: Button {
id: usernameIcon
width: selectUser.height * 1
height: parent.height
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0
icon.height: parent.height * 0.25
icon.width: parent.height * 0.25
enabled: false
icon.color: config.UserIconColor
icon.source: Qt.resolvedUrl("../Assets/User.svg")
background: Rectangle {
color: "transparent"
border.color: "transparent"
}
}
background: Rectangle {
color: "transparent"
border.color: "transparent"
}
popup: Popup {
id: popupHandler
implicitHeight: contentItem.implicitHeight
width: usernameField.width
y: parent.height - username.height / 3
x: config.RightToLeftLayout == "true" ? -loginButton.width + selectUser.width : 0
rightMargin: config.RightToLeftLayout == "true" ? root.padding + usernameField.width / 2 : undefined
padding: 10
contentItem: ListView {
implicitHeight: contentHeight + 20
clip: true
model: selectUser.popup.visible ? selectUser.delegateModel : null
currentIndex: selectUser.highlightedIndex
ScrollIndicator.vertical: ScrollIndicator {}
}
background: Rectangle {
radius: config.RoundCorners !== "" ? parseInt(config.RoundCorners) / 2 : 10
color: Qt.rgba(1, 1, 1, 0.08)
border.color: Qt.rgba(1, 1, 1, 0.18)
border.width: 1
layer.enabled: true
}
enter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
}
}
}
states: [
State {
name: "pressed"
when: selectUser.down
PropertyChanges {
target: usernameIcon
icon.color: Qt.lighter(config.HoverUserIconColor, 1.1)
}
},
State {
name: "hovered"
when: selectUser.hovered
PropertyChanges {
target: usernameIcon
icon.color: Qt.lighter(config.HoverUserIconColor, 1.2)
}
},
State {
name: "focused"
when: selectUser.activeFocus
PropertyChanges {
target: usernameIcon
icon.color: config.HoverUserIconColor
}
}
]
transitions: [
Transition {
PropertyAnimation {
properties: "color, border.color, icon.color"
duration: 150
}
}
]
}
TextField {
id: username
anchors.centerIn: parent
height: root.font.pointSize * 3
width: parent.width
horizontalAlignment: TextInput.AlignHCenter
z: 1
text: config.ForceLastUser == "true" ? selectUser.currentText : null
color: config.LoginFieldTextColor
font.bold: true
font.capitalization: config.AllowUppercaseLettersInUsernames == "false" ? Font.AllLowercase : Font.MixedCase
placeholderText: config.TranslatePlaceholderUsername || textConstants.userName
placeholderTextColor: config.PlaceholderTextColor
selectByMouse: true
renderType: Text.QtRendering
onFocusChanged: {
if (focus)
selectAll();
}
background: Rectangle {
color: username.activeFocus ? Qt.rgba(0, 0, 0, 0.35) : Qt.rgba(0, 0, 0, 0.2)
border.color: username.activeFocus ? Qt.rgba(255, 255, 255, 0.3) : Qt.rgba(255, 255, 255, 0.12)
border.width: username.activeFocus ? 1.5 : 1
radius: config.RoundCorners !== "" ? parseInt(config.RoundCorners) : 10
Behavior on color {
ColorAnimation {
duration: 150
}
}
Behavior on border.color {
ColorAnimation {
duration: 150
}
}
}
onAccepted: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
KeyNavigation.down: passwordIcon
states: [
State {
name: "focused"
when: username.activeFocus
PropertyChanges {
target: username
color: Qt.lighter(config.LoginFieldTextColor, 1.15)
}
}
]
}
}
Item {
id: passwordField
height: root.font.pointSize * 4.5
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
Button {
id: passwordIcon
height: parent.height
width: selectUser.height * 1
anchors.left: parent.left
anchors.leftMargin: selectUser.height * 0
anchors.verticalCenter: parent.verticalCenter
z: 2
icon.height: parent.height * 0.25
icon.width: parent.height * 0.25
icon.color: config.PasswordIconColor
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
background: Rectangle {
color: "transparent"
border.color: "transparent"
}
states: [
State {
name: "visiblePasswordFocused"
when: passwordIcon.checked && passwordIcon.activeFocus
PropertyChanges {
target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: config.HoverPasswordIconColor
}
},
State {
name: "visiblePasswordHovered"
when: passwordIcon.checked && passwordIcon.hovered
PropertyChanges {
target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: config.HoverPasswordIconColor
}
},
State {
name: "visiblePassword"
when: passwordIcon.checked
PropertyChanges {
target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
}
},
State {
name: "hiddenPasswordFocused"
when: passwordIcon.enabled && passwordIcon.activeFocus
PropertyChanges {
target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: config.HoverPasswordIconColor
}
},
State {
name: "hiddenPasswordHovered"
when: passwordIcon.hovered
PropertyChanges {
target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: config.HoverPasswordIconColor
}
}
]
onClicked: toggle()
Keys.onReturnPressed: toggle()
Keys.onEnterPressed: toggle()
KeyNavigation.down: password
}
TextField {
id: password
height: root.font.pointSize * 3
width: parent.width
anchors.centerIn: parent
horizontalAlignment: TextInput.AlignHCenter
font.bold: true
color: config.PasswordFieldTextColor
focus: config.PasswordFocus == "true" ? true : false
echoMode: passwordIcon.checked ? TextInput.Normal : TextInput.Password
placeholderText: config.TranslatePlaceholderPassword || textConstants.password
placeholderTextColor: config.PlaceholderTextColor
passwordCharacter: "•"
passwordMaskDelay: config.HideCompletePassword == "true" ? undefined : 1000
renderType: Text.QtRendering
selectByMouse: true
background: Rectangle {
color: password.activeFocus ? Qt.rgba(0, 0, 0, 0.35) : Qt.rgba(0, 0, 0, 0.2)
border.color: password.activeFocus ? Qt.rgba(255, 255, 255, 0.3) : Qt.rgba(255, 255, 255, 0.12)
border.width: password.activeFocus ? 1.5 : 1
radius: config.RoundCorners !== "" ? parseInt(config.RoundCorners) : 10
Behavior on color {
ColorAnimation {
duration: 150
}
}
Behavior on border.color {
ColorAnimation {
duration: 150
}
}
}
onAccepted: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
KeyNavigation.down: loginButton
}
states: [
State {
name: "focused"
when: password.activeFocus
PropertyChanges {
target: password
color: Qt.lighter(config.LoginFieldTextColor, 1.15)
}
}
]
transitions: [
Transition {
PropertyAnimation {
properties: "color, border.color"
duration: 150
}
}
]
}
Item {
id: login
// important
// try 4 or 9 ...
height: root.font.pointSize * 9
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
visible: config.HideLoginButton == "true" ? false : true
Item {
id: loginButton
height: root.font.pointSize * 3
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
focus: true
activeFocusOnTab: true
property bool hovered: hoverArea.containsMouse
property bool down: hoverArea.pressed
signal clicked()
onClicked: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
Keys.onReturnPressed: clicked()
Keys.onEnterPressed: clicked()
KeyNavigation.down: rebootBtn
Rectangle {
id: buttonBackground
anchors.fill: parent
radius: config.RoundCorners !== "" ? parseInt(config.RoundCorners) : 10
border.width: loginButton.activeFocus ? 1.5 : 1
border.color: loginButton.down ? Qt.rgba(21/255, 128/255, 61/255, 0.95) : (loginButton.hovered ? Qt.rgba(34/255, 197/255, 94/255, 0.85) : Qt.rgba(74/255, 222/255, 128/255, 0.65))
color: loginButton.down ? Qt.rgba(21/255, 128/255, 61/255, 0.80) : (loginButton.hovered ? Qt.rgba(34/255, 197/255, 94/255, 0.65) : Qt.rgba(74/255, 222/255, 128/255, 0.40))
Behavior on border.color {
ColorAnimation {
duration: 150
}
}
Behavior on color {
ColorAnimation {
duration: 150
}
}
}
Text {
id: loginButtonText
anchors.centerIn: parent
font.bold: true
font.pointSize: root.font.pointSize
font.family: root.font.family
color: "#ffffff"
text: config.TranslateLogin || textConstants.login
opacity: 1.0
Behavior on opacity {
NumberAnimation {
duration: 150
}
}
}
MouseArea {
id: hoverArea
anchors.fill: parent
hoverEnabled: true
onClicked: parent.clicked()
}
}
}
Item {
id: powerButtonsRow
height: root.font.pointSize * 10
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: root.font.pointSize * 3
// Reboot gomb
Column {
spacing: root.font.pointSize * 0.6
RoundButton {
id: rebootBtn
width: root.font.pointSize * 6
height: root.font.pointSize * 6
activeFocusOnTab: true
Keys.onReturnPressed: sddm.reboot()
Keys.onEnterPressed: sddm.reboot()
KeyNavigation.right: shutdownBtn
hoverEnabled: true
icon.source: Qt.resolvedUrl("../Assets/Reboot.svg")
icon.width: root.font.pointSize * 3
icon.height: root.font.pointSize * 3
icon.color: "#ffffff"
opacity: rebootBtn.hovered || rebootBtn.activeFocus ? 1.0 : 0.75
Behavior on opacity { NumberAnimation { duration: 150 } }
scale: rebootBtn.pressed ? 0.88 : 1.0
Behavior on scale { NumberAnimation { duration: 100 } }
background: Rectangle {
anchors.fill: parent
radius: width / 2
color: rebootBtn.pressed ? Qt.rgba(1, 0.45, 0.0, 0.35) : (rebootBtn.hovered ? Qt.rgba(1, 0.55, 0.0, 0.22) : "transparent")
border.color: "transparent"
border.width: 0
Behavior on color { ColorAnimation { duration: 150 } }
}
onClicked: sddm.reboot()
}
Text {
anchors.horizontalCenter: parent.children[0].horizontalCenter
text: config.TranslateReboot || textConstants.reboot
color: "#ffffff"
font.pointSize: root.font.pointSize * 0.8
font.family: root.font.family
horizontalAlignment: Text.AlignHCenter
opacity: rebootBtn.hovered || rebootBtn.activeFocus ? 1.0 : 0.75
Behavior on opacity { NumberAnimation { duration: 150 } }
}
}
// Shutdown gomb
Column {
spacing: root.font.pointSize * 0.6
RoundButton {
id: shutdownBtn
width: root.font.pointSize * 6
height: root.font.pointSize * 6
activeFocusOnTab: true
Keys.onReturnPressed: sddm.powerOff()
Keys.onEnterPressed: sddm.powerOff()
KeyNavigation.left: rebootBtn
hoverEnabled: true
icon.source: Qt.resolvedUrl("../Assets/Shutdown.svg")
icon.width: root.font.pointSize * 3
icon.height: root.font.pointSize * 3
icon.color: "#ffffff"
opacity: shutdownBtn.hovered || shutdownBtn.activeFocus ? 1.0 : 0.75
Behavior on opacity { NumberAnimation { duration: 150 } }
scale: shutdownBtn.pressed ? 0.88 : 1.0
Behavior on scale { NumberAnimation { duration: 100 } }
background: Rectangle {
anchors.fill: parent
radius: width / 2
color: shutdownBtn.pressed ? Qt.rgba(0.8, 0.1, 0.1, 0.40) : (shutdownBtn.hovered ? Qt.rgba(0.8, 0.1, 0.1, 0.25) : "transparent")
border.color: "transparent"
border.width: 0
Behavior on color { ColorAnimation { duration: 150 } }
}
onClicked: sddm.powerOff()
}
Text {
anchors.horizontalCenter: parent.children[0].horizontalCenter
text: config.TranslateShutdown || textConstants.shutdown
color: "#ffffff"
font.pointSize: root.font.pointSize * 0.8
font.family: root.font.family
horizontalAlignment: Text.AlignHCenter
opacity: shutdownBtn.hovered || shutdownBtn.activeFocus ? 1.0 : 0.75
Behavior on opacity { NumberAnimation { duration: 150 } }
}
}
}
}
Connections {
target: sddm
function onLoginSucceeded() {
}
function onLoginFailed() {
failed = true;
resetError.running ? resetError.stop() && resetError.start() : resetError.start();
}
}
Timer {
id: resetError
interval: 2000
onTriggered: failed = false
running: false
}
}
|