first commit
This commit is contained in:
60
Components/Clock.qml
Normal file
60
Components/Clock.qml
Normal file
@@ -0,0 +1,60 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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.Controls 2.15
|
||||
|
||||
Column {
|
||||
id: clock
|
||||
spacing: 0
|
||||
width: parent.width / 2
|
||||
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
font.pointSize: config.HeaderText !=="" ? root.font.pointSize * 3 : 0
|
||||
color: root.palette.text
|
||||
renderType: Text.QtRendering
|
||||
text: config.HeaderText
|
||||
}
|
||||
|
||||
Label {
|
||||
id: timeLabel
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
font.pointSize: root.font.pointSize * 9
|
||||
font.bold: true
|
||||
color: root.palette.text
|
||||
renderType: Text.QtRendering
|
||||
function updateTime() {
|
||||
text = new Date().toLocaleTimeString(Qt.locale(config.Locale), config.HourFormat == "long" ? Locale.LongFormat : config.HourFormat !== "" ? config.HourFormat : Locale.ShortFormat)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: dateLabel
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: root.palette.text
|
||||
font.pointSize: root.font.pointSize * 2
|
||||
font.bold: true
|
||||
renderType: Text.QtRendering
|
||||
function updateTime() {
|
||||
text = new Date().toLocaleDateString(Qt.locale(config.Locale), config.DateFormat == "short" ? Locale.ShortFormat : config.DateFormat !== "" ? config.DateFormat : Locale.LongFormat)
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: {
|
||||
dateLabel.updateTime()
|
||||
timeLabel.updateTime()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
dateLabel.updateTime()
|
||||
timeLabel.updateTime()
|
||||
}
|
||||
}
|
509
Components/Input.qml
Normal file
509
Components/Input.qml
Normal file
@@ -0,0 +1,509 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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 Qt5Compat.GraphicalEffects
|
||||
|
||||
Column {
|
||||
id: inputContainer
|
||||
Layout.fillWidth: true
|
||||
|
||||
property Control exposeSession: sessionSelect.exposeSession
|
||||
property bool failed
|
||||
|
||||
Item {
|
||||
// change also in selectSession
|
||||
height: root.font.pointSize * 2
|
||||
width: parent.width / 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
Label {
|
||||
id: errorMessage
|
||||
width: parent.width
|
||||
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : null
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pointSize: root.font.pointSize * 0.8
|
||||
font.italic: true
|
||||
color: root.palette.text
|
||||
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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: usernameField
|
||||
|
||||
height: root.font.pointSize * 4.5
|
||||
width: parent.width / 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
ComboBox {
|
||||
|
||||
id: selectUser
|
||||
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
|
||||
property var popkey: config.ForceRightToLeft == "true" ? Qt.Key_Right : Qt.Key_Left
|
||||
Keys.onPressed: {
|
||||
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
|
||||
z: 2
|
||||
|
||||
model: userModel
|
||||
currentIndex: model.lastIndex
|
||||
textRole: "name"
|
||||
hoverEnabled: true
|
||||
onActivated: {
|
||||
username.text = currentText
|
||||
}
|
||||
|
||||
delegate: ItemDelegate {
|
||||
width: parent.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
contentItem: Text {
|
||||
text: model.name
|
||||
font.pointSize: root.font.pointSize * 0.8
|
||||
font.capitalization: Font.AllLowercase
|
||||
color: selectUser.highlightedIndex === index ? root.palette.highlight.hslLightness >= 0.7 ? "#444" : "white" : root.palette.window.hslLightness >= 0.8 ? root.palette.highlight.hslLightness >= 0.8 ? "#444" : root.palette.highlight : "white"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
highlighted: parent.highlightedIndex === index
|
||||
background: Rectangle {
|
||||
color: selectUser.highlightedIndex === index ? root.palette.highlight : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
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: root.palette.text
|
||||
icon.source: Qt.resolvedUrl("../Assets/User.svg")
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
border.color: "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
border.color: "transparent"
|
||||
}
|
||||
|
||||
popup: Popup {
|
||||
y: parent.height - username.height / 3
|
||||
x: config.ForceRightToLeft == "true" ? -loginButton.width + selectUser.width : 0
|
||||
rightMargin: config.ForceRightToLeft == "true" ? root.padding + usernameField.width / 2 : undefined
|
||||
width: usernameField.width
|
||||
implicitHeight: contentItem.implicitHeight
|
||||
padding: 10
|
||||
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight + 20
|
||||
model: selectUser.popup.visible ? selectUser.delegateModel : null
|
||||
currentIndex: selectUser.highlightedIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
radius: config.RoundCorners / 2
|
||||
color: root.palette.window
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 10 * config.InterfaceShadowSize
|
||||
radius: 20 * config.InterfaceShadowSize
|
||||
samples: 41 * config.InterfaceShadowSize
|
||||
cached: true
|
||||
color: Qt.hsla(0,0,0,config.InterfaceShadowOpacity)
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "pressed"
|
||||
when: selectUser.down
|
||||
PropertyChanges {
|
||||
target: usernameIcon
|
||||
icon.color: Qt.lighter(root.palette.highlight, 1.1)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: selectUser.hovered
|
||||
PropertyChanges {
|
||||
target: usernameIcon
|
||||
icon.color: Qt.lighter(root.palette.highlight, 1.2)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "focused"
|
||||
when: selectUser.activeFocus
|
||||
PropertyChanges {
|
||||
target: usernameIcon
|
||||
icon.color: root.palette.highlight
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "color, border.color, icon.color"
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
text: config.ForceLastUser == "true" ? selectUser.currentText : null
|
||||
font.bold: true
|
||||
font.capitalization: config.AllowBadUsernames == "false" ? Font.AllLowercase : Font.MixedCase
|
||||
anchors.centerIn: parent
|
||||
height: root.font.pointSize * 3
|
||||
width: parent.width
|
||||
placeholderText: config.TranslatePlaceholderUsername || textConstants.userName
|
||||
placeholderTextColor: config.placeholderColor
|
||||
selectByMouse: true
|
||||
horizontalAlignment: TextInput.AlignHCenter
|
||||
renderType: Text.QtRendering
|
||||
onFocusChanged:{
|
||||
if(focus)
|
||||
selectAll()
|
||||
}
|
||||
background: Rectangle {
|
||||
color: "#222222"
|
||||
opacity: 0.2
|
||||
border.color: "transparent"
|
||||
border.width: parent.activeFocus ? 2 : 1
|
||||
radius: config.RoundCorners || 0
|
||||
}
|
||||
onAccepted: config.AllowBadUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
|
||||
KeyNavigation.down: showPassword
|
||||
z: 1
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "focused"
|
||||
when: username.activeFocus
|
||||
PropertyChanges {
|
||||
target: username.background
|
||||
border.color: root.palette.highlight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: username
|
||||
color: root.palette.highlightedText
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: passwordField
|
||||
|
||||
height: root.font.pointSize * 4.5
|
||||
width: parent.width / 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Button {
|
||||
id: showPassword
|
||||
z: 2
|
||||
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
|
||||
icon.color: root.palette.text
|
||||
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
border.color: "transparent"
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "visiblePasswordFocused"
|
||||
when: showPassword.checked && showPassword.activeFocus
|
||||
PropertyChanges {
|
||||
target: showPassword
|
||||
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
|
||||
icon.color: root.palette.highlight
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "visiblePasswordHovered"
|
||||
when: showPassword.checked && showPassword.hovered
|
||||
PropertyChanges {
|
||||
target: showPassword
|
||||
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
|
||||
icon.color: root.palette.highlight
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "visiblePassword"
|
||||
when: showPassword.checked
|
||||
PropertyChanges {
|
||||
target: showPassword
|
||||
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hiddenPasswordFocused"
|
||||
when: showPassword.enabled && showPassword.activeFocus
|
||||
PropertyChanges {
|
||||
target: showPassword
|
||||
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
|
||||
icon.color: root.palette.highlight
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hiddenPasswordHovered"
|
||||
when: showPassword.hovered
|
||||
PropertyChanges {
|
||||
target: showPassword
|
||||
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
|
||||
icon.color: root.palette.highlight
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
onClicked: toggle()
|
||||
Keys.onReturnPressed: toggle()
|
||||
Keys.onEnterPressed: toggle()
|
||||
KeyNavigation.down: password
|
||||
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
anchors.centerIn: parent
|
||||
height: root.font.pointSize * 3
|
||||
width: parent.width
|
||||
font.bold: true
|
||||
focus: config.ForcePasswordFocus == "true" ? true : false
|
||||
selectByMouse: true
|
||||
echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
|
||||
placeholderText: config.TranslatePlaceholderPassword || textConstants.password
|
||||
placeholderTextColor: config.placeholderColor
|
||||
horizontalAlignment: TextInput.AlignHCenter
|
||||
passwordCharacter: "•"
|
||||
passwordMaskDelay: config.ForceHideCompletePassword == "true" ? undefined : 1000
|
||||
renderType: Text.QtRendering
|
||||
background: Rectangle {
|
||||
color: "#222222"
|
||||
opacity: 0.2
|
||||
border.color: "transparent"
|
||||
border.width: parent.activeFocus ? 2 : 1
|
||||
radius: config.RoundCorners || 0
|
||||
}
|
||||
onAccepted: config.AllowBadUsernames == "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.background
|
||||
border.color: root.palette.highlight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: password
|
||||
color: root.palette.highlightedText
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "color, border.color"
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Item {
|
||||
id: login
|
||||
// important
|
||||
height: root.font.pointSize * 9
|
||||
width: parent.width / 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: config.HideLoginButton == "true" ? false : true
|
||||
Button {
|
||||
|
||||
id: loginButton
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: config.TranslateLogin || textConstants.login
|
||||
height: root.font.pointSize * 3
|
||||
implicitWidth: parent.width
|
||||
enabled: config.AllowEmptyPassword == "true" || username.text != "" && password.text != "" ? true : false
|
||||
hoverEnabled: true
|
||||
|
||||
contentItem: Text {
|
||||
text: parent.text
|
||||
color: config.OverrideLoginButtonTextColor != "" ? config.OverrideLoginButtonTextColor : root.palette.highlight.hslLightness >= 0.7 ? "#444" : "white"
|
||||
font.pointSize: root.font.pointSize
|
||||
font.family: root.font.family
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
opacity: 0.5
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: buttonBackground
|
||||
color: "white"
|
||||
opacity: 0.2
|
||||
radius: config.RoundCorners || 0
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "pressed"
|
||||
when: loginButton.down
|
||||
PropertyChanges {
|
||||
target: buttonBackground
|
||||
color: Qt.darker(root.palette.highlight, 1.1)
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: loginButton.contentItem
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: loginButton.hovered
|
||||
PropertyChanges {
|
||||
target: buttonBackground
|
||||
color: Qt.lighter(root.palette.highlight, 1.15)
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: loginButton.contentItem
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "focused"
|
||||
when: loginButton.activeFocus
|
||||
PropertyChanges {
|
||||
target: buttonBackground
|
||||
color: Qt.lighter(root.palette.highlight, 1.2)
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: loginButton.contentItem
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "enabled"
|
||||
when: loginButton.enabled
|
||||
PropertyChanges {
|
||||
target: buttonBackground;
|
||||
color: root.palette.highlight;
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: loginButton.contentItem;
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "opacity, color";
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
]
|
||||
onClicked: config.AllowBadUsernames == "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: sessionSelect.exposeSession
|
||||
}
|
||||
}
|
||||
|
||||
SessionButton {
|
||||
id: sessionSelect
|
||||
loginButtonWidth: loginButton.background.width
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: sddm
|
||||
onLoginSucceeded: {}
|
||||
onLoginFailed: {
|
||||
failed = true
|
||||
resetError.running ? resetError.stop() && resetError.start() : resetError.start()
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: resetError
|
||||
interval: 2000
|
||||
onTriggered: failed = false
|
||||
running: false
|
||||
}
|
||||
}
|
45
Components/LoginForm.qml
Normal file
45
Components/LoginForm.qml
Normal file
@@ -0,0 +1,45 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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 SddmComponents 2.0 as SDDM
|
||||
|
||||
ColumnLayout {
|
||||
id: formContainer
|
||||
SDDM.TextConstants { id: textConstants }
|
||||
|
||||
property int p: config.ScreenPadding
|
||||
property string a: config.FormPosition
|
||||
property alias systemButtonVisibility: systemButtons.visible
|
||||
property alias clockVisibility: clock.visible
|
||||
property bool virtualKeyboardActive
|
||||
|
||||
Clock {
|
||||
id: clock
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||
// important
|
||||
Layout.preferredHeight: root.height / 3
|
||||
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
|
||||
}
|
||||
|
||||
Input {
|
||||
id: input
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: root.height / 10
|
||||
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
|
||||
Layout.topMargin: virtualKeyboardActive ? -height * 1.5 : 0
|
||||
}
|
||||
|
||||
SystemButtons {
|
||||
id: systemButtons
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||
Layout.preferredHeight: root.height / 4
|
||||
Layout.maximumHeight: root.height / 4
|
||||
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
|
||||
exposedSession: input.exposeSession
|
||||
}
|
||||
|
||||
}
|
178
Components/SessionButton.qml
Normal file
178
Components/SessionButton.qml
Normal file
@@ -0,0 +1,178 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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.Controls 2.15
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
Item {
|
||||
id: sessionButton
|
||||
height: root.font.pointSize
|
||||
width: parent.width / 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
property var selectedSession: selectSession.currentIndex
|
||||
property string textConstantSession
|
||||
property int loginButtonWidth
|
||||
property Control exposeSession: selectSession
|
||||
|
||||
ComboBox {
|
||||
id: selectSession
|
||||
// important
|
||||
// change also in errorMessage
|
||||
height: root.font.pointSize * 2
|
||||
hoverEnabled: true
|
||||
anchors.left: parent.left
|
||||
Keys.onPressed: {
|
||||
if (event.key == Qt.Key_Up && loginButton.state != "enabled" && !popup.opened)
|
||||
revealSecret.focus = true,
|
||||
revealSecret.state = "focused",
|
||||
currentIndex = currentIndex + 1;
|
||||
if (event.key == Qt.Key_Up && loginButton.state == "enabled" && !popup.opened)
|
||||
loginButton.focus = true,
|
||||
loginButton.state = "focused",
|
||||
currentIndex = currentIndex + 1;
|
||||
if (event.key == Qt.Key_Down && !popup.opened)
|
||||
systemButtons.children[0].focus = true,
|
||||
systemButtons.children[0].state = "focused",
|
||||
currentIndex = currentIndex - 1;
|
||||
if ((event.key == Qt.Key_Left || event.key == Qt.Key_Right) && !popup.opened)
|
||||
popup.open();
|
||||
}
|
||||
|
||||
model: sessionModel
|
||||
currentIndex: model.lastIndex
|
||||
textRole: "name"
|
||||
|
||||
delegate: ItemDelegate {
|
||||
width: parent.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
contentItem: Text {
|
||||
text: model.name
|
||||
font.pointSize: root.font.pointSize * 0.8
|
||||
font.family: root.font.family
|
||||
color: selectSession.highlightedIndex === index ? root.palette.highlight.hslLightness >= 0.7 ? "#444444" : "white" : root.palette.window.hslLightness >= 0.8 ? root.palette.highlight.hslLightness >= 0.8 ? "#444444" : root.palette.highlight : "white"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
highlighted: parent.highlightedIndex === index
|
||||
background: Rectangle {
|
||||
color: selectSession.highlightedIndex === index ? root.palette.highlight : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
indicator {
|
||||
visible: false
|
||||
}
|
||||
|
||||
contentItem: Text {
|
||||
id: displayedItem
|
||||
text: selectSession.currentText
|
||||
color: root.palette.text
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 3
|
||||
font.pointSize: root.font.pointSize * 0.8
|
||||
font.family: root.font.family
|
||||
Keys.onReleased: parent.popup.open()
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
border.width: parent.visualFocus ? 1 : 0
|
||||
border.color: "transparent"
|
||||
height: parent.visualFocus ? 2 : 0
|
||||
width: displayedItem.implicitWidth
|
||||
anchors.top: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 3
|
||||
}
|
||||
|
||||
popup: Popup {
|
||||
id: popupHandler
|
||||
y: parent.height - 1
|
||||
x: config.ForceRightToLeft == "true" ? -loginButtonWidth + displayedItem.width : 0
|
||||
width: sessionButton.width
|
||||
implicitHeight: contentItem.implicitHeight
|
||||
padding: 10
|
||||
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight + 20
|
||||
model: selectSession.popup.visible ? selectSession.delegateModel : null
|
||||
currentIndex: selectSession.highlightedIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
radius: config.RoundCorners / 2
|
||||
color: config.BackgroundColor
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
radius: 20 * config.InterfaceShadowSize
|
||||
samples: 41 * config.InterfaceShadowSize
|
||||
cached: true
|
||||
color: Qt.hsla(0,0,0,config.InterfaceShadowOpacity)
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "pressed"
|
||||
when: selectSession.down
|
||||
PropertyChanges {
|
||||
target: displayedItem
|
||||
color: Qt.darker(root.palette.highlight, 1.1)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: selectSession.background
|
||||
border.color: Qt.darker(root.palette.highlight, 1.1)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: selectSession.hovered
|
||||
PropertyChanges {
|
||||
target: displayedItem
|
||||
color: Qt.lighter(root.palette.highlight, 1.1)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: selectSession.background
|
||||
border.color: Qt.lighter(root.palette.highlight, 1.1)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "focused"
|
||||
when: selectSession.visualFocus
|
||||
PropertyChanges {
|
||||
target: displayedItem
|
||||
color: root.palette.highlight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: selectSession.background
|
||||
border.color: root.palette.highlight
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "color, border.color"
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
112
Components/SystemButtons.qml
Normal file
112
Components/SystemButtons.qml
Normal file
@@ -0,0 +1,112 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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
|
||||
|
||||
RowLayout {
|
||||
|
||||
spacing: root.font.pointSize
|
||||
|
||||
property var suspend: ["Suspend", config.TranslateSuspend || textConstants.suspend, sddm.canSuspend]
|
||||
property var hibernate: ["Hibernate", config.TranslateHibernate || textConstants.hibernate, sddm.canHibernate]
|
||||
property var reboot: ["Reboot", config.TranslateReboot || textConstants.reboot, sddm.canReboot]
|
||||
property var shutdown: ["Shutdown", config.TranslateShutdown || textConstants.shutdown, sddm.canPowerOff]
|
||||
|
||||
property Control exposedSession
|
||||
|
||||
Repeater {
|
||||
|
||||
id: systemButtons
|
||||
model: [suspend, hibernate, reboot, shutdown]
|
||||
|
||||
RoundButton {
|
||||
text: modelData[1]
|
||||
font.pointSize: root.font.pointSize * 0.8
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg") : ""
|
||||
icon.height: 2 * Math.round((root.font.pointSize * 3) / 2)
|
||||
icon.width: 2 * Math.round((root.font.pointSize * 3) / 2)
|
||||
icon.color: config.IconColor
|
||||
display: AbstractButton.TextUnderIcon
|
||||
visible: config.ForceHideSystemButtons != "true" && modelData[2]
|
||||
hoverEnabled: true
|
||||
palette.buttonText: root.palette.text
|
||||
background: Rectangle {
|
||||
height: 2
|
||||
color: "transparent"
|
||||
width: parent.width
|
||||
border.width: parent.activeFocus ? 1 : 0
|
||||
border.color: "transparent"
|
||||
anchors.top: parent.bottom
|
||||
}
|
||||
Keys.onReturnPressed: clicked()
|
||||
onClicked: {
|
||||
parent.forceActiveFocus()
|
||||
index == 0 ? sddm.suspend() : index == 1 ? sddm.hibernate() : index == 2 ? sddm.reboot() : sddm.powerOff()
|
||||
}
|
||||
KeyNavigation.up: exposedSession
|
||||
KeyNavigation.left: parent.children[index-1]
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "pressed"
|
||||
when: parent.children[index].down
|
||||
PropertyChanges {
|
||||
target: parent.children[index]
|
||||
icon.color: root.palette.highlight
|
||||
palette.buttonText: Qt.darker(root.palette.highlight, 1.1)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: parent.children[index].background
|
||||
icon.color: root.palette.highlight
|
||||
border.color: Qt.darker(root.palette.highlight, 1.1)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: parent.children[index].hovered
|
||||
PropertyChanges {
|
||||
target: parent.children[index]
|
||||
icon.color: root.palette.highlight
|
||||
palette.buttonText: Qt.lighter(root.palette.highlight, 1.1)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: parent.children[index].background
|
||||
icon.color: root.palette.highlight
|
||||
border.color: Qt.lighter(root.palette.highlight, 1.1)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "focused"
|
||||
when: parent.children[index].activeFocus
|
||||
PropertyChanges {
|
||||
target: parent.children[index]
|
||||
icon.color: root.palette.highlight
|
||||
palette.buttonText: root.palette.highlight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: parent.children[index].background
|
||||
icon.color: root.palette.highlight
|
||||
border.color: root.palette.highlight
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "palette.buttonText, border.color"
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
183
Components/UserList.qml
Normal file
183
Components/UserList.qml
Normal file
@@ -0,0 +1,183 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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.Controls 2.15
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
Item {
|
||||
id: usernameField
|
||||
|
||||
height: root.font.pointSize * 4.5
|
||||
width: parent.width / 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
property var selectedUser: selectUser.currentIndex
|
||||
property alias user: username.text
|
||||
|
||||
ComboBox {
|
||||
|
||||
id: selectUser
|
||||
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
z: 2
|
||||
|
||||
model: userModel
|
||||
currentIndex: model.lastIndex
|
||||
textRole: "name"
|
||||
hoverEnabled: true
|
||||
onActivated: {
|
||||
username.text = currentText
|
||||
}
|
||||
|
||||
delegate: ItemDelegate {
|
||||
width: parent.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
contentItem: Text {
|
||||
text: model.name
|
||||
font.pointSize: root.font.pointSize * 0.8
|
||||
font.capitalization: Font.Capitalize
|
||||
color: selectUser.highlightedIndex === index ? "white" : root.palette.window.hslLightness >= 0.8 ? root.palette.highlight : "white"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
highlighted: parent.highlightedIndex === index
|
||||
background: Rectangle {
|
||||
color: selectUser.highlightedIndex === index ? root.palette.highlight : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
indicator: Button {
|
||||
id: usernameIcon
|
||||
width: selectUser.height * 0.8
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: selectUser.height * 0.125
|
||||
icon.height: parent.height * 0.25
|
||||
icon.width: parent.height * 0.25
|
||||
enabled: false
|
||||
icon.color: root.palette.text
|
||||
icon.source: Qt.resolvedUrl("../Assets/User.svg")
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
border.color: "transparent"
|
||||
}
|
||||
|
||||
popup: Popup {
|
||||
y: parent.height - username.height / 3
|
||||
rightMargin: config.ForceRightToLeft == "true" ? usernameField.width / 2 : undefined
|
||||
width: usernameField.width
|
||||
implicitHeight: contentItem.implicitHeight
|
||||
padding: 10
|
||||
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight + 20
|
||||
model: selectUser.popup.visible ? selectUser.delegateModel : null
|
||||
currentIndex: selectUser.highlightedIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
radius: 10
|
||||
color: root.palette.window
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
radius: 100
|
||||
samples: 201
|
||||
cached: true
|
||||
color: "#88000000"
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "pressed"
|
||||
when: selectUser.down
|
||||
PropertyChanges {
|
||||
target: usernameIcon
|
||||
icon.color: Qt.lighter(root.palette.highlight, 1.1)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: selectUser.hovered
|
||||
PropertyChanges {
|
||||
target: usernameIcon
|
||||
icon.color: Qt.lighter(root.palette.highlight, 1.2)
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "focused"
|
||||
when: selectUser.visualFocus
|
||||
PropertyChanges {
|
||||
target: usernameIcon
|
||||
icon.color: root.palette.highlight
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "color, border.color, icon.color"
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
text: config.ForceLastUser == "true" ? selectUser.currentText : null
|
||||
font.capitalization: Font.Capitalize
|
||||
anchors.centerIn: parent
|
||||
height: root.font.pointSize * 3
|
||||
width: parent.width
|
||||
placeholderText: config.TranslateUsernamePlaceholder || textConstants.userName
|
||||
selectByMouse: true
|
||||
horizontalAlignment: TextInput.AlignHCenter
|
||||
renderType: Text.QtRendering
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
border.color: root.palette.text
|
||||
border.width: parent.activeFocus ? 2 : 1
|
||||
radius: config.RoundCorners || 0
|
||||
}
|
||||
Keys.onReturnPressed: loginButton.clicked()
|
||||
KeyNavigation.down: password
|
||||
z: 1
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "focused"
|
||||
when: username.activeFocus
|
||||
PropertyChanges {
|
||||
target: username.background
|
||||
border.color: root.palette.highlight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: username
|
||||
color: root.palette.highlight
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
14
Components/VirtualKeyboard.qml
Normal file
14
Components/VirtualKeyboard.qml
Normal file
@@ -0,0 +1,14 @@
|
||||
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
||||
// Copyright (C) 2022-2024 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.VirtualKeyboard 2.3
|
||||
|
||||
InputPanel {
|
||||
id: virtualKeyboard
|
||||
property bool activated: false
|
||||
active: activated && Qt.inputMethod.visible
|
||||
visible: active
|
||||
}
|
Reference in New Issue
Block a user