From a0c7519b23999c32e376cd936fe5c42742a82e73 Mon Sep 17 00:00:00 2001 From: Damian D'Souza Date: Mon, 13 Oct 2025 01:05:29 +0200 Subject: [PATCH] BatteryPanel: change content based on battery manager enabled state --- Modules/Bar/Battery/BatteryPanel.qml | 59 ++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/Modules/Bar/Battery/BatteryPanel.qml b/Modules/Bar/Battery/BatteryPanel.qml index d14dcb9e..72b67f4c 100644 --- a/Modules/Bar/Battery/BatteryPanel.qml +++ b/Modules/Bar/Battery/BatteryPanel.qml @@ -10,7 +10,7 @@ import qs.Widgets NPanel { id: root - preferredWidth: 300 + preferredWidth: 350 preferredHeight: 210 panelKeyboardFocus: true @@ -83,20 +83,53 @@ NPanel { id: batteryGroup } - Repeater { - model: optionsModel + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: Color.transparent - NRadioButton { - ButtonGroup.group: batteryGroup - required property var modelData - text: I18n.tr(modelData.label, { - "percent": BatteryService.getThresholdValue(modelData.id) - }) - checked: BatteryService.chargingMode === modelData.id - onClicked: { - BatteryService.setChargingMode(modelData.id) + ColumnLayout { + anchors.fill: parent + spacing: Style.marginM * scaling + + Repeater { + model: optionsModel + + NRadioButton { + visible: BatteryService.chargingMode !== BatteryService.ChargingMode.Disabled + ButtonGroup.group: batteryGroup + required property var modelData + text: I18n.tr(modelData.label, { + "percent": BatteryService.getThresholdValue(modelData.id) + }) + checked: BatteryService.chargingMode === modelData.id + onClicked: { + BatteryService.setChargingMode(modelData.id) + } + Layout.fillWidth: true + } + } + } + + ColumnLayout { + visible: BatteryService.chargingMode === BatteryService.ChargingMode.Disabled + anchors.fill: parent + spacing: Style.marginM * scaling + + Item { + Layout.fillHeight: true + } + + NText { + text: I18n.tr("battery.panel.disabled") + pointSize: Style.fontSizeL * scaling + color: Color.mOnSurfaceVariant + Layout.alignment: Qt.AlignHCenter + } + + Item { + Layout.fillHeight: true } - Layout.fillWidth: true } } }