Remove interaction with username and password fields on mouse and key press events for background videos

This commit is contained in:
hygienic-books 2022-03-07 02:25:17 +01:00
parent a8883aa61a
commit 57ca7465e9

211
Main.qml
View File

@ -20,6 +20,8 @@ Rectangle {
LayoutMirroring.enabled: Qt.locale().textDirection == Qt.RightToLeft LayoutMirroring.enabled: Qt.locale().textDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true LayoutMirroring.childrenInherit: true
property int sessionIndex: session.index
// Inherited from SDDMComponents // Inherited from SDDMComponents
TextConstants { TextConstants {
id: textConstants id: textConstants
@ -75,9 +77,23 @@ Rectangle {
id: mouseArea1 id: mouseArea1
anchors.fill: parent; anchors.fill: parent;
//onPressed: {playlist1.shuffle(); playlist1.next();} //onPressed: {playlist1.shuffle(); playlist1.next();}
onPressed: {} onPressed: {
fader1.state = fader1.state == "off" ? "on" : "off" ;
if (config.autofocusInput == "true") {
if (username_input_box.text == "")
username_input_box.focus = true
else
password_input_box.focus = true
}
}
}
Keys.onPressed: {
fader1.state = "on";
if (username_input_box.text == "")
username_input_box.focus = true
else
password_input_box.focus = true
} }
Keys.onPressed: {}
} }
WallpaperFader { WallpaperFader {
id: fader1 id: fader1
@ -85,6 +101,8 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
state: "off" state: "off"
source: video1 source: video1
mainStack: login_container
footer: login_container
} }
// Set Background Video2 // Set Background Video2
@ -106,10 +124,27 @@ Rectangle {
id: mouseArea2 id: mouseArea2
enabled: false enabled: false
anchors.fill: parent; anchors.fill: parent;
onPressed: {} onPressed: {
fader1.state = fader1.state == "off" ? "on" : "off" ;
if (config.autofocusInput == "true") {
if (username_input_box.text == "")
username_input_box.focus = true
else
password_input_box.focus = true
}
}
}
Behavior on opacity {
enabled: true
NumberAnimation { easing.type: Easing.InOutQuad; duration: 3000 }
}
Keys.onPressed: {
fader2.state = "on";
if (username_input_box.text == "")
username_input_box.focus = true
else
password_input_box.focus = true
} }
Behavior on opacity {}
Keys.onPressed: {}
} }
WallpaperFader { WallpaperFader {
@ -118,6 +153,8 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
state: "off" state: "off"
source: video2 source: video2
mainStack: login_container
footer: login_container
} }
property MediaPlayer currentPlayer: mediaplayer1 property MediaPlayer currentPlayer: mediaplayer1
@ -217,6 +254,7 @@ Rectangle {
QQC2.StackView { QQC2.StackView {
id: mainStack id: mainStack
anchors.fill: parent anchors.fill: parent
height: root.height + PlasmaCore.Units.gridUnit * 3
// If true (depends on the style and environment variables), hover events are always accepted // If true (depends on the style and environment variables), hover events are always accepted
// and propagation stopped. This means the parent MouseArea won't get them and the UI won't be shown. // and propagation stopped. This means the parent MouseArea won't get them and the UI won't be shown.
@ -255,6 +293,57 @@ Rectangle {
return userListModel.count <= userListModel.disableAvatarsThreshold && (userList.y + mainStack.y) > 0 return userListModel.count <= userListModel.disableAvatarsThreshold && (userList.y + mainStack.y) > 0
} }
notificationMessage: {
var text = ""
if (keystateSource.data["Caps Lock"]["Locked"]) {
text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on")
if (root.notificationMessage) {
text += " • "
}
}
text += root.notificationMessage
return text
}
actionItems: [
ActionButton {
iconSource: "system-suspend"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel","Suspend to RAM","Sleep")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.suspend()
enabled: sddm.canSuspend
visible: !inputPanel.keyboardActive
},
ActionButton {
iconSource: "system-reboot"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.reboot()
enabled: sddm.canReboot
visible: !inputPanel.keyboardActive
},
ActionButton {
iconSource: "system-shutdown"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.powerOff()
enabled: sddm.canPowerOff
visible: !inputPanel.keyboardActive
},
ActionButton {
iconSource: "system-user-prompt"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "For switching to a username and password prompt", "Other…")
fontSize: parseInt(config.fontSize) + 1
onClicked: mainStack.push(userPromptComponent)
enabled: true
visible: !userListComponent.showUsernamePrompt && !inputPanel.keyboardActive
}]
onLoginRequest: {
//root.notificationMessage = ""
sddm.login("sven", password, sessionButton.currentIndex)
}
} }
Behavior on opacity { Behavior on opacity {
@ -358,6 +447,11 @@ Rectangle {
target: mainStack target: mainStack
y: Math.min(0, root.height - inputPanel.height - userListComponent.visibleBoundary) y: Math.min(0, root.height - inputPanel.height - userListComponent.visibleBoundary)
} }
PropertyChanges {
target: inputPanel
y: root.height - inputPanel.height
opacity: 1
}
}, },
State { State {
name: "hidden" name: "hidden"
@ -365,6 +459,11 @@ Rectangle {
target: mainStack target: mainStack
y: 0 y: 0
} }
PropertyChanges {
target: inputPanel
y: root.height - root.height/4
opacity: 0
}
} }
] ]
transitions: [ transitions: [
@ -372,6 +471,12 @@ Rectangle {
from: "hidden" from: "hidden"
to: "visible" to: "visible"
SequentialAnimation { SequentialAnimation {
ScriptAction {
script: {
inputPanel.item.activated = true;
Qt.inputMethod.show();
}
}
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: mainStack target: mainStack
@ -379,6 +484,17 @@ Rectangle {
duration: PlasmaCore.Units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation {
target: inputPanel
property: "y"
duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad
}
OpacityAnimator {
target: inputPanel
duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad
}
} }
} }
}, },
@ -393,6 +509,23 @@ Rectangle {
duration: PlasmaCore.Units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation {
target: inputPanel
property: "y"
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InQuad
}
OpacityAnimator {
target: inputPanel
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InQuad
}
}
ScriptAction {
script: {
inputPanel.item.activated = false;
Qt.inputMethod.hide();
}
} }
} }
} }
@ -404,6 +537,7 @@ Rectangle {
id: userPromptComponent id: userPromptComponent
Login { Login {
showUsernamePrompt: true showUsernamePrompt: true
notificationMessage: root.notificationMessage
loginScreenUiVisible: loginScreenRoot.uiVisible loginScreenUiVisible: loginScreenRoot.uiVisible
fontSize: parseInt(config.fontSize) + 2 fontSize: parseInt(config.fontSize) + 2
@ -418,6 +552,66 @@ Rectangle {
setProperty(0, "name", i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Type in Username and Password")); setProperty(0, "name", i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Type in Username and Password"));
} }
} }
onLoginRequest: {
root.notificationMessage = ""
sddm.login(username, password, sessionButton.currentIndex)
}
actionItems: [
ActionButton {
iconSource: "system-suspend"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel","Suspend to RAM","Sleep")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.suspend()
enabled: sddm.canSuspend
visible: !inputPanel.keyboardActive
},
ActionButton {
iconSource: "system-reboot"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.reboot()
enabled: sddm.canReboot
visible: !inputPanel.keyboardActive
},
ActionButton {
iconSource: "system-shutdown"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.powerOff()
enabled: sddm.canPowerOff
visible: !inputPanel.keyboardActive
},
ActionButton {
iconSource: "system-user-list"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","List Users")
fontSize: parseInt(config.fontSize) + 1
onClicked: mainStack.pop()
visible: !inputPanel.keyboardActive
}
]
}
}
DropShadow {
id: logoShadow
anchors.fill: logo
source: logo
visible: !softwareRendering && config.showlogo == "shown"
horizontalOffset: 1
verticalOffset: 1
radius: 6
samples: 14
spread: 0.3
color : "black" // shadows should always be black
opacity: loginScreenRoot.uiVisible ? 0 : 1
Behavior on opacity {
//OpacityAnimator when starting from 0 is buggy (it shows one frame with opacity 1)"
NumberAnimation {
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
} }
} }
@ -517,5 +711,12 @@ Rectangle {
playlist1.shuffle() playlist1.shuffle()
playlist2.shuffle() playlist2.shuffle()
} }
if (config.showLoginButton == "false") {
login_button.visible = false
password_input_box.anchors.rightMargin = 0
clear_passwd_button.anchors.rightMargin = 0
}
clear_passwd_button.visible = false
} }
} }