Fix: Removed useless KeyNavigation and key events. Fixed typos. Cleaned up some code.

This commit is contained in:
Keyitdev
2024-12-30 20:47:31 +01:00
parent 91967fc2d4
commit 8d0c59ded3
8 changed files with 236 additions and 192 deletions
+11 -1
View File
@@ -8,11 +8,15 @@ import QtQuick.Controls 2.15
Column { Column {
id: clock id: clock
spacing: 0
width: parent.width / 2 width: parent.width / 2
spacing: 0
Label { Label {
id:headerTextLabel
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: root.font.pointSize * 3 font.pointSize: root.font.pointSize * 3
color: config.HeaderTextColor color: config.HeaderTextColor
renderType: Text.QtRendering renderType: Text.QtRendering
@@ -21,11 +25,14 @@ Column {
Label { Label {
id: timeLabel id: timeLabel
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: root.font.pointSize * 9 font.pointSize: root.font.pointSize * 9
font.bold: true font.bold: true
color: config.TimeTextColor color: config.TimeTextColor
renderType: Text.QtRendering renderType: Text.QtRendering
function updateTime() { function updateTime() {
text = new Date().toLocaleTimeString(Qt.locale(config.Locale), config.HourFormat == "long" ? Locale.LongFormat : config.HourFormat !== "" ? config.HourFormat : Locale.ShortFormat) text = new Date().toLocaleTimeString(Qt.locale(config.Locale), config.HourFormat == "long" ? Locale.LongFormat : config.HourFormat !== "" ? config.HourFormat : Locale.ShortFormat)
} }
@@ -33,11 +40,14 @@ Column {
Label { Label {
id: dateLabel id: dateLabel
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: config.DateTextColor color: config.DateTextColor
font.pointSize: root.font.pointSize * 2 font.pointSize: root.font.pointSize * 2
font.bold: true font.bold: true
renderType: Text.QtRendering renderType: Text.QtRendering
function updateTime() { function updateTime() {
text = new Date().toLocaleDateString(Qt.locale(config.Locale), config.DateFormat == "short" ? Locale.ShortFormat : config.DateFormat !== "" ? config.DateFormat : Locale.LongFormat) text = new Date().toLocaleDateString(Qt.locale(config.Locale), config.DateFormat == "short" ? Locale.ShortFormat : config.DateFormat !== "" ? config.DateFormat : Locale.LongFormat)
} }
+87 -59
View File
@@ -9,25 +9,32 @@ import QtQuick.Controls 2.15
Column { Column {
id: inputContainer id: inputContainer
Layout.fillWidth: true Layout.fillWidth: true
property ComboBox exposeSession: sessionSelect.exposeSession property ComboBox exposeSession: sessionSelect.exposeSession
property bool failed property bool failed
Item { Item {
id: errorMessageField
// change also in selectSession // change also in selectSession
height: root.font.pointSize * 2 height: root.font.pointSize * 2
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Label { Label {
id: errorMessage id: errorMessage
width: parent.width width: parent.width
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : null
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : null
font.pointSize: root.font.pointSize * 0.8 font.pointSize: root.font.pointSize * 0.8
font.italic: true font.italic: true
color: config.WarningColor color: config.WarningColor
opacity: 0 opacity: 0
states: [ states: [
State { State {
name: "fail" name: "fail"
@@ -65,22 +72,11 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
ComboBox { ComboBox {
id: selectUser id: selectUser
width: parent.height width: parent.height
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
property var popkey: config.RightToLeftLayout == "true" ? Qt.Key_Right : Qt.Key_Left
Keys.onPressed: function(event) {
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 z: 2
model: userModel model: userModel
@@ -91,20 +87,32 @@ Column {
username.text = currentText username.text = currentText
} }
property var popkey: config.RightToLeftLayout == "true" ? Qt.Key_Right : Qt.Key_Left
Keys.onPressed: function(event) {
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
delegate: ItemDelegate { delegate: ItemDelegate {
// minus padding // minus padding
width: popupHandler.width - 20 width: popupHandler.width - 20
anchors.horizontalCenter: popupHandler.horizontalCenter anchors.horizontalCenter: popupHandler.horizontalCenter
contentItem: Text { contentItem: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: model.name text: model.name
font.pointSize: root.font.pointSize * 0.8 font.pointSize: root.font.pointSize * 0.8
font.capitalization: Font.AllLowercase font.capitalization: Font.AllLowercase
font.family: root.font.family font.family: root.font.family
color: config.DropdownTextColor color: config.DropdownTextColor
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
} }
// highlighted: parent.highlightedIndex === index
background: Rectangle { background: Rectangle {
color: selectUser.highlightedIndex === index ? config.DropdownSelectedBackgroundColor : "transparent" color: selectUser.highlightedIndex === index ? config.DropdownSelectedBackgroundColor : "transparent"
} }
@@ -112,11 +120,13 @@ Column {
indicator: Button { indicator: Button {
id: usernameIcon id: usernameIcon
width: selectUser.height * 1 width: selectUser.height * 1
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0 anchors.leftMargin: selectUser.height * 0
icon.height: parent.height * 0.25 icon.height: parent.height * 0.25
icon.width: parent.height * 0.25 icon.width: parent.height * 0.25
enabled: false enabled: false
@@ -136,16 +146,18 @@ Column {
popup: Popup { popup: Popup {
id: popupHandler id: popupHandler
implicitHeight: contentItem.implicitHeight
width: usernameField.width
y: parent.height - username.height / 3 y: parent.height - username.height / 3
x: config.RightToLeftLayout == "true" ? -loginButton.width + selectUser.width : 0 x: config.RightToLeftLayout == "true" ? -loginButton.width + selectUser.width : 0
rightMargin: config.RightToLeftLayout == "true" ? root.padding + usernameField.width / 2 : undefined rightMargin: config.RightToLeftLayout == "true" ? root.padding + usernameField.width / 2 : undefined
width: usernameField.width
implicitHeight: contentItem.implicitHeight
padding: 10 padding: 10
contentItem: ListView { contentItem: ListView {
clip: true
implicitHeight: contentHeight + 20 implicitHeight: contentHeight + 20
clip: true
model: selectUser.popup.visible ? selectUser.delegateModel : null model: selectUser.popup.visible ? selectUser.delegateModel : null
currentIndex: selectUser.highlightedIndex currentIndex: selectUser.highlightedIndex
ScrollIndicator.vertical: ScrollIndicator { } ScrollIndicator.vertical: ScrollIndicator { }
@@ -188,7 +200,6 @@ Column {
} }
} }
] ]
transitions: [ transitions: [
Transition { Transition {
PropertyAnimation { PropertyAnimation {
@@ -202,22 +213,27 @@ Column {
TextField { TextField {
id: username id: username
anchors.centerIn: parent
height: root.font.pointSize * 3
width: parent.width
horizontalAlignment: TextInput.AlignHCenter
z: 1
text: config.ForceLastUser == "true" ? selectUser.currentText : null text: config.ForceLastUser == "true" ? selectUser.currentText : null
color: config.LoginFieldTextColor color: config.LoginFieldTextColor
font.bold: true font.bold: true
font.capitalization: config.AllowUppercaseLettersInUsernames == "false" ? Font.AllLowercase : Font.MixedCase font.capitalization: config.AllowUppercaseLettersInUsernames == "false" ? Font.AllLowercase : Font.MixedCase
anchors.centerIn: parent
height: root.font.pointSize * 3
width: parent.width
placeholderText: config.TranslatePlaceholderUsername || textConstants.userName placeholderText: config.TranslatePlaceholderUsername || textConstants.userName
placeholderTextColor: config.PlacholderTextColor placeholderTextColor: config.PlaceholderTextColor
selectByMouse: true selectByMouse: true
horizontalAlignment: TextInput.AlignHCenter
renderType: Text.QtRendering renderType: Text.QtRendering
onFocusChanged:{ onFocusChanged:{
if(focus) if(focus)
selectAll() selectAll()
} }
background: Rectangle { background: Rectangle {
color: config.LoginFieldBackgroundColor color: config.LoginFieldBackgroundColor
opacity: 0.2 opacity: 0.2
@@ -225,9 +241,9 @@ Column {
border.width: parent.activeFocus ? 2 : 1 border.width: parent.activeFocus ? 2 : 1
radius: config.RoundCorners || 0 radius: config.RoundCorners || 0
} }
onAccepted: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession) onAccepted: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
KeyNavigation.down: showPassword KeyNavigation.down: passwordIcon
z: 1
states: [ states: [
State { State {
@@ -254,13 +270,15 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Button { Button {
id: showPassword id: passwordIcon
z: 2
width: selectUser.height * 1
height: parent.height height: parent.height
width: selectUser.height * 1
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0 anchors.leftMargin: selectUser.height * 0
anchors.verticalCenter: parent.verticalCenter
z: 2
icon.height: parent.height * 0.25 icon.height: parent.height * 0.25
icon.width: parent.height * 0.25 icon.width: parent.height * 0.25
icon.color: config.PasswordIconColor icon.color: config.PasswordIconColor
@@ -274,44 +292,44 @@ Column {
states: [ states: [
State { State {
name: "visiblePasswordFocused" name: "visiblePasswordFocused"
when: showPassword.checked && showPassword.activeFocus when: passwordIcon.checked && passwordIcon.activeFocus
PropertyChanges { PropertyChanges {
target: showPassword target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: config.HoverPasswordIconColor icon.color: config.HoverPasswordIconColor
} }
}, },
State { State {
name: "visiblePasswordHovered" name: "visiblePasswordHovered"
when: showPassword.checked && showPassword.hovered when: passwordIcon.checked && passwordIcon.hovered
PropertyChanges { PropertyChanges {
target: showPassword target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: config.HoverPasswordIconColor icon.color: config.HoverPasswordIconColor
} }
}, },
State { State {
name: "visiblePassword" name: "visiblePassword"
when: showPassword.checked when: passwordIcon.checked
PropertyChanges { PropertyChanges {
target: showPassword target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
} }
}, },
State { State {
name: "hiddenPasswordFocused" name: "hiddenPasswordFocused"
when: showPassword.enabled && showPassword.activeFocus when: passwordIcon.enabled && passwordIcon.activeFocus
PropertyChanges { PropertyChanges {
target: showPassword target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password2.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: config.HoverPasswordIconColor icon.color: config.HoverPasswordIconColor
} }
}, },
State { State {
name: "hiddenPasswordHovered" name: "hiddenPasswordHovered"
when: showPassword.hovered when: passwordIcon.hovered
PropertyChanges { PropertyChanges {
target: showPassword target: passwordIcon
icon.source: Qt.resolvedUrl("../Assets/Password2.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: config.HoverPasswordIconColor icon.color: config.HoverPasswordIconColor
} }
@@ -327,20 +345,23 @@ Column {
TextField { TextField {
id: password id: password
anchors.centerIn: parent
color: config.PasswordFieldTextColor
height: root.font.pointSize * 3 height: root.font.pointSize * 3
width: parent.width width: parent.width
font.bold: true anchors.centerIn: parent
focus: config.PasswordFocus == "true" ? true : false
selectByMouse: true
echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
placeholderText: config.TranslatePlaceholderPassword || textConstants.password
placeholderTextColor: config.PlacholderTextColor
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
font.bold: true
color: config.PasswordFieldTextColor
focus: config.PasswordFocus == "true" ? true : false
echoMode: passwordIcon.checked ? TextInput.Normal : TextInput.Password
placeholderText: config.TranslatePlaceholderPassword || textConstants.password
placeholderTextColor: config.PlaceholderTextColor
passwordCharacter: "•" passwordCharacter: "•"
passwordMaskDelay: config.HideCompletePassword == "true" ? undefined : 1000 passwordMaskDelay: config.HideCompletePassword == "true" ? undefined : 1000
renderType: Text.QtRendering renderType: Text.QtRendering
selectByMouse: true
background: Rectangle { background: Rectangle {
color: config.PasswordFieldBackgroundColor color: config.PasswordFieldBackgroundColor
opacity: 0.2 opacity: 0.2
@@ -366,7 +387,6 @@ Column {
} }
} }
] ]
transitions: [ transitions: [
Transition { Transition {
PropertyAnimation { PropertyAnimation {
@@ -379,35 +399,42 @@ Column {
Item { Item {
id: login id: login
// important // important
// try 4 or 9 ... // try 4 or 9 ...
height: root.font.pointSize * 9 height: root.font.pointSize * 9
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: config.HideLoginButton == "true" ? false : true visible: config.HideLoginButton == "true" ? false : true
Button { Button {
id: loginButton id: loginButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: config.TranslateLogin || textConstants.login
height: root.font.pointSize * 3 height: root.font.pointSize * 3
implicitWidth: parent.width implicitWidth: parent.width
anchors.horizontalCenter: parent.horizontalCenter
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 != "" ? true : false
hoverEnabled: true hoverEnabled: true
contentItem: Text { contentItem: Text {
font.bold: true
text: parent.text
color: config.LoginButtonTextColor
font.pointSize: root.font.pointSize
font.family: root.font.family
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.bold: true
font.pointSize: root.font.pointSize
font.family: root.font.family
color: config.LoginButtonTextColor
text: parent.text
opacity: 0.5 opacity: 0.5
} }
background: Rectangle { background: Rectangle {
id: buttonBackground id: buttonBackground
color: config.LoginButtonBackgroundColor color: config.LoginButtonBackgroundColor
opacity: 0.2 opacity: 0.2
radius: config.RoundCorners || 0 radius: config.RoundCorners || 0
@@ -466,7 +493,6 @@ Column {
} }
} }
] ]
transitions: [ transitions: [
Transition { Transition {
PropertyAnimation { PropertyAnimation {
@@ -475,10 +501,12 @@ Column {
} }
} }
] ]
onClicked: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession) onClicked: config.AllowUppercaseLettersInUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
KeyNavigation.down: sessionSelect.exposeSession
KeyNavigation.down: config.HideSystemButtons == "true" ? virtualKeyboard : systemButtons.children[0]
} }
} }
+6
View File
@@ -16,6 +16,7 @@ ColumnLayout {
Clock { Clock {
id: clock id: clock
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
// important // important
Layout.preferredHeight: root.height / 3 Layout.preferredHeight: root.height / 3
@@ -24,6 +25,7 @@ ColumnLayout {
Input { Input {
id: input id: input
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: root.height / 10 Layout.preferredHeight: root.height / 10
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
@@ -32,15 +34,18 @@ ColumnLayout {
SystemButtons { SystemButtons {
id: systemButtons id: systemButtons
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.preferredHeight: root.height / 5 Layout.preferredHeight: root.height / 5
Layout.maximumHeight: root.height / 5 Layout.maximumHeight: root.height / 5
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
exposedSession: input.exposeSession exposedSession: input.exposeSession
} }
SessionButton { SessionButton {
id: sessionSelect id: sessionSelect
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.preferredHeight: root.height / 54 Layout.preferredHeight: root.height / 54
Layout.maximumHeight: root.height / 54 Layout.maximumHeight: root.height / 54
@@ -49,6 +54,7 @@ ColumnLayout {
VirtualKeyboardButton { VirtualKeyboardButton {
id: virtualKeyboardButton id: virtualKeyboardButton
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.preferredHeight: root.height / 27 Layout.preferredHeight: root.height / 27
Layout.maximumHeight: root.height / 27 Layout.maximumHeight: root.height / 27
+24 -32
View File
@@ -8,9 +8,10 @@ import QtQuick.Controls 2.15
Item { Item {
id: sessionButton id: sessionButton
height: root.font.pointSize height: root.font.pointSize
width: parent.width / 2 width: parent.width / 2
// anchors.horizontalCenter: parent.horizontalCenter
property var selectedSession: selectSession.currentIndex property var selectedSession: selectSession.currentIndex
property string textConstantSession property string textConstantSession
property int loginButtonWidth property int loginButtonWidth
@@ -18,49 +19,38 @@ Item {
ComboBox { ComboBox {
id: selectSession id: selectSession
// important // important
// change also in errorMessage // change also in errorMessage
height: root.font.pointSize * 2 height: root.font.pointSize * 2
hoverEnabled: true
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
hoverEnabled: true
model: sessionModel
currentIndex: model.lastIndex
textRole: "name"
Keys.onPressed: function(event) { Keys.onPressed: function(event) {
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) { if ((event.key == Qt.Key_Left || event.key == Qt.Key_Right) && !popup.opened) {
popup.open(); popup.open();
} }
} }
model: sessionModel
currentIndex: model.lastIndex
textRole: "name"
delegate: ItemDelegate { delegate: ItemDelegate {
// minus padding // minus padding
width: popupHandler.width - 20 width: popupHandler.width - 20
anchors.horizontalCenter: popupHandler.horizontalCenter anchors.horizontalCenter: popupHandler.horizontalCenter
contentItem: Text { contentItem: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: model.name text: model.name
font.pointSize: root.font.pointSize * 0.8 font.pointSize: root.font.pointSize * 0.8
font.family: root.font.family font.family: root.font.family
color: config.DropdownTextColor color: config.DropdownTextColor
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
} }
// highlighted: parent.highlightedIndex === index
background: Rectangle { background: Rectangle {
color: selectSession.highlightedIndex === index ? config.DropdownSelectedBackgroundColor : "transparent" color: selectSession.highlightedIndex === index ? config.DropdownSelectedBackgroundColor : "transparent"
} }
@@ -72,34 +62,37 @@ Item {
contentItem: Text { contentItem: Text {
id: displayedItem id: displayedItem
verticalAlignment: Text.AlignVCenter
text: (config.TranslateSessionSelection || "Session") + " (" + selectSession.currentText + ")" text: (config.TranslateSessionSelection || "Session") + " (" + selectSession.currentText + ")"
color: config.SessionButtonTextColor color: config.SessionButtonTextColor
verticalAlignment: Text.AlignVCenter
font.pointSize: root.font.pointSize * 0.8 font.pointSize: root.font.pointSize * 0.8
font.family: root.font.family font.family: root.font.family
Keys.onReleased: parent.popup.open() Keys.onReleased: parent.popup.open()
} }
background: Rectangle { background: Rectangle {
color: "transparent"
height: parent.visualFocus ? 2 : 0 height: parent.visualFocus ? 2 : 0
width: displayedItem.implicitWidth width: displayedItem.implicitWidth
// anchors.top: parent.bottom
// anchors.left: parent.left color: "transparent"
// anchors.leftMargin: 3
} }
popup: Popup { popup: Popup {
id: popupHandler id: popupHandler
implicitHeight: contentItem.implicitHeight
width: sessionButton.width width: sessionButton.width
y: parent.height - 1 y: parent.height - 1
x: -popupHandler.width/2 + displayedItem.width/2 x: -popupHandler.width/2 + displayedItem.width/2
implicitHeight: contentItem.implicitHeight
padding: 10 padding: 10
contentItem: ListView { contentItem: ListView {
clip: true
implicitHeight: contentHeight + 20 implicitHeight: contentHeight + 20
clip: true
model: selectSession.popup.visible ? selectSession.delegateModel : null model: selectSession.popup.visible ? selectSession.delegateModel : null
currentIndex: selectSession.highlightedIndex currentIndex: selectSession.highlightedIndex
ScrollIndicator.vertical: ScrollIndicator { } ScrollIndicator.vertical: ScrollIndicator { }
@@ -142,7 +135,6 @@ Item {
} }
} }
] ]
transitions: [ transitions: [
Transition { Transition {
PropertyAnimation { PropertyAnimation {
+8 -6
View File
@@ -19,27 +19,30 @@ RowLayout {
property ComboBox exposedSession property ComboBox exposedSession
Repeater { Repeater {
id: systemButtons id: systemButtons
model: [shutdown, reboot, suspend, hibernate] model: [shutdown, reboot, suspend, hibernate]
RoundButton { RoundButton {
text: modelData[1]
font.pointSize: root.font.pointSize * 0.8
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: root.font.pointSize * 6.5 Layout.topMargin: root.font.pointSize * 6.5
text: modelData[1]
font.pointSize: root.font.pointSize * 0.8
icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg") : "" icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg") : ""
icon.height: 2 * Math.round((root.font.pointSize * 3) / 2) icon.height: 2 * Math.round((root.font.pointSize * 3) / 2)
icon.width: 2 * Math.round((root.font.pointSize * 3) / 2) icon.width: 2 * Math.round((root.font.pointSize * 3) / 2)
icon.color: config.SystemButtonsIconsColor icon.color: config.SystemButtonsIconsColor
palette.buttonText: config.SystemButtonsIconsColor
display: AbstractButton.TextUnderIcon display: AbstractButton.TextUnderIcon
visible: config.HideSystemButtons != "true" && (config.BypassSystemButtonsChecks == "true" ? 1 : modelData[2]) visible: config.HideSystemButtons != "true" && (config.BypassSystemButtonsChecks == "true" ? 1 : modelData[2])
hoverEnabled: true hoverEnabled: true
palette.buttonText: config.SystemButtonsIconsColor
background: Rectangle { background: Rectangle {
height: 2 height: 2
color: "transparent"
width: parent.width width: parent.width
color: "transparent"
} }
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
@@ -78,7 +81,6 @@ RowLayout {
} }
} }
] ]
transitions: [ transitions: [
Transition { Transition {
PropertyAnimation { PropertyAnimation {
+1
View File
@@ -8,6 +8,7 @@ import QtQuick.VirtualKeyboard 2.3
InputPanel { InputPanel {
id: virtualKeyboard id: virtualKeyboard
property bool activated: false property bool activated: false
active: activated && Qt.inputMethod.visible active: activated && Qt.inputMethod.visible
visible: active visible: active
+10 -9
View File
@@ -8,6 +8,11 @@ import QtQuick.Controls 2.15
Item { Item {
Button { Button {
id: virtualKeyboardButton id: virtualKeyboardButton
anchors.horizontalCenter: parent.horizontalCenter
z: 1
visible: virtualKeyboard.status == Loader.Ready && config.HideVirtualKeyboard == "false"
checkable: true checkable: true
onClicked: virtualKeyboard.switchState() onClicked: virtualKeyboard.switchState()
@@ -19,20 +24,19 @@ Item {
toggle(); toggle();
virtualKeyboard.switchState(); virtualKeyboard.switchState();
} }
visible: virtualKeyboard.status == Loader.Ready && config.HideVirtualKeyboard == "false"
// anchors.bottom: parent.bottom
// anchors.bottomMargin: implicitHeight
anchors.horizontalCenter: parent.horizontalCenter
z: 1
contentItem: Text { contentItem: Text {
id: virtualKeyboardButtonText id: virtualKeyboardButtonText
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)" text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
color: parent.visualFocus ? config.HoverVirtualKeyboardButtonTextColor : config.VirtualKeyboardButtonTextColor
font.pointSize: root.font.pointSize * 0.8 font.pointSize: root.font.pointSize * 0.8
font.family: root.font.family font.family: root.font.family
color: parent.visualFocus ? config.HoverVirtualKeyboardButtonTextColor : config.VirtualKeyboardButtonTextColor
} }
background: Rectangle { background: Rectangle {
id: virtualKeyboardButtonBackground id: virtualKeyboardButtonBackground
color: "transparent" color: "transparent"
} }
states: [ states: [
@@ -64,7 +68,4 @@ Item {
} }
] ]
} }
} }
+23 -19
View File
@@ -53,35 +53,40 @@ Pane {
Item { Item {
id: sizeHelper id: sizeHelper
anchors.fill: parent
height: parent.height height: parent.height
width: parent.width width: parent.width
anchors.fill: parent
Rectangle { Rectangle {
id: tintLayer id: tintLayer
anchors.fill: parent
width: parent.width
height: parent.height height: parent.height
opacity: config.DimBackground width: parent.width
anchors.fill: parent
z: 1 z: 1
opacity: config.DimBackground
} }
Rectangle { Rectangle {
id: formBackground id: formBackground
anchors.fill: form anchors.fill: form
anchors.centerIn: form anchors.centerIn: form
z: 1
color: config.FormBackgroundColor color: config.FormBackgroundColor
visible: config.HaveFormBackground == "true" ? true : false visible: config.HaveFormBackground == "true" ? true : false
opacity: config.PartialBlur == "true" ? 0.3 : 1 opacity: config.PartialBlur == "true" ? 0.3 : 1
z: 1
} }
LoginForm { LoginForm {
id: form id: form
height: parent.height height: parent.height
width: parent.width / 2.5 width: parent.width / 2.5
anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined
anchors.left: config.FormPosition == "left" ? parent.left : undefined anchors.left: config.FormPosition == "left" ? parent.left : undefined
anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined
anchors.right: config.FormPosition == "right" ? parent.right : undefined anchors.right: config.FormPosition == "right" ? parent.right : undefined
z: 1 z: 1
} }
@@ -89,16 +94,18 @@ Pane {
Loader { Loader {
id: virtualKeyboard id: virtualKeyboard
source: "Components/VirtualKeyboard.qml" source: "Components/VirtualKeyboard.qml"
state: "hidden"
property bool keyboardActive: item ? item.active : false
// x * 0.4 = x / 2.5 // x * 0.4 = x / 2.5
width: config.KeyboardSize == "" ? parent.width * 0.4 : parent.width * config.KeyboardSize width: config.KeyboardSize == "" ? parent.width * 0.4 : parent.width * config.KeyboardSize
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: config.VirtualKeyboardPosition == "left" ? parent.left : undefined; anchors.left: config.VirtualKeyboardPosition == "left" ? parent.left : undefined;
anchors.horizontalCenter: config.VirtualKeyboardPosition == "center" ? parent.horizontalCenter : undefined; anchors.horizontalCenter: config.VirtualKeyboardPosition == "center" ? parent.horizontalCenter : undefined;
anchors.right: config.VirtualKeyboardPosition == "right" ? parent.right : undefined; anchors.right: config.VirtualKeyboardPosition == "right" ? parent.right : undefined;
z: 1 z: 1
state: "hidden"
property bool keyboardActive: item ? item.active : false
function switchState() { state = state == "hidden" ? "visible" : "hidden"} function switchState() { state = state == "hidden" ? "visible" : "hidden"}
states: [ states: [
State { State {
@@ -177,13 +184,8 @@ Pane {
height: parent.height height: parent.height
width: config.HaveFormBackground == "true" && config.FormPosition != "center" && config.PartialBlur != "true" ? parent.width - formBackground.width : parent.width width: config.HaveFormBackground == "true" && config.FormPosition != "center" && config.PartialBlur != "true" ? parent.width - formBackground.width : parent.width
anchors.left: leftleft || anchors.left: leftleft || leftcenter ? formBackground.right : undefined
leftcenter ? anchors.right: rightright || rightcenter ? formBackground.left : undefined
formBackground.right : undefined
anchors.right: rightright ||
rightcenter ?
formBackground.left : undefined
horizontalAlignment: config.BackgroundHorizontalAlignment == "left" ? horizontalAlignment: config.BackgroundHorizontalAlignment == "left" ?
Image.AlignLeft : Image.AlignLeft :
@@ -211,10 +213,11 @@ Pane {
ShaderEffectSource { ShaderEffectSource {
id: blurMask id: blurMask
sourceItem: backgroundImage
width: form.width
height: parent.height height: parent.height
width: form.width
anchors.centerIn: form anchors.centerIn: form
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" ? true : false
} }
@@ -224,12 +227,13 @@ Pane {
height: parent.height height: parent.height
width: config.FullBlur == "true" ? parent.width : form.width width: config.FullBlur == "true" ? parent.width : form.width
anchors.centerIn: config.FullBlur == "true" ? parent : form
source: config.FullBlur == "true" ? backgroundImage : blurMask source: config.FullBlur == "true" ? backgroundImage : blurMask
blurEnabled: true blurEnabled: true
autoPaddingEnabled: false autoPaddingEnabled: false
blur: config.Blur == "" ? 2.0 : config.Blur blur: config.Blur == "" ? 2.0 : config.Blur
blurMax: config.BlurMax == "" ? 48 : config.BlurMax blurMax: config.BlurMax == "" ? 48 : config.BlurMax
anchors.centerIn: config.FullBlur == "true" ? parent : form
visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false
} }
} }