mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-18 17:15:20 -04:00
feat: port critical battery alert from DankBatteryAlerts plugin (#2664)
* feat: port critical battery alert from DankBatteryAlerts plugin * ui: shorten notification type labels * refactor: remove duplicate battery charge limit from Power & Sleep
This commit is contained in:
@@ -244,7 +244,7 @@ done
|
||||
settingKey: "batteryNotificationType"
|
||||
text: I18n.tr("Notification Type")
|
||||
description: I18n.tr("Choose how to be notified about battery alerts.")
|
||||
model: [I18n.tr("Toast Overlay"), I18n.tr("System Notification")]
|
||||
model: [I18n.tr("Toast"), I18n.tr("Notification")]
|
||||
currentIndex: SettingsData.batteryNotificationType
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (selected) {
|
||||
@@ -260,6 +260,40 @@ done
|
||||
checked: SettingsData.batteryAutoPowerSaver
|
||||
onToggled: checked => SettingsData.set("batteryAutoPowerSaver", checked)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.outline
|
||||
opacity: 0.15
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Critical Battery Alert")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.DemiBold
|
||||
color: Theme.surfaceText
|
||||
topPadding: Theme.spacingM
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
settingKey: "batteryCriticalThreshold"
|
||||
text: I18n.tr("Critical Threshold")
|
||||
description: I18n.tr("Battery percentage to trigger a critical alert.")
|
||||
value: SettingsData.batteryCriticalThreshold
|
||||
minimum: 1
|
||||
maximum: 30
|
||||
defaultValue: 10
|
||||
onSliderValueChanged: newValue => SettingsData.set("batteryCriticalThreshold", newValue)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "batteryNotifyCritical"
|
||||
text: I18n.tr("Critical Battery Notifications")
|
||||
description: I18n.tr("Show an urgent alert when battery reaches critical level.")
|
||||
checked: SettingsData.batteryNotifyCritical
|
||||
onToggled: checked => SettingsData.set("batteryNotifyCritical", checked)
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Power Profiles Card
|
||||
|
||||
@@ -603,26 +603,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "tune"
|
||||
title: I18n.tr("Advanced")
|
||||
settingKey: "powerAdvanced"
|
||||
collapsible: true
|
||||
expanded: false
|
||||
|
||||
SettingsSliderRow {
|
||||
settingKey: "batteryChargeLimit"
|
||||
tags: ["battery", "charge", "limit", "percentage", "power"]
|
||||
text: I18n.tr("Battery Charge Limit")
|
||||
description: I18n.tr("Note: this only changes the percentage, it does not actually limit charging.")
|
||||
value: SettingsData.batteryChargeLimit
|
||||
minimum: 50
|
||||
maximum: 100
|
||||
defaultValue: 100
|
||||
onSliderValueChanged: newValue => SettingsData.set("batteryChargeLimit", newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user