Initial Commit

This commit is contained in:
2024-11-29 07:56:21 +01:00
parent 554b648e64
commit 520091ac6d
224 changed files with 2895 additions and 0 deletions

View File

@@ -0,0 +1,132 @@
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
Item {
property var user: userField.text
property var password: passwordField.text
property var session: sessionPanel.session
property var inputHeight: Screen.height * 0.032
property var inputWidth: Screen.width * 0.16
Rectangle {
id: loginBackground
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCeneter
}
height: inputHeight * 5.3
width: inputWidth * 1.2
radius: 5
visible: config.LoginBackground == "true" ? true : false
color: config.mantle
}
Column {
spacing: 8
z:5
width: inputWidth
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
}
UserField {
id: userField
height: inputHeight
width: parent.width
}
PasswordField {
id: passwordField
height: inputHeight
width: parent.width
onAccepted: loginButton.clicked()
}
Button { id: loginButton
height: inputHeight
width: parent.width
enabled: user != "" && password != "" ? true : false
hoverEnabled: true
contentItem: Text {
id: buttonText
renderType: Text.NativeRendering
font {
family: config.Font
pointSize: config.FontSize
bold: true
}
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: config.crust
text: "Login"
}
background: Rectangle {
id: buttonBackground
color: config.sapphire
radius: 3
}
states: [
State {
name: "pressed"
when: loginButton.down
PropertyChanges {
target: buttonBackground
color: config.teal
}
PropertyChanges {
target: buttonText
}
},
State {
name: "hovered"
when: loginButton.hovered
PropertyChanges {
target: buttonBackground
color: config.teal
}
},
State {
name: "enabled"
when: loginButton.enabled
PropertyChanges {
target: buttonBackground
}
PropertyChanges {
target: buttonText
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 300
}
}
onClicked: {
sddm.login(user, password, session)
}
}
Row {
width: parent.width
spacing: (parent.width - 4 * inputHeight)/3
SessionPanel {
id: sessionPanel
}
PowerButton {
id: powerButton
}
RebootButton {
id: rebootButton
}
SleepButton {
id: sleepButton
}
}
}
Connections {
target: sddm
function onLoginFailed() {
passwordField.text = ""
passwordField.focus = true
}
}
}

View File

