diff --git a/Components/Clock.qml b/Components/Clock.qml index 4003ecd..faefe0e 100644 --- a/Components/Clock.qml +++ b/Components/Clock.qml @@ -3,8 +3,8 @@ // 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 QtQuick +import QtQuick.Controls Column { id: clock @@ -13,7 +13,7 @@ Column { spacing: 0 Label { - id:headerTextLabel + id: headerTextLabel anchors.horizontalCenter: parent.horizontalCenter diff --git a/Components/Input.qml b/Components/Input.qml index e77775f..55a4f99 100644 --- a/Components/Input.qml +++ b/Components/Input.qml @@ -3,9 +3,9 @@ // 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 +import QtQuick.Layouts +import QtQuick.Controls Column { id: inputContainer @@ -19,40 +19,30 @@ Column { readonly property real passwordFieldTopMargin: (Number(config.PasswordFieldTopMargin) || 0) * rootHeightUnit readonly property real loginButtonTopMargin: (Number(config.LoginButtonTopMargin) || 0) * rootHeightUnit - property url currentUserIcon: { - var typedUser = username.text + function findRegisteredUser(typedUser, matchRealName) { for (var i = 0; i < userRegistry.list.length; i++) { - var u = userRegistry.list[i] - if (typedUser === "") { - if (i === selectUser.currentIndex) return u.icon || "" - } else if (typedUser === u.realName || typedUser === u.name) { - return u.icon || "" + var candidate = userRegistry.list[i] + if (typedUser === candidate.name || (matchRealName && typedUser === candidate.realName)) { + return candidate } } - return "" + return null + } + + property url currentUserIcon: { + var typedUser = username.text + if (typedUser === "") { + var highlighted = userRegistry.list[selectUser.currentIndex] + return highlighted ? (highlighted.icon || "") : "" + } + var match = findRegisteredUser(typedUser, true) + return match ? (match.icon || "") : "" } function triggerLogin() { var typedUser = username.text - var targetUser = 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 - } - } - } + var match = findRegisteredUser(typedUser, config.UseRealName == "true") + var targetUser = match ? match.name : typedUser sddm.login(targetUser, password.text, sessionSelect.selectedSession) } @@ -415,12 +405,12 @@ Column { font.bold: true color: config.PasswordFieldTextColor - focus: config.PasswordFocus == "true" ? true : false + focus: config.PasswordFocus == "true" echoMode: passwordIcon.checked ? TextInput.Normal : TextInput.Password placeholderText: config.TranslatePlaceholderPassword || textConstants.password placeholderTextColor: config.PlaceholderTextColor passwordCharacter: "•" - passwordMaskDelay: config.HideCompletePassword == "true" ? undefined : 1000 + passwordMaskDelay: config.ShowLastPasswordCharacter == "true" ? 1000 : undefined renderType: Text.QtRendering selectByMouse: true @@ -472,7 +462,7 @@ Column { width: parent.width / 2 anchors.horizontalCenter: parent.horizontalCenter - visible: config.HideLoginButton == "true" ? false : true + visible: config.ShowLoginButton == "true" Button { id: loginButton @@ -483,7 +473,7 @@ Column { anchors.verticalCenter: parent.verticalCenter 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 contentItem: Text { @@ -572,7 +562,7 @@ Column { Keys.onReturnPressed: clicked() Keys.onEnterPressed: clicked() - KeyNavigation.down: config.HideSystemButtons == "true" ? virtualKeyboard : systemButtons.children[0] + KeyNavigation.down: config.ShowSystemButtons == "true" ? systemButtons.children[0] : virtualKeyboard } } diff --git a/Components/LoginForm.qml b/Components/LoginForm.qml index d706422..77c1536 100644 --- a/Components/LoginForm.qml +++ b/Components/LoginForm.qml @@ -3,8 +3,8 @@ // 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 +import QtQuick.Layouts import SddmComponents 2.0 as SDDM Item { @@ -49,7 +49,7 @@ Item { Layout.preferredWidth: implicitWidth ProfilePicture { id: profilePicture - visible: config.ShowProfilePicture == "true" ? true : false + visible: config.ShowProfilePicture == "true" anchors.centerIn: parent width: rootHeightUnit * 11 height: rootHeightUnit * 11 @@ -87,7 +87,6 @@ Item { Layout.preferredWidth: implicitWidth SystemButtons { id: systemButtons - exposedSession: input.exposeSession anchors.centerIn: parent } } diff --git a/Components/SessionButton.qml b/Components/SessionButton.qml index ae538ad..de9d0bb 100644 --- a/Components/SessionButton.qml +++ b/Components/SessionButton.qml @@ -3,8 +3,8 @@ // 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 QtQuick +import QtQuick.Controls Item { id: sessionButton @@ -13,8 +13,6 @@ Item { width: parent.width / 2 property var selectedSession: selectSession.currentIndex - property string textConstantSession - property int loginButtonWidth property ComboBox exposeSession: selectSession ComboBox { diff --git a/Components/SystemButtons.qml b/Components/SystemButtons.qml index 8ad2793..50a2a4a 100644 --- a/Components/SystemButtons.qml +++ b/Components/SystemButtons.qml @@ -3,9 +3,9 @@ // 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 +import QtQuick.Layouts +import QtQuick.Controls RowLayout { spacing: rootFontSize @@ -13,7 +13,6 @@ RowLayout { property var reboot: ["Reboot", config.TranslateReboot || textConstants.reboot, sddm.canReboot] property var suspend: ["Suspend", config.TranslateSuspend || textConstants.suspend, sddm.canSuspend] property var hibernate: ["Hibernate", config.TranslateHibernate || textConstants.hibernate, sddm.canHibernate] - property ComboBox exposedSession Repeater { id: systemButtons @@ -23,7 +22,7 @@ RowLayout { Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter text: modelData[1] 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.width: 2 * Math.round((rootFontSize * 3) / 2) icon.color: config.SystemButtonsIconsColor @@ -31,7 +30,7 @@ RowLayout { display: AbstractButton.TextUnderIcon spacing: rootScaleUnit * 6 padding: rootScaleUnit * 8 - visible: config.HideSystemButtons != "true" && (config.BypassSystemButtonsChecks == "true" ? 1 : modelData[2]) + visible: config.ShowSystemButtons == "true" && (config.BypassSystemButtonsChecks == "true" || modelData[2]) hoverEnabled: true background: Rectangle { height: rootScaleUnit * 2 @@ -41,7 +40,12 @@ RowLayout { Keys.onReturnPressed: clicked() onClicked: { 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 states: [ diff --git a/Components/VirtualKeyboard.qml b/Components/VirtualKeyboard.qml index 108df6f..05fd104 100644 --- a/Components/VirtualKeyboard.qml +++ b/Components/VirtualKeyboard.qml @@ -3,8 +3,8 @@ // 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 +import QtQuick +import QtQuick.VirtualKeyboard InputPanel { id: virtualKeyboard diff --git a/Components/VirtualKeyboardButton.qml b/Components/VirtualKeyboardButton.qml index 57974a9..286205a 100644 --- a/Components/VirtualKeyboardButton.qml +++ b/Components/VirtualKeyboardButton.qml @@ -2,8 +2,8 @@ // Copyright (C) 2022-2026 Keyitdev // Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls Item { id: virtualKeyboardButtonRoot @@ -18,7 +18,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter z: 1 - visible: virtualKeyboard.status == Loader.Ready && config.HideVirtualKeyboard == "false" + visible: virtualKeyboard.status == Loader.Ready && config.ShowVirtualKeyboard == "true" checkable: true onClicked: virtualKeyboard.switchState() diff --git a/Main.qml b/Main.qml index 38d412c..741784f 100644 --- a/Main.qml +++ b/Main.qml @@ -3,8 +3,8 @@ // 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 QtQuick +import QtQuick.Controls import QtQuick.Effects import QtMultimedia @@ -40,22 +40,22 @@ Pane { focus: true property bool leftleft: config.HaveFormBackground == "true" && - config.PartialBlur == "false" && + config.PartialBlur != "true" && config.FormPosition == "left" && config.BackgroundHorizontalAlignment == "left" property bool leftcenter: config.HaveFormBackground == "true" && - config.PartialBlur == "false" && + config.PartialBlur != "true" && config.FormPosition == "left" && config.BackgroundHorizontalAlignment == "center" property bool rightright: config.HaveFormBackground == "true" && - config.PartialBlur == "false" && + config.PartialBlur != "true" && config.FormPosition == "right" && config.BackgroundHorizontalAlignment == "right" property bool rightcenter: config.HaveFormBackground == "true" && - config.PartialBlur == "false" && + config.PartialBlur != "true" && config.FormPosition == "right" && config.BackgroundHorizontalAlignment == "center" @@ -85,7 +85,7 @@ Pane { z: 1 color: config.FormBackgroundColor - visible: config.HaveFormBackground == "true" ? true : false + visible: config.HaveFormBackground == "true" opacity: config.PartialBlur == "true" ? 0.3 : 1 } @@ -235,7 +235,7 @@ Pane { Image.AlignBottom : Image.AlignVCenter 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 asynchronous: true cache: true @@ -251,7 +251,7 @@ Pane { player.play(); } else{ - backgroundImage.source = config.background || config.Background + backgroundImage.source = config.Background } } } @@ -270,7 +270,7 @@ Pane { sourceItem: backgroundImage sourceRect: Qt.rect(x,y,width,height) - visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false + visible: config.FullBlur == "true" || config.PartialBlur == "true" } MultiEffect { @@ -282,7 +282,7 @@ Pane { // 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. - 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 source: config.FullBlur == "true" ? backgroundImage : blurMask @@ -296,7 +296,7 @@ Pane { blurMax: config.BlurMax !== "" ? parseInt(config.BlurMax, 10) : 48 blurMultiplier: Math.max(0.0, scaledBlur - 1.0) - visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false + visible: config.FullBlur == "true" || config.PartialBlur == "true" } } }