mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
remove buttom measurement for LockScreen
This commit is contained in:
@@ -684,54 +684,7 @@ Loader {
|
||||
radius: Style.radiusL
|
||||
color: Color.mSurface
|
||||
|
||||
// Measure text widths to determine minimum button width (for container width calculation)
|
||||
Item {
|
||||
id: buttonRowTextMeasurer
|
||||
visible: false
|
||||
property real iconSize: Settings.data.general.compactLockScreen ? Style.fontSizeM : Style.fontSizeL
|
||||
property real fontSize: Settings.data.general.compactLockScreen ? Style.fontSizeS : Style.fontSizeM
|
||||
property real spacing: Style.marginXS
|
||||
property real padding: 18 // Approximate horizontal padding per button
|
||||
|
||||
// Measure all button text widths
|
||||
NText {
|
||||
id: logoutText
|
||||
text: I18n.tr("common.logout")
|
||||
font.pointSize: buttonRowTextMeasurer.fontSize
|
||||
}
|
||||
NText {
|
||||
id: suspendText
|
||||
text: I18n.tr("common.suspend")
|
||||
font.pointSize: buttonRowTextMeasurer.fontSize
|
||||
}
|
||||
NText {
|
||||
id: hibernateText
|
||||
text: Settings.data.general.showHibernateOnLockScreen ? I18n.tr("common.hibernate") : ""
|
||||
font.pointSize: buttonRowTextMeasurer.fontSize
|
||||
}
|
||||
NText {
|
||||
id: rebootText
|
||||
text: I18n.tr("common.reboot")
|
||||
font.pointSize: buttonRowTextMeasurer.fontSize
|
||||
}
|
||||
NText {
|
||||
id: shutdownText
|
||||
text: I18n.tr("common.shutdown")
|
||||
font.pointSize: buttonRowTextMeasurer.fontSize
|
||||
}
|
||||
|
||||
// Calculate maximum width needed
|
||||
property real maxTextWidth: Math.max(logoutText.implicitWidth, Math.max(suspendText.implicitWidth, Math.max(hibernateText.implicitWidth, Math.max(rebootText.implicitWidth, shutdownText.implicitWidth))))
|
||||
property real minButtonWidth: maxTextWidth + iconSize + spacing + padding
|
||||
}
|
||||
|
||||
// Calculate minimum width based on button requirements
|
||||
// Button row needs: margins + buttons (4 or 5 depending on hibernate visibility) + spacings + margins
|
||||
// Plus ColumnLayout margins (14 on each side = 28 total)
|
||||
property int buttonCount: Settings.data.general.showHibernateOnLockScreen ? 5 : 4
|
||||
property int spacingCount: buttonCount - 1
|
||||
property real minButtonRowWidth: buttonRowTextMeasurer.minButtonWidth > 0 ? (buttonCount * buttonRowTextMeasurer.minButtonWidth) + (spacingCount * 10) + (2 * Style.marginM) + 28 + (2 * Style.marginM) : 750
|
||||
width: Math.max(750, minButtonRowWidth)
|
||||
width: Settings.data.general.showHibernateOnLockScreen ? 800 : 750
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
Reference in New Issue
Block a user