@@ -0,0 +1,48 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
TextField {
id: passwordField
focus: true
selectByMouse: true
placeholderText: "Password"
echoMode: TextInput.Password
passwordCharacter: ""
passwordMaskDelay: 0
selectionColor: config.overlay0
renderType: Text.NativeRendering
font.family: config.Font
font.pointSize: config.FontSize
font.bold: true
color: config.text
horizontalAlignment: TextInput.AlignHCenter
background: Rectangle {
id: passFieldBackground
radius: 3
color: config.surface0
}
states: [
State {
name: "focused"
when: passwordField.activeFocus
PropertyChanges {
target: passFieldBackground
color: config.surface1
}
},
State {
name: "hovered"
when: passwordField.hovered
PropertyChanges {
target: passFieldBackground
color: config.surface1
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 300
}
}
}

View File

@@ -0,0 +1,41 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
Item {
implicitHeight: powerButton.height
implicitWidth: powerButton.width
Button {
id: powerButton
height: inputHeight
width: inputHeight
hoverEnabled: true
icon {
source: Qt.resolvedUrl("../icons/power.svg")
height: height
width: width
color: config.crust
}
background: Rectangle {
id: powerButtonBackground
radius: 3
color: config.red
}
states: [
State {
name: "hovered"
when: powerButton.hovered
PropertyChanges {
target: powerButtonBackground
color: config.rosewater
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 300
}
}
onClicked: sddm.powerOff()
}
}

View File

@@ -0,0 +1,41 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
Item {
implicitHeight: rebootButton.height
implicitWidth: rebootButton.width
Button {
id: rebootButton
height: inputHeight
width: inputHeight
hoverEnabled: true
icon {
source: Qt.resolvedUrl("../icons/reboot.svg")
height: height
width: width
color: config.crust
}
background: Rectangle {
id: rebootButtonBackground
radius: 3
color: config.red
}
states: [
State {
name: "hovered"
when: rebootButton.hovered
PropertyChanges {
target: rebootButtonBackground
color: config.rosewater
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 300
}
}
onClicked: sddm.reboot()
}
}

View File

@@ -0,0 +1,156 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQml.Models 2.15
Item {
property var session: sessionList.currentIndex
implicitHeight: sessionButton.height
implicitWidth: sessionButton.width
DelegateModel {
id: sessionWrapper
model: sessionModel
delegate: ItemDelegate {
id: sessionEntry
height: inputHeight
width: parent.width
highlighted: sessionList.currentIndex == index
contentItem: Text {
renderType: Text.NativeRendering
font.family: config.Font
font.pointSize: config.FontSize
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: config.text
text: name
}
background: Rectangle {
id: sessionEntryBackground
color: config.surface1
radius: 3
}
states: [
State {
name: "hovered"
when: sessionEntry.hovered
PropertyChanges {
target: sessionEntryBackground
color: config.surface2
}
}
]
transitions: Transition {
PropertyAnimation {
property: "color"
duration: 300
}
}
MouseArea {
anchors.fill: parent
onClicked: {
sessionList.currentIndex = index
sessionPopup.close()
}
}
}
}
Button {
id: sessionButton
height: inputHeight
width: inputHeight
hoverEnabled: true
icon {
source: Qt.resolvedUrl("../icons/settings.svg")
height: height
width: width
color: config.crust
}
background: Rectangle {
id: sessionButtonBackground
color: config.red
radius: 3
}
states: [
State {
name: "pressed"
when: sessionButton.down
PropertyChanges {
target: sessionButtonBackground
color: config.rosewater
}
},
State {
name: "hovered"
when: sessionButton.hovered
PropertyChanges {
target: sessionButtonBackground
color: config.rosewater
}
},
State {
name: "selection"
when: sessionPopup.visible
PropertyChanges {
target: sessionButtonBackground
color: config.rosewater
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 150
}
}
onClicked: {
sessionPopup.visible ? sessionPopup.close() : sessionPopup.open()
sessionButton.state = "pressed"
}
}
Popup {
id: sessionPopup
width: inputWidth + padding * 2
x: (sessionButton.width + sessionList.spacing) * -7.6
y: -(contentHeight + padding * 2) + sessionButton.height
padding: inputHeight / 10
background: Rectangle {
radius: 5.4
color: config.surface0
}
contentItem: ListView {
id: sessionList
implicitHeight: contentHeight
spacing: 8
model: sessionWrapper
currentIndex: sessionModel.lastIndex
clip: true
}
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 400
easing.type: Easing.OutExpo
}
NumberAnimation {
property: "x"
from: sessionPopup.x + (inputWidth * 0.1)
to: sessionPopup.x
duration: 500
easing.type: Easing.OutExpo
}
}
}
exit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: 300
easing.type: Easing.OutExpo
}
}
}
}

View File

@@ -0,0 +1,41 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
Item {
implicitHeight: sleepButton.height
implicitWidth: sleepButton.width
Button {
id: sleepButton
height: inputHeight
width: inputHeight
hoverEnabled: true
icon {
source: Qt.resolvedUrl("../icons/sleep.svg")
height: height
width: width
color: config.crust
}
background: Rectangle {
id: sleepButtonBg
color: config.red
radius: 3
}
states: [
State {
name: "hovered"
when: sleepButton.hovered
PropertyChanges {
target: sleepButtonBg
color: config.rosewater
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 300
}
}
onClicked: sddm.suspend()
}
}

View File

@@ -0,0 +1,50 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
TextField {
id: userField
height: inputHeight
width: inputWidth
selectByMouse: true
echoMode: TextInput.Normal
selectionColor:config.overlay0
renderType: Text.NativeRendering
font {
family: config.Font
pointSize: config.FontSize
bold: true
}
color: config.text
horizontalAlignment: Text.AlignHCenter
placeholderText: "Username"
text: userModel.lastUser
background: Rectangle {
id: userFieldBackground
color: config.surface0
radius: 3
}
states: [
State {
name: "focused"
when: userField.activeFocus
PropertyChanges {
target: UserFieldBackground
color: config.surface1
}
},
State {
name: "hovered"
when: userField.activeFocus
PropertyChanges {
target: UserFieldBackground
color: config.surface1
}
}
]
transitions: Transition {
PropertyAnimation {
properties: "color"
duration: 300
}
}
}