diff --git a/Components/Input.qml b/Components/Input.qml index 0e2f2f0..8ddf210 100644 --- a/Components/Input.qml +++ b/Components/Input.qml @@ -15,8 +15,8 @@ Column { property ComboBox exposeSession: sessionSelect.exposeSession property bool failed - // Custom addition: exposes the face icon of the currently typed/selected - // user so it can be shown in ProfilePicture, above the login field + readonly property real fontUnit: root.font.pointSize + property url currentUserIcon: { var typedUser = username.text for (var i = 0; i < userRegistry.list.length; i++) { @@ -56,58 +56,58 @@ Column { } Item { - id: errorMessageField + id: errorMessageField - // change also in selectSession - height: root.font.pointSize * 2 - width: parent.width / 2 - anchors.horizontalCenter: parent.horizontalCenter + height: fontUnit * 1.5 + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter - Label { - id: errorMessage + Label { + id: errorMessage - width: parent.width - horizontalAlignment: Text.AlignHCenter + 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 + text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : "" - states: [ - State { - name: "fail" - when: failed - PropertyChanges { - target: errorMessage - opacity: 1 + 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 + } } - }, - State { - name: "capslock" - when: keyboard.capsLock - PropertyChanges { - target: errorMessage - opacity: 1 + ] + transitions: [ + Transition { + PropertyAnimation { + properties: "opacity" + duration: 100 + } } - } - ] - transitions: [ - Transition { - PropertyAnimation { - properties: "opacity" - duration: 100 - } - } - ] + ] + } } - } Item { id: usernameField - height: root.font.pointSize * 4.5 + height: root.font.pointSize * 4 width: parent.width / 2 anchors.horizontalCenter: parent.horizontalCenter @@ -142,7 +142,7 @@ Column { delegate: ItemDelegate { // minus padding - width: popupHandler.width - 20 + width: popupHandler.width - (fontUnit * 1.5) anchors.horizontalCenter: popupHandler.horizontalCenter contentItem: Text { @@ -170,8 +170,8 @@ Column { anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: selectUser.height * 0 - icon.height: parent.height * 0.25 - icon.width: parent.height * 0.25 + icon.height: parent.height * 0.3 + icon.width: parent.height * 0.3 enabled: false icon.color: config.UserIconColor icon.source: Qt.resolvedUrl("../Assets/User.svg") @@ -195,10 +195,10 @@ Column { 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 + padding: fontUnit * 0.75 contentItem: ListView { - implicitHeight: contentHeight + 20 + implicitHeight: contentHeight + (fontUnit * 1.5) clip: true model: selectUser.popup.visible ? selectUser.delegateModel : null @@ -308,7 +308,7 @@ Column { Item { id: passwordField - height: root.font.pointSize * 4.5 + height: root.font.pointSize * 4 width: parent.width / 2 anchors.horizontalCenter: parent.horizontalCenter @@ -322,8 +322,8 @@ Column { anchors.verticalCenter: parent.verticalCenter z: 2 - icon.height: parent.height * 0.25 - icon.width: parent.height * 0.25 + icon.height: parent.height * 0.3 + icon.width: parent.height * 0.3 icon.color: config.PasswordIconColor icon.source: Qt.resolvedUrl("../Assets/Password2.svg") @@ -443,9 +443,7 @@ Column { Item { id: login - // important - // try 4 or 9 ... - height: root.font.pointSize * 9 + height: loginButton.implicitHeight + (fontUnit * 3.7) width: parent.width / 2 anchors.horizontalCenter: parent.horizontalCenter diff --git a/Components/LoginForm.qml b/Components/LoginForm.qml index c19f958..88b27b9 100644 --- a/Components/LoginForm.qml +++ b/Components/LoginForm.qml @@ -2,70 +2,122 @@ // 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 SddmComponents 2.0 as SDDM - -ColumnLayout { +Item { id: formContainer SDDM.TextConstants { id: textConstants } - property int p: config.ScreenPadding == "" ? 0 : config.ScreenPadding - property string a: config.FormPosition + readonly property real fontUnit: root.font.pointSize - 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 + readonly property real clockTopMargin: (Number(config.ClockTopMargin) || 0) * fontUnit + readonly property real profilePictureTopMargin: (Number(config.ProfilePictureTopMargin) || 0) * fontUnit + readonly property real loginInputTopMargin: (Number(config.LoginInputTopMargin) || 0) * fontUnit + readonly property real systemButtonsBottomMargin: (Number(config.SystemButtonsBottomMargin) || 0) * fontUnit + readonly property real sessionSelectBottomMargin: (Number(config.SessionSelectBottomMargin) || 0) * fontUnit + readonly property real virtualKeyboardButtonBottomMargin: (Number(config.VirtualKeyboardButtonBottomMargin) || 0) * fontUnit + + ColumnLayout { + id: topGroup + spacing: 0 + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + + Rectangle { + id: clockBox + color: "transparent" + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: clockTopMargin + Layout.preferredHeight: clock.implicitHeight + (fontUnit * 1.5) + implicitWidth: clock.implicitWidth + (fontUnit * 3) + radius: 20 + Layout.preferredWidth: implicitWidth + Clock { + anchors.fill: parent + id: clock + Layout.alignment: Qt.AlignHCenter + } + } + Rectangle { + id: profilePictureBox + color: "transparent" + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: profilePictureTopMargin + Layout.preferredHeight: profilePicture.height + implicitWidth: profilePicture.width + (fontUnit * 3) + Layout.preferredWidth: implicitWidth + ProfilePicture { + id: profilePicture + visible: config.ShowProfilePicture == "true" ? true : false + anchors.centerIn: parent + width: fontUnit * 11 + height: fontUnit * 11 + } + } + Rectangle { + id: inputBox + color: "transparent" + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: loginInputTopMargin + Layout.preferredHeight: input.implicitHeight + implicitWidth: input.implicitWidth + Layout.preferredWidth: implicitWidth + Input { + id: input + anchors.centerIn: parent + width: fontUnit * 60 + } + } } - ProfilePicture { - id: profilePicture - visible: false - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: root.height / 7 - Layout.preferredHeight: root.height / 7 - Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 - } + ColumnLayout { + id: bottomGroup + spacing: 0 + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter - 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: 0 - } - - SystemButtons { - id: systemButtons - - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.preferredHeight: root.height / 5 - Layout.maximumHeight: root.height / 5 - Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 - - exposedSession: input.exposeSession - } - - SessionButton { - id: sessionSelect - - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.preferredHeight: root.height / 54 - Layout.maximumHeight: root.height / 54 - Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 - } - - VirtualKeyboardButton { - id: virtualKeyboardButton - - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop - Layout.preferredHeight: root.height / 27 - Layout.maximumHeight: root.height / 27 - Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 + Rectangle { + id: systemButtonsBox + color: "transparent" + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: systemButtonsBottomMargin + Layout.preferredHeight: systemButtons.implicitHeight + implicitWidth: systemButtons.implicitWidth + Layout.preferredWidth: implicitWidth + SystemButtons { + id: systemButtons + exposedSession: input.exposeSession + anchors.centerIn: parent + } + } + Rectangle { + id: sessionSelectBox + color: "transparent" + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: sessionSelectBottomMargin + Layout.preferredHeight: sessionSelect.height + implicitWidth: sessionSelect.width + Layout.preferredWidth: implicitWidth + SessionButton { + id: sessionSelect + anchors.centerIn: parent + width: fontUnit * 30 + } + } + Rectangle { + id: virtualKeyboardButtonBox + color: "transparent" + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: virtualKeyboardButtonBottomMargin + Layout.preferredHeight: virtualKeyboardButton.height + implicitWidth: virtualKeyboardButton.width + Layout.preferredWidth: implicitWidth + VirtualKeyboardButton { + id: virtualKeyboardButton + anchors.centerIn: parent + width: fontUnit * 30 + } + } } } diff --git a/Components/ProfilePicture.qml b/Components/ProfilePicture.qml index 4db4b45..9afa9e4 100644 --- a/Components/ProfilePicture.qml +++ b/Components/ProfilePicture.qml @@ -3,7 +3,7 @@ import QtQuick.Effects Item { id: profilePicture - // visible: false + property url userIcon: input.currentUserIcon property bool hasCustomIcon: userIcon != "" diff --git a/Components/SessionButton.qml b/Components/SessionButton.qml index 69ce012..4881b74 100644 --- a/Components/SessionButton.qml +++ b/Components/SessionButton.qml @@ -9,7 +9,7 @@ import QtQuick.Controls 2.15 Item { id: sessionButton - height: root.font.pointSize + height: selectSession.height width: parent.width / 2 property var selectedSession: selectSession.currentIndex @@ -20,9 +20,7 @@ Item { ComboBox { id: selectSession - // important - // change also in errorMessage - height: root.font.pointSize * 2 + height: root.font.pointSize anchors.horizontalCenter: parent.horizontalCenter hoverEnabled: true diff --git a/Components/SystemButtons.qml b/Components/SystemButtons.qml index 5b36670..51d5083 100644 --- a/Components/SystemButtons.qml +++ b/Components/SystemButtons.qml @@ -25,7 +25,6 @@ RowLayout { RoundButton { Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.topMargin: root.font.pointSize * 6.5 text: modelData[1] font.pointSize: root.font.pointSize * 0.8 diff --git a/Components/VirtualKeyboardButton.qml b/Components/VirtualKeyboardButton.qml index b54728c..a2bf546 100644 --- a/Components/VirtualKeyboardButton.qml +++ b/Components/VirtualKeyboardButton.qml @@ -6,9 +6,14 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 Item { + id: virtualKeyboardButtonRoot + + height: virtualKeyboardButton.height + width: parent.width / 2 + Button { id: virtualKeyboardButton - + height: root.font.pointSize anchors.horizontalCenter: parent.horizontalCenter z: 1 @@ -28,6 +33,9 @@ Item { contentItem: Text { id: virtualKeyboardButtonText + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)" font.pointSize: root.font.pointSize * 0.8 font.family: root.font.family