This commit is contained in:
Valeria Fadeeva 2024-09-23 13:35:50 +05:00
parent 9b2ef74aa5
commit e3fb0eca9f
2 changed files with 11 additions and 174 deletions

View File

@ -12,7 +12,7 @@ import org.kde.coreaddons 1.0 as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import org.kde.kwindowsystem 1.0
//import QtGraphicalEffects 1.0
import Qt5Compat.GraphicalEffects
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.components 3.0 as PlasmaComponents3
@ -54,16 +54,16 @@ RowLayout{
// Crop the avatar to fit in a circle, like the lock and login screens
// but don't on software rendering where this won't render
layer.enabled: true // iconUser.GraphicsInfo.api !== GraphicsInfo.Software
//layer.effect: OpacityMask {
// // this Rectangle is a circle due to radius size
// maskSource: Rectangle {
// width: iconUser.width
// height: iconUser.height
// radius: height / 2
// visible: false
// }
//}
layer.enabled:true // iconUser.GraphicsInfo.api !== GraphicsInfo.Software
layer.effect: OpacityMask {
// this Rectangle is a circle due to radius size
maskSource: Rectangle {
width: iconUser.width
height: iconUser.height
radius: height / 2
visible: false
}
}
}

View File

@ -1,163 +0,0 @@
import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.12
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.kicker 0.1 as Kicker
import org.kde.coreaddons 1.0 as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import org.kde.kwindowsystem 1.0
//import QtGraphicalEffects 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.quicklaunch 1.0
import org.kde.kirigami as Kirigami
import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.private.sessions as Sessions
RowLayout{
spacing: Kirigami.Units.largeSpacing
KCoreAddons.KUser { id: kuser }
Logic { id: logic }
P5Support.DataSource {
id: pmEngine
engine: "powermanagement"
connectedSources: ["PowerDevil", "Sleep States"]
function performOperation(what) {
var service = serviceForSource("PowerDevil")
var operation = service.operationDescription(what)
service.startOperationCall(operation)
}
}
Image {
id: iconUser
source: kuser.faceIconUrl.toString() || "user-identity"
cache: false
visible: source !== ""
sourceSize.height: parent.height * 0.9
sourceSize.width: parent.height * 0.9
fillMode: Image.PreserveAspectFit
Layout.alignment: Qt.AlignVCenter
// Crop the avatar to fit in a circle, like the lock and login screens
// but don't on software rendering where this won't render
layer.enabled: true // iconUser.GraphicsInfo.api !== GraphicsInfo.Software
//layer.effect: OpacityMask {
// // this Rectangle is a circle due to radius size
// maskSource: Rectangle {
// width: iconUser.width
// height: iconUser.height
// radius: height / 2
// visible: false
// }
//}
}
PlasmaExtras.Heading {
wrapMode: Text.NoWrap
color: Kirigami.Theme.textColor
level: 3
font.bold: true
//font.weight: Font.Bold
text: qsTr(kuser.fullName)
}
Item{
Layout.fillWidth: true
}
Sessions.SessionManagement {
id: sm
}
Sessions.SessionsModel {
id: sessionsModel
}
PlasmaComponents3.ToolButton {
icon.name: "user-home"
onClicked: logic.openUrl("file:///usr/share/applications/org.kde.dolphin.desktop")
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("User Home")
}
PlasmaComponents3.ToolButton {
icon.name: "configure"
onClicked: logic.openUrl("file:///usr/share/applications/systemsettings.desktop")
ToolTip.delay: 1000
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("System Preferences")
}
PlasmaComponents3.ToolButton {
icon.name: "system-suspend"
onClicked: sm.suspend()
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Suspend")
}
PlasmaComponents3.ToolButton {
icon.name: "system-suspend-hibernate"
onClicked: sm.suspendThenHibernate()
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Hybernate")
}
PlasmaComponents3.ToolButton {
icon.name: "system-log-out"
onClicked: sm.requestLogout()
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Logout")
}
PlasmaComponents3.ToolButton {
icon.name: "system-lock-screen"
onClicked: pmEngine.performOperation("lockScreen")
enabled: pmEngine.data["Sleep States"]["LockScreen"]
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Lock Screen")
}
PlasmaComponents3.ToolButton {
icon.name: "system-reboot"
onClicked: sm.requestReboot()
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Reboot")
}
PlasmaComponents3.ToolButton {
icon.name: "system-shutdown"
onClicked: sm.requestShutdown()
ToolTip.delay: 200
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Shutdown")
}
}