mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Battery: change panel labels
This commit is contained in:
@@ -1457,11 +1457,10 @@
|
||||
"charging": "Charging.",
|
||||
"discharging": "Discharging.",
|
||||
"panel": {
|
||||
"title": "Charging mode",
|
||||
"full": "Full capacity",
|
||||
"balanced": "Balanced",
|
||||
"conservative": "Conservative",
|
||||
"footer": "Charging threshold set to {limit}%"
|
||||
"title": "Charge threshold",
|
||||
"full": "Full capacity ({percentage}%)",
|
||||
"balanced": "Balanced ({percentage}%)",
|
||||
"lifespan": "Extended lifespan ({percentage}%)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ NPanel {
|
||||
id: root
|
||||
|
||||
preferredWidth: 300
|
||||
preferredHeight: 200
|
||||
preferredHeight: 210
|
||||
panelKeyboardFocus: true
|
||||
|
||||
property var optionsModel: []
|
||||
@@ -27,7 +27,7 @@ NPanel {
|
||||
"icon": "battery-3"
|
||||
}, {
|
||||
"id": BatteryService.ChargingMode.Conservative,
|
||||
"label": "battery.panel.conservative",
|
||||
"label": "battery.panel.lifespan",
|
||||
"icon": "battery-2"
|
||||
}]
|
||||
root.optionsModel = newOptions
|
||||
@@ -50,12 +50,6 @@ NPanel {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
NIcon {
|
||||
icon: optionsModel[BatteryService.chargingMode].icon
|
||||
pointSize: Style.fontSizeXXL * scaling
|
||||
color: Color.mPrimary
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("battery.panel.title")
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
@@ -88,7 +82,9 @@ NPanel {
|
||||
NRadioButton {
|
||||
ButtonGroup.group: batteryGroup
|
||||
required property var modelData
|
||||
text: I18n.tr(modelData.label)
|
||||
text: I18n.tr(modelData.label, {
|
||||
"percentage": BatteryService.getThresholdValue(modelData.id)
|
||||
})
|
||||
checked: BatteryService.chargingMode === modelData.id
|
||||
onClicked: {
|
||||
BatteryService.setChargingMode(modelData.id)
|
||||
|
||||
@@ -43,8 +43,8 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function getThresholdValue() {
|
||||
switch (BatteryService.chargingMode) {
|
||||
function getThresholdValue(chargingMode) {
|
||||
switch (chargingMode) {
|
||||
case BatteryService.ChargingMode.Full:
|
||||
return "100"
|
||||
case BatteryService.ChargingMode.Balanced:
|
||||
@@ -69,7 +69,7 @@ Singleton {
|
||||
// uses toast messages so the flag is passed to supress notifs
|
||||
command.push("-q")
|
||||
|
||||
command.push(BatteryService.getThresholdValue())
|
||||
command.push(BatteryService.getThresholdValue(BatteryService.chargingMode))
|
||||
BatteryService.hideSuccessToast = hideToast
|
||||
|
||||
setterProcess.command = command
|
||||
@@ -94,7 +94,7 @@ Singleton {
|
||||
if (exitCode === 0) {
|
||||
Logger.log("BatteryService", "Battery threshold set successfully")
|
||||
if (!BatteryService.hideSuccessToast) {
|
||||
ToastService.showNotice("Battery Manager", `Battery threshold set to ${BatteryService.getThresholdValue()}%`)
|
||||
ToastService.showNotice("Battery Manager", `Battery threshold set to ${BatteryService.getThresholdValue(BatteryService.chargingMode)}%`)
|
||||
}
|
||||
} else if (exitCode === 2) {
|
||||
// Initial setup required - show toast and run installer
|
||||
|
||||
Reference in New Issue
Block a user