1
0
Fork 0
mirror of https://github.com/vinceliuice/MacSequoia-kde.git synced 2024-10-16 03:30:47 +00:00
This commit is contained in:
vinceliuice 2024-10-11 12:45:01 +08:00
parent 7e73192f95
commit ef48bfe737

View file

@ -11,15 +11,11 @@ import Qt5Compat.GraphicalEffects
import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.private.keyboardindicator as KeyboardIndicator
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.breeze.components import org.kde.breeze.components
// TODO: Once SDDM 0.19 is released and we are setting the font size using the
// SDDM KCM's syncing feature, remove the `config.fontSize` overrides here and
// the fontSize properties in various components, because the theme's default
// font size will be correctly propagated to the login screen
Item { Item {
id: root id: root
@ -38,10 +34,9 @@ Item {
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true LayoutMirroring.childrenInherit: true
P5Support.DataSource { KeyboardIndicator.KeyState {
id: keystateSource id: capsLockState
engine: "keystate" key: Qt.Key_CapsLock
connectedSources: "Caps Lock"
} }
Item { Item {
@ -122,7 +117,7 @@ Item {
id: clockShadow id: clockShadow
anchors.fill: clock anchors.fill: clock
source: clock source: clock
visible: !softwareRendering visible: !softwareRendering && config.showClock === "true"
radius: 6 radius: 6
samples: 14 samples: 14
spread: 0.3 spread: 0.3
@ -138,7 +133,7 @@ Item {
Clock { Clock {
id: clock id: clock
property Item shadow: clockShadow property Item shadow: clockShadow
visible: y > 0 visible: y > 0 && config.showClock === "true"
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: (userListComponent.userList.y + mainStack.y)/2 - height/2 y: (userListComponent.userList.y + mainStack.y)/2 - height/2
Layout.alignment: Qt.AlignBaseline Layout.alignment: Qt.AlignBaseline
@ -175,7 +170,7 @@ Item {
initialItem: Login { initialItem: Login {
id: userListComponent id: userListComponent
userListModel: userModel userListModel: userModel
//loginScreenUiVisible: loginScreenRoot.uiVisible loginScreenUiVisible: loginScreenRoot.uiVisible
userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0
lastUserName: userModel.lastUser lastUserName: userModel.lastUser
showUserList: { showUserList: {
@ -197,8 +192,8 @@ Item {
notificationMessage: { notificationMessage: {
const parts = []; const parts = [];
if (keystateSource.data["Caps Lock"]["Locked"]) { if (capsLockState.locked) {
parts.push(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Caps Lock is on")); parts.push(i18nd("plasma-desktop-sddm-theme", "Caps Lock is on"));
} }
if (root.notificationMessage) { if (root.notificationMessage) {
parts.push(root.notificationMessage); parts.push(root.notificationMessage);
@ -209,32 +204,27 @@ Item {
actionItemsVisible: !inputPanel.keyboardActive actionItemsVisible: !inputPanel.keyboardActive
actionItems: [ actionItems: [
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/suspend_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/suspend_primary.svgz"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Suspend to RAM", "Sleep") text: i18ndc("plasma-desktop-sddm-theme", "Suspend to RAM", "Sleep")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.suspend() onClicked: sddm.suspend()
enabled: sddm.canSuspend enabled: sddm.canSuspend
}, },
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/restart_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/restart_primary.svgz"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart") text: i18nd("plasma-desktop-sddm-theme", "Restart")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.reboot() onClicked: sddm.reboot()
enabled: sddm.canReboot enabled: sddm.canReboot
}, },
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/shutdown_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/shutdown_primary.svgz"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down") text: i18nd("plasma-desktop-sddm-theme", "Shut Down")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.powerOff() onClicked: sddm.powerOff()
enabled: sddm.canPowerOff enabled: sddm.canPowerOff
}, },
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/switch_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/switch_primary.svgz"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "For switching to a username and password prompt", "Other…") text: i18ndc("plasma-desktop-sddm-theme", "For switching to a username and password prompt", "Other…")
fontSize: parseInt(config.fontSize) + 1
onClicked: mainStack.push(userPromptComponent) onClicked: mainStack.push(userPromptComponent)
enabled: true
visible: !userListComponent.showUsernamePrompt visible: !userListComponent.showUsernamePrompt
}] }]
@ -329,8 +319,8 @@ Item {
Login { Login {
showUsernamePrompt: true showUsernamePrompt: true
notificationMessage: root.notificationMessage notificationMessage: root.notificationMessage
//loginScreenUiVisible: loginScreenRoot.uiVisible loginScreenUiVisible: loginScreenRoot.uiVisible
fontSize: parseInt(config.fontSize) + 2 fontSize: Kirigami.Theme.defaultFont.pointSize + 2
// using a model rather than a QObject list to avoid QTBUG-75900 // using a model rather than a QObject list to avoid QTBUG-75900
userListModel: ListModel { userListModel: ListModel {
@ -340,7 +330,7 @@ Item {
} }
Component.onCompleted: { Component.onCompleted: {
// as we can't bind inside ListElement // as we can't bind inside ListElement
setProperty(0, "name", i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Type in Username and Password")); setProperty(0, "name", i18nd("plasma-desktop-sddm-theme", "Type in Username and Password"));
setProperty(0, "icon", Qt.resolvedUrl("faces/.face.icon")) setProperty(0, "icon", Qt.resolvedUrl("faces/.face.icon"))
} }
} }
@ -353,30 +343,26 @@ Item {
actionItemsVisible: !inputPanel.keyboardActive actionItemsVisible: !inputPanel.keyboardActive
actionItems: [ actionItems: [
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/suspend_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/suspend_primary.svgz"
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Suspend to RAM", "Sleep") text: i18ndc("plasma-desktop-sddm-theme", "Suspend to RAM", "Sleep")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.suspend() onClicked: sddm.suspend()
enabled: sddm.canSuspend enabled: sddm.canSuspend
}, },
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/restart_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/restart_primary.svgz"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart") text: i18nd("plasma-desktop-sddm-theme", "Restart")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.reboot() onClicked: sddm.reboot()
enabled: sddm.canReboot enabled: sddm.canReboot
}, },
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/shutdown_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/shutdown_primary.svgz"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down") text: i18nd("plasma-desktop-sddm-theme", "Shut Down")
fontSize: parseInt(config.fontSize) + 1
onClicked: sddm.powerOff() onClicked: sddm.powerOff()
enabled: sddm.canPowerOff enabled: sddm.canPowerOff
}, },
ActionButton { ActionButton {
iconSource: "/usr/share/sddm/themes/MacSequoia/assets/switch_primary.svgz" icon.name: "/usr/share/sddm/themes/MacSequoia/assets/switch_primary.svgz"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "List Users") text: i18nd("plasma-desktop-sddm-theme", "List Users")
fontSize: parseInt(config.fontSize) + 1
onClicked: mainStack.pop() onClicked: mainStack.pop()
} }
] ]
@ -450,8 +436,7 @@ Item {
PlasmaComponents3.ToolButton { PlasmaComponents3.ToolButton {
id: virtualKeyboardButton id: virtualKeyboardButton
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard") text: i18ndc("plasma-desktop-sddm-theme", "Button to show/hide virtual keyboard", "Virtual Keyboard")
font.pointSize: config.fontSize
icon.name: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off" icon.name: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off"
onClicked: { onClicked: {
// Otherwise the password field loses focus and virtual keyboard // Otherwise the password field loses focus and virtual keyboard
@ -473,8 +458,6 @@ Item {
KeyboardButton { KeyboardButton {
id: keyboardButton id: keyboardButton
font.pointSize: config.fontSize
onKeyboardLayoutChanged: { onKeyboardLayoutChanged: {
// Otherwise the password field loses focus and virtual keyboard // Otherwise the password field loses focus and virtual keyboard
// keystrokes get eaten // keystrokes get eaten
@ -493,8 +476,6 @@ Item {
SessionButton { SessionButton {
id: sessionButton id: sessionButton
font.pointSize: config.fontSize
onSessionChanged: { onSessionChanged: {
// Otherwise the password field loses focus and virtual keyboard // Otherwise the password field loses focus and virtual keyboard
// keystrokes get eaten // keystrokes get eaten
@ -515,16 +496,14 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
Battery { Battery {}
fontSize: config.fontSize
}
} }
} }
Connections { Connections {
target: sddm target: sddm
function onLoginFailed() { function onLoginFailed() {
notificationMessage = i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Login Failed") notificationMessage = i18nd("plasma-desktop-sddm-theme", "Login Failed")
footer.enabled = true footer.enabled = true
mainStack.enabled = true mainStack.enabled = true
userListComponent.userList.opacity = 1 userListComponent.userList.opacity = 1