Align battery keep awake naming and slider

This commit is contained in:
art0rz
2025-11-22 17:03:39 +01:00
parent 5cc71b4da2
commit ba8733c5c0
11 changed files with 37 additions and 40 deletions
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Entladerate: {rate} W.",
"health": "Zustand: {percent}%",
"inhibit-idle-description": "Hält das System wach.",
"inhibit-idle-label": "Ruhezustand verhindern",
"inhibit-idle-label": "Wach halten",
"idle": "Leerlauf.",
"no-battery-detected": "Keine Batterie erkannt.",
"panel-title": "Akku",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Discharging rate: {rate} W",
"health": "Health: {percent}%",
"inhibit-idle-description": "Keeps the system awake.",
"inhibit-idle-label": "Prevent sleep",
"inhibit-idle-label": "Keep awake",
"idle": "Idle",
"no-battery-detected": "No battery detected",
"panel-title": "Battery",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Tasa de descarga: {rate} W.",
"health": "Salud: {percent}%",
"inhibit-idle-description": "Mantiene el sistema despierto.",
"inhibit-idle-label": "Evitar suspensión",
"inhibit-idle-label": "Mantener despierto",
"idle": "Inactivo.",
"no-battery-detected": "No se detectó ninguna batería.",
"panel-title": "Batería",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Taux de décharge : {rate} W.",
"health": "État : {percent}%",
"inhibit-idle-description": "Maintient le système éveillé.",
"inhibit-idle-label": "Empêcher la veille",
"inhibit-idle-label": "Garder éveillé",
"idle": "Inactif.",
"no-battery-detected": "Aucune batterie détectée.",
"panel-title": "Batterie",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Ontlaadsnelheid: {rate} W.",
"health": "Gezondheid: {percent}%",
"inhibit-idle-description": "Houdt het systeem wakker.",
"inhibit-idle-label": "Slaapstand voorkomen",
"inhibit-idle-label": "Wakker houden",
"idle": "In rust.",
"no-battery-detected": "Geen batterij gedetecteerd.",
"panel-title": "Batterij",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Taxa de descarregamento: {rate} W.",
"health": "Saúde: {percent}%",
"inhibit-idle-description": "Mantém o sistema acordado.",
"inhibit-idle-label": "Impedir suspensão",
"inhibit-idle-label": "Manter acordado",
"idle": "Ocioso.",
"no-battery-detected": "Nenhuma bateria detectada.",
"panel-title": "Bateria",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Скорость разрядки: {rate} Вт.",
"health": "Здоровье: {percent}%",
"inhibit-idle-description": "Не дает системе уснуть.",
"inhibit-idle-label": "Запрет сна",
"inhibit-idle-label": "Не давать засыпать",
"idle": "Простой.",
"no-battery-detected": "Батарея не обнаружена.",
"panel-title": "Батарея",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Deşarj oranı: {rate} W.",
"health": "Sağlık: {percent}%",
"inhibit-idle-description": "Sistemi uyanık tutar.",
"inhibit-idle-label": "Uykuya engelle",
"inhibit-idle-label": "Uyanık tut",
"idle": "Boşta.",
"no-battery-detected": "Pil tespit edilmedi.",
"panel-title": "Pil",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "Швидкість розрядки: {rate} Вт.",
"health": "Здоров'я: {percent}%",
"inhibit-idle-description": "Підтримує систему активною.",
"inhibit-idle-label": "Запобігати сну",
"inhibit-idle-label": "Не давати заснути",
"idle": "Бездіяльність.",
"no-battery-detected": "Батарею не виявлено.",
"panel-title": "Батарея",
+1 -1
View File
@@ -389,7 +389,7 @@
"discharging-rate": "放电速率:{rate} W。",
"health": "健康状况:{percent}%",
"inhibit-idle-description": "保持系统唤醒。",
"inhibit-idle-label": "防止睡眠",
"inhibit-idle-label": "保持唤醒",
"idle": "空闲。",
"no-battery-detected": "未检测到电池。",
"panel-title": "电池",
+27 -30
View File
@@ -22,6 +22,7 @@ SmartPanel {
readonly property bool healthSupported: isReady && battery.healthSupported
readonly property bool healthAvailable: healthSupported
readonly property int healthPercent: healthAvailable ? Math.round(battery.healthPercentage) : -1
readonly property var powerProfiles: [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance]
readonly property string timeText: {
if (!isReady)
return I18n.tr("battery.no-battery-detected");
@@ -202,26 +203,38 @@ SmartPanel {
enabled: profilesAvailable
onPressedChanged: function (pressed, v) {
if (!pressed) {
setProfileByIndex(Math.round(v));
setProfileByIndex(v);
}
}
onMoved: function (v) {
profileIndex = Math.round(v);
profileIndex = v;
}
}
NToggle {
RowLayout {
Layout.fillWidth: true
checked: manualInhibitActive
label: I18n.tr("battery.inhibit-idle-label")
description: I18n.tr("battery.inhibit-idle-description")
onToggled: function (checked) {
if (checked) {
IdleInhibitorService.addManualInhibitor(null);
} else {
IdleInhibitorService.removeManualInhibitor();
spacing: Style.marginS
NIcon {
icon: manualInhibitActive ? "keep-awake-on" : "keep-awake-off"
pointSize: Style.fontSizeL
color: manualInhibitActive ? Color.mPrimary : Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignVCenter
}
NToggle {
Layout.fillWidth: true
checked: manualInhibitActive
label: I18n.tr("battery.inhibit-idle-label")
description: I18n.tr("battery.inhibit-idle-description")
onToggled: function (checked) {
if (checked) {
IdleInhibitorService.addManualInhibitor(null);
} else {
IdleInhibitorService.removeManualInhibitor();
}
manualInhibitActive = checked;
}
manualInhibitActive = checked;
}
}
}
@@ -230,27 +243,11 @@ SmartPanel {
}
function profileToIndex(p) {
switch (p) {
case PowerProfile.PowerSaver:
return 0;
case PowerProfile.Balanced:
return 1;
case PowerProfile.Performance:
return 2;
default:
return 1;
}
return powerProfiles.indexOf(p) ?? 1;
}
function indexToProfile(idx) {
switch (idx) {
case 0:
return PowerProfile.PowerSaver;
case 2:
return PowerProfile.Performance;
default:
return PowerProfile.Balanced;
}
return powerProfiles[idx] ?? PowerProfile.Balanced;
}
function setProfileByIndex(idx) {