Clean up: Removed import version specifiers, deleted redundant code, and fixed a bug with form positioning and blur.

This commit is contained in:
Keyitdev
2026-07-16 23:53:28 +02:00
parent 07b64f0781
commit ac297db891
8 changed files with 61 additions and 70 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
Column { Column {
id: clock id: clock
+24 -34
View File
@@ -3,9 +3,9 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.15 import QtQuick.Layouts
import QtQuick.Controls 2.15 import QtQuick.Controls
Column { Column {
id: inputContainer id: inputContainer
@@ -19,40 +19,30 @@ Column {
readonly property real passwordFieldTopMargin: (Number(config.PasswordFieldTopMargin) || 0) * rootHeightUnit readonly property real passwordFieldTopMargin: (Number(config.PasswordFieldTopMargin) || 0) * rootHeightUnit
readonly property real loginButtonTopMargin: (Number(config.LoginButtonTopMargin) || 0) * rootHeightUnit readonly property real loginButtonTopMargin: (Number(config.LoginButtonTopMargin) || 0) * rootHeightUnit
function findRegisteredUser(typedUser, matchRealName) {
for (var i = 0; i < userRegistry.list.length; i++) {
var candidate = userRegistry.list[i]
if (typedUser === candidate.name || (matchRealName && typedUser === candidate.realName)) {
return candidate
}
}
return null
}
property url currentUserIcon: { property url currentUserIcon: {
var typedUser = username.text var typedUser = username.text
for (var i = 0; i < userRegistry.list.length; i++) {
var u = userRegistry.list[i]
if (typedUser === "") { if (typedUser === "") {
if (i === selectUser.currentIndex) return u.icon || "" var highlighted = userRegistry.list[selectUser.currentIndex]
} else if (typedUser === u.realName || typedUser === u.name) { return highlighted ? (highlighted.icon || "") : ""
return u.icon || ""
} }
} var match = findRegisteredUser(typedUser, true)
return "" return match ? (match.icon || "") : ""
} }
function triggerLogin() { function triggerLogin() {
var typedUser = username.text var typedUser = username.text
var targetUser = typedUser var match = findRegisteredUser(typedUser, config.UseRealName == "true")
var targetUser = match ? match.name : typedUser
if (config.UseRealName == "true") {
for (var i = 0; i < userRegistry.list.length; i++) {
var u = userRegistry.list[i]
if (typedUser === u.realName || typedUser === u.name) {
targetUser = u.name
break
}
}
} else {
for (var j = 0; j < userRegistry.list.length; j++) {
var u2 = userRegistry.list[j]
if (typedUser === u2.name) {
targetUser = u2.name
break
}
}
}
sddm.login(targetUser, password.text, sessionSelect.selectedSession) sddm.login(targetUser, password.text, sessionSelect.selectedSession)
} }
@@ -415,12 +405,12 @@ Column {
font.bold: true font.bold: true
color: config.PasswordFieldTextColor color: config.PasswordFieldTextColor
focus: config.PasswordFocus == "true" ? true : false focus: config.PasswordFocus == "true"
echoMode: passwordIcon.checked ? TextInput.Normal : TextInput.Password echoMode: passwordIcon.checked ? TextInput.Normal : TextInput.Password
placeholderText: config.TranslatePlaceholderPassword || textConstants.password placeholderText: config.TranslatePlaceholderPassword || textConstants.password
placeholderTextColor: config.PlaceholderTextColor placeholderTextColor: config.PlaceholderTextColor
passwordCharacter: "•" passwordCharacter: "•"
passwordMaskDelay: config.HideCompletePassword == "true" ? undefined : 1000 passwordMaskDelay: config.ShowLastPasswordCharacter == "true" ? 1000 : undefined
renderType: Text.QtRendering renderType: Text.QtRendering
selectByMouse: true selectByMouse: true
@@ -472,7 +462,7 @@ Column {
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: config.HideLoginButton == "true" ? false : true visible: config.ShowLoginButton == "true"
Button { Button {
id: loginButton id: loginButton
@@ -483,7 +473,7 @@ Column {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: config.TranslateLogin || textConstants.login text: config.TranslateLogin || textConstants.login
enabled: config.AllowEmptyPassword == "true" || username.text != "" && password.text != "" ? true : false enabled: config.AllowEmptyPassword == "true" || (username.text != "" && password.text != "")
hoverEnabled: true hoverEnabled: true
contentItem: Text { contentItem: Text {
@@ -572,7 +562,7 @@ Column {
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
KeyNavigation.down: config.HideSystemButtons == "true" ? virtualKeyboard : systemButtons.children[0] KeyNavigation.down: config.ShowSystemButtons == "true" ? systemButtons.children[0] : virtualKeyboard
} }
} }
+3 -4
View File
@@ -3,8 +3,8 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.15 import QtQuick.Layouts
import SddmComponents 2.0 as SDDM import SddmComponents 2.0 as SDDM
Item { Item {
@@ -49,7 +49,7 @@ Item {
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
ProfilePicture { ProfilePicture {
id: profilePicture id: profilePicture
visible: config.ShowProfilePicture == "true" ? true : false visible: config.ShowProfilePicture == "true"
anchors.centerIn: parent anchors.centerIn: parent
width: rootHeightUnit * 11 width: rootHeightUnit * 11
height: rootHeightUnit * 11 height: rootHeightUnit * 11
@@ -87,7 +87,6 @@ Item {
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
SystemButtons { SystemButtons {
id: systemButtons id: systemButtons
exposedSession: input.exposeSession
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
+2 -4
View File
@@ -3,8 +3,8 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
Item { Item {
id: sessionButton id: sessionButton
@@ -13,8 +13,6 @@ Item {
width: parent.width / 2 width: parent.width / 2
property var selectedSession: selectSession.currentIndex property var selectedSession: selectSession.currentIndex
property string textConstantSession
property int loginButtonWidth
property ComboBox exposeSession: selectSession property ComboBox exposeSession: selectSession
ComboBox { ComboBox {
+11 -7
View File
@@ -3,9 +3,9 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.15 import QtQuick.Layouts
import QtQuick.Controls 2.15 import QtQuick.Controls
RowLayout { RowLayout {
spacing: rootFontSize spacing: rootFontSize
@@ -13,7 +13,6 @@ RowLayout {
property var reboot: ["Reboot", config.TranslateReboot || textConstants.reboot, sddm.canReboot] property var reboot: ["Reboot", config.TranslateReboot || textConstants.reboot, sddm.canReboot]
property var suspend: ["Suspend", config.TranslateSuspend || textConstants.suspend, sddm.canSuspend] property var suspend: ["Suspend", config.TranslateSuspend || textConstants.suspend, sddm.canSuspend]
property var hibernate: ["Hibernate", config.TranslateHibernate || textConstants.hibernate, sddm.canHibernate] property var hibernate: ["Hibernate", config.TranslateHibernate || textConstants.hibernate, sddm.canHibernate]
property ComboBox exposedSession
Repeater { Repeater {
id: systemButtons id: systemButtons
@@ -23,7 +22,7 @@ RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
text: modelData[1] text: modelData[1]
font.pixelSize: rootFontSize * 1.06 font.pixelSize: rootFontSize * 1.06
icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg") : "" icon.source: Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg")
icon.height: 2 * Math.round((rootFontSize * 3) / 2) icon.height: 2 * Math.round((rootFontSize * 3) / 2)
icon.width: 2 * Math.round((rootFontSize * 3) / 2) icon.width: 2 * Math.round((rootFontSize * 3) / 2)
icon.color: config.SystemButtonsIconsColor icon.color: config.SystemButtonsIconsColor
@@ -31,7 +30,7 @@ RowLayout {
display: AbstractButton.TextUnderIcon display: AbstractButton.TextUnderIcon
spacing: rootScaleUnit * 6 spacing: rootScaleUnit * 6
padding: rootScaleUnit * 8 padding: rootScaleUnit * 8
visible: config.HideSystemButtons != "true" && (config.BypassSystemButtonsChecks == "true" ? 1 : modelData[2]) visible: config.ShowSystemButtons == "true" && (config.BypassSystemButtonsChecks == "true" || modelData[2])
hoverEnabled: true hoverEnabled: true
background: Rectangle { background: Rectangle {
height: rootScaleUnit * 2 height: rootScaleUnit * 2
@@ -41,7 +40,12 @@ RowLayout {
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
onClicked: { onClicked: {
parent.forceActiveFocus() parent.forceActiveFocus()
index == 0 ? sddm.powerOff() : index == 1 ? sddm.reboot() : index == 2 ? sddm.suspend() : sddm.hibernate() switch (index) {
case 0: sddm.powerOff(); break
case 1: sddm.reboot(); break
case 2: sddm.suspend(); break
default: sddm.hibernate()
}
} }
KeyNavigation.left: index > 0 ? parent.children[index-1] : null KeyNavigation.left: index > 0 ? parent.children[index-1] : null
states: [ states: [
+2 -2
View File
@@ -3,8 +3,8 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.VirtualKeyboard 2.3 import QtQuick.VirtualKeyboard
InputPanel { InputPanel {
id: virtualKeyboard id: virtualKeyboard
+3 -3
View File
@@ -2,8 +2,8 @@
// Copyright (C) 2022-2026 Keyitdev // Copyright (C) 2022-2026 Keyitdev
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
Item { Item {
id: virtualKeyboardButtonRoot id: virtualKeyboardButtonRoot
@@ -18,7 +18,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
z: 1 z: 1
visible: virtualKeyboard.status == Loader.Ready && config.HideVirtualKeyboard == "false" visible: virtualKeyboard.status == Loader.Ready && config.ShowVirtualKeyboard == "true"
checkable: true checkable: true
onClicked: virtualKeyboard.switchState() onClicked: virtualKeyboard.switchState()
+12 -12
View File
@@ -3,8 +3,8 @@
// Based on https://github.com/MarianArlt/sddm-sugar-dark // Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
import QtQuick.Effects import QtQuick.Effects
import QtMultimedia import QtMultimedia
@@ -40,22 +40,22 @@ Pane {
focus: true focus: true
property bool leftleft: config.HaveFormBackground == "true" && property bool leftleft: config.HaveFormBackground == "true" &&
config.PartialBlur == "false" && config.PartialBlur != "true" &&
config.FormPosition == "left" && config.FormPosition == "left" &&
config.BackgroundHorizontalAlignment == "left" config.BackgroundHorizontalAlignment == "left"
property bool leftcenter: config.HaveFormBackground == "true" && property bool leftcenter: config.HaveFormBackground == "true" &&
config.PartialBlur == "false" && config.PartialBlur != "true" &&
config.FormPosition == "left" && config.FormPosition == "left" &&
config.BackgroundHorizontalAlignment == "center" config.BackgroundHorizontalAlignment == "center"
property bool rightright: config.HaveFormBackground == "true" && property bool rightright: config.HaveFormBackground == "true" &&
config.PartialBlur == "false" && config.PartialBlur != "true" &&
config.FormPosition == "right" && config.FormPosition == "right" &&
config.BackgroundHorizontalAlignment == "right" config.BackgroundHorizontalAlignment == "right"
property bool rightcenter: config.HaveFormBackground == "true" && property bool rightcenter: config.HaveFormBackground == "true" &&
config.PartialBlur == "false" && config.PartialBlur != "true" &&
config.FormPosition == "right" && config.FormPosition == "right" &&
config.BackgroundHorizontalAlignment == "center" config.BackgroundHorizontalAlignment == "center"
@@ -85,7 +85,7 @@ Pane {
z: 1 z: 1
color: config.FormBackgroundColor color: config.FormBackgroundColor
visible: config.HaveFormBackground == "true" ? true : false visible: config.HaveFormBackground == "true"
opacity: config.PartialBlur == "true" ? 0.3 : 1 opacity: config.PartialBlur == "true" ? 0.3 : 1
} }
@@ -235,7 +235,7 @@ Pane {
Image.AlignBottom : Image.AlignVCenter Image.AlignBottom : Image.AlignVCenter
speed: config.BackgroundSpeed == "" ? 1.0 : config.BackgroundSpeed speed: config.BackgroundSpeed == "" ? 1.0 : config.BackgroundSpeed
paused: config.PauseBackground == "true" ? 1 : 0 paused: config.PauseBackground == "true"
fillMode: config.CropBackground == "true" ? Image.PreserveAspectCrop : Image.PreserveAspectFit fillMode: config.CropBackground == "true" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
asynchronous: true asynchronous: true
cache: true cache: true
@@ -251,7 +251,7 @@ Pane {
player.play(); player.play();
} }
else{ else{
backgroundImage.source = config.background || config.Background backgroundImage.source = config.Background
} }
} }
} }
@@ -270,7 +270,7 @@ Pane {
sourceItem: backgroundImage sourceItem: backgroundImage
sourceRect: Qt.rect(x,y,width,height) sourceRect: Qt.rect(x,y,width,height)
visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false visible: config.FullBlur == "true" || config.PartialBlur == "true"
} }
MultiEffect { MultiEffect {
@@ -282,7 +282,7 @@ Pane {
// anchors.centerIn: config.FullBlur == "true" ? parent : form // anchors.centerIn: config.FullBlur == "true" ? parent : form
// This solves problem when FullBlur and HaveFormBackground is set to true but PartialBlur is false and FormPosition isn't center. // This solves problem when FullBlur and HaveFormBackground is set to true but PartialBlur is false and FormPosition isn't center.
width: (config.FullBlur == "true" && config.PartialBlur == "false" && config.FormPosition != "center" ) ? parent.width - formBackground.width : config.FullBlur == "true" ? parent.width : form.width width: config.FullBlur == "true" ? (config.HaveFormBackground == "true" && config.PartialBlur != "true" && config.FormPosition != "center" ? parent.width - formBackground.width : parent.width) : form.width
anchors.centerIn: config.FullBlur == "true" ? backgroundImage : form anchors.centerIn: config.FullBlur == "true" ? backgroundImage : form
source: config.FullBlur == "true" ? backgroundImage : blurMask source: config.FullBlur == "true" ? backgroundImage : blurMask
@@ -296,7 +296,7 @@ Pane {
blurMax: config.BlurMax !== "" ? parseInt(config.BlurMax, 10) : 48 blurMax: config.BlurMax !== "" ? parseInt(config.BlurMax, 10) : 48
blurMultiplier: Math.max(0.0, scaledBlur - 1.0) blurMultiplier: Math.max(0.0, scaledBlur - 1.0)
visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false visible: config.FullBlur == "true" || config.PartialBlur == "true"
} }
} }
} }