From d5d654e01055fb3374c1ac63da0d7b85597aad3d Mon Sep 17 00:00:00 2001 From: lysec Date: Sun, 12 Oct 2025 11:04:35 +0200 Subject: [PATCH] LockScreen: add compact mode toggle in GeneralTab Settings: add lockscreen compact mode setting i18n: add translations --- Assets/Translations/de.json | 4 ++ Assets/Translations/en.json | 4 ++ Assets/Translations/es.json | 4 ++ Assets/Translations/fr.json | 4 ++ Assets/Translations/pt.json | 4 ++ Assets/Translations/zh-CN.json | 4 ++ Commons/Settings.qml | 1 + Modules/LockScreen/LockScreen.qml | 101 ++++++++++++++++++++++----- Modules/Settings/Tabs/GeneralTab.qml | 7 ++ 9 files changed, 114 insertions(+), 19 deletions(-) diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index d62d629c..16d3042d 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -26,6 +26,10 @@ "label": "Desktop abdunkeln", "description": "Desktop abdunkeln, wenn Panels oder Menüs geöffnet sind." }, + "compact-lockscreen": { + "label": "Kompakter Sperrbildschirm", + "description": "Zeigt nur die Anmeldeeingabe und Systemsteuerungen an, versteckt Wetter- und Medien-Widgets." + }, "border-radius": { "label": "Eckenradius", "description": "Steuert die Rundung der Ecken von Fenstern, Buttons und anderen Elementen." diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 30f62d4c..41800513 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -26,6 +26,10 @@ "label": "Dim desktop", "description": "Dim the desktop when panels or menus are open." }, + "compact-lockscreen": { + "label": "Compact lock screen", + "description": "Show only the login input and system controls, hiding weather and media widgets." + }, "border-radius": { "label": "Border radius", "description": "Controls the corner roundness of windows, buttons, and other elements." diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index ee6c4843..6602519f 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -26,6 +26,10 @@ "label": "Atenuar escritorio", "description": "Atenúa el escritorio cuando los paneles o menús están abiertos." }, + "compact-lockscreen": { + "label": "Pantalla de bloqueo compacta", + "description": "Muestra solo la entrada de inicio de sesión y controles del sistema, ocultando widgets de clima y medios." + }, "border-radius": { "label": "Radio del borde", "description": "Controla la redondez de las esquinas de ventanas, botones y otros elementos." diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index e79310b5..d62cace9 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -26,6 +26,10 @@ "label": "Assombrir le bureau", "description": "Assombrir le bureau lorsque des panneaux ou des menus sont ouverts." }, + "compact-lockscreen": { + "label": "Écran de verrouillage compact", + "description": "Affiche uniquement la saisie de connexion et les contrôles système, masquant les widgets météo et média." + }, "border-radius": { "label": "Rayon de bordure", "description": "Contrôle l'arrondi des coins des fenêtres, des boutons et d'autres éléments." diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index efe785a6..25522957 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -26,6 +26,10 @@ "label": "Escurecer área de trabalho", "description": "Escurece a área de trabalho quando painéis ou menus estão abertos." }, + "compact-lockscreen": { + "label": "Tela de bloqueio compacta", + "description": "Mostra apenas a entrada de login e controles do sistema, ocultando widgets de clima e mídia." + }, "border-radius": { "label": "Raio da borda", "description": "Controla o arredondamento dos cantos de janelas, botões e outros elementos." diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 2efff789..3bbe1d89 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -26,6 +26,10 @@ "label": "调暗桌面", "description": "当面板或菜单打开时调暗桌面。" }, + "compact-lockscreen": { + "label": "紧凑锁屏", + "description": "仅显示登录输入和系统控件,隐藏天气和媒体小部件。" + }, "border-radius": { "label": "边框圆角", "description": "控制窗口、按钮及其他元素的边角圆度。" diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 18a9286f..af6c0598 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -187,6 +187,7 @@ Singleton { property real screenRadiusRatio: 1.0 property real animationSpeed: 1.0 property bool animationDisabled: false + property bool compactLockScreen: false } // location diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 0f62b8b9..a4f1d16d 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -253,7 +253,7 @@ Loader { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 100 * scaling - radius: 32 * scaling + radius: Style.radiusL * scaling color: Color.mSurface border.color: Qt.alpha(Color.mOutline, 0.2) border.width: 1 @@ -317,11 +317,6 @@ Loader { } } - // Spacer to center the text section - Item { - Layout.fillWidth: true - } - // Center: User Info Column (left-aligned text) ColumnLayout { Layout.alignment: Qt.AlignVCenter @@ -346,12 +341,12 @@ Loader { } } - // Spacer to push cool time to the right + + // Spacer to push time to the right Item { Layout.fillWidth: true } - // Right side: Cool Time (from Calendar) Item { Layout.preferredWidth: 70 * scaling Layout.preferredHeight: 70 * scaling @@ -469,17 +464,82 @@ Loader { } } + // Compact status indicators container (compact mode only) + Rectangle { + width: { + var hasBattery = UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent + var hasKeyboard = keyboardLayout.currentLayout !== "Unknown" + + if (hasBattery && hasKeyboard) { + return 200 * scaling + } else if (hasBattery || hasKeyboard) { + return 120 * scaling + } else { + return 0 + } + } + height: 40 * scaling + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 96 * scaling + (Settings.data.general.compactLockScreen ? 116 * scaling : 220 * scaling) + topLeftRadius: Style.radiusL * scaling + topRightRadius: Style.radiusL * scaling + color: Color.mSurface + visible: Settings.data.general.compactLockScreen && ((UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent) || keyboardLayout.currentLayout !== "Unknown") + + RowLayout { + anchors.centerIn: parent + spacing: 16 * scaling + + // Battery indicator + RowLayout { + spacing: 6 * scaling + visible: UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent + + NIcon { + icon: BatteryService.getIcon(Math.round(UPower.displayDevice.percentage * 100), UPower.displayDevice.state === UPowerDeviceState.Charging, true) + pointSize: Style.fontSizeM * scaling + color: UPower.displayDevice.state === UPowerDeviceState.Charging ? Color.mPrimary : Color.mOnSurfaceVariant + } + + NText { + text: Math.round(UPower.displayDevice.percentage * 100) + "%" + color: Color.mOnSurfaceVariant + pointSize: Style.fontSizeM * scaling + font.weight: Font.Medium + } + } + + // Keyboard layout indicator + RowLayout { + spacing: 6 * scaling + visible: keyboardLayout.currentLayout !== "Unknown" + + NIcon { + icon: "keyboard" + pointSize: Style.fontSizeM * scaling + color: Color.mOnSurfaceVariant + } + + NText { + text: keyboardLayout.currentLayout + color: Color.mOnSurfaceVariant + pointSize: Style.fontSizeM * scaling + font.weight: Font.Medium + } + } + } + } + // Bottom container with weather, password input and controls Rectangle { width: 750 * scaling - height: 220 * scaling + height: Settings.data.general.compactLockScreen ? 120 * scaling : 220 * scaling anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: 100 * scaling - radius: 32 * scaling + radius: Style.radiusL * scaling color: Color.mSurface - border.color: Qt.alpha(Color.mOutline, 0.2) - border.width: 1 ColumnLayout { anchors.fill: parent @@ -491,7 +551,7 @@ Loader { Layout.fillWidth: true Layout.preferredHeight: 65 * scaling spacing: 18 * scaling - visible: LocationService.coordinatesReady && LocationService.data.weather !== null + visible: !Settings.data.general.compactLockScreen && LocationService.coordinatesReady && LocationService.data.weather !== null // Media widget with visualizer Rectangle { @@ -695,14 +755,13 @@ Loader { } } - // Battery and Keyboard Layout - ColumnLayout { + // Battery and Keyboard Layout (full mode only) + RowLayout { Layout.preferredWidth: 60 * scaling spacing: 4 * scaling + // Battery RowLayout { - Layout.preferredWidth: 60 * scaling - Layout.preferredHeight: 22 * scaling spacing: 4 * scaling visible: UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent @@ -720,10 +779,10 @@ Loader { } } + // Keyboard Layout RowLayout { - Layout.preferredWidth: 60 * scaling - Layout.preferredHeight: 22 * scaling spacing: 4 * scaling + visible: keyboardLayout.currentLayout !== "Unknown" NIcon { icon: "keyboard" @@ -739,8 +798,10 @@ Loader { } } } + } + // Password input RowLayout { Layout.fillWidth: true @@ -750,6 +811,7 @@ Loader { Layout.preferredWidth: Style.marginM * scaling } + Rectangle { Layout.fillWidth: true Layout.preferredHeight: 48 * scaling @@ -894,6 +956,7 @@ Loader { } } + Item { Layout.preferredWidth: Style.marginM * scaling } diff --git a/Modules/Settings/Tabs/GeneralTab.qml b/Modules/Settings/Tabs/GeneralTab.qml index 4f9183a1..558a8860 100644 --- a/Modules/Settings/Tabs/GeneralTab.qml +++ b/Modules/Settings/Tabs/GeneralTab.qml @@ -89,6 +89,13 @@ ColumnLayout { onToggled: checked => Settings.data.ui.tooltipsEnabled = checked } + NToggle { + label: I18n.tr("settings.general.ui.compact-lockscreen.label") + description: I18n.tr("settings.general.ui.compact-lockscreen.description") + checked: Settings.data.general.compactLockScreen + onToggled: checked => Settings.data.general.compactLockScreen = checked + } + ColumnLayout { spacing: Style.marginXXS * scaling Layout.fillWidth: true