Remove unused charger control and sound code
This commit is contained in:
parent
866cb8f904
commit
d1139f4754
1 changed files with 0 additions and 67 deletions
|
@ -23,73 +23,6 @@ import "pages"
|
||||||
|
|
||||||
ApplicationWindow
|
ApplicationWindow
|
||||||
{
|
{
|
||||||
SoundEffect {
|
|
||||||
id: alertLow
|
|
||||||
volume: 0.6
|
|
||||||
source: settings.lowAlertFile
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SoundEffect {
|
|
||||||
id: alertHigh
|
|
||||||
volume: 0.6
|
|
||||||
source: settings.highAlertFile
|
|
||||||
}
|
|
||||||
|
|
||||||
Notification {
|
|
||||||
id: notification
|
|
||||||
property bool test: false
|
|
||||||
appName: qsTr("Battery Buddy")
|
|
||||||
appIcon: "/usr/share/icons/hicolor/128x128/apps/harbour-batterybuddy.png"
|
|
||||||
summary: qsTr("Battery charge", "Battery charge 20%") +" "+ battery.charge + "%"
|
|
||||||
body: test ? qsTr("This is a test.") : battery.charging ? qsTr("Please disconnect the charger.") : qsTr("Please connect the charger.")
|
|
||||||
previewSummary: summary
|
|
||||||
previewBody: body
|
|
||||||
urgency: Notification.Critical
|
|
||||||
function republish() {
|
|
||||||
if(replacesId > 0)
|
|
||||||
close()
|
|
||||||
publish()
|
|
||||||
}
|
|
||||||
function republishTest() {
|
|
||||||
test = true
|
|
||||||
republish()
|
|
||||||
test = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: alertTimer
|
|
||||||
interval: settings.interval * 1000
|
|
||||||
running: settings.notificationsEnabled
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: {
|
|
||||||
if(settings.notificationsEnabled && battery.charge <= settings.lowAlert && battery.state === "discharging") {
|
|
||||||
console.info("Battery notification timer: empty enough battery")
|
|
||||||
alertLow.play()
|
|
||||||
notification.republish()
|
|
||||||
}
|
|
||||||
else if((battery.charge >= settings.highAlert && battery.state === "charging")
|
|
||||||
|| (battery.charge === 100 && battery.state === "idle")) {
|
|
||||||
console.info("Battery notification timer: full enough battery")
|
|
||||||
alertHigh.play()
|
|
||||||
notification.republish()
|
|
||||||
}
|
|
||||||
else if(notification.replacesId > 0) {
|
|
||||||
console.info("Battery notification timer: close notification")
|
|
||||||
notification.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onRunningChanged: {
|
|
||||||
console.debug("alertTimer is " + (running ? "" : "not ") + "running")
|
|
||||||
if(notification.replacesId > 0) {
|
|
||||||
console.info("Battery notification timer: close notification")
|
|
||||||
notification.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initialPage: Component { MainPage { } }
|
initialPage: Component { MainPage { } }
|
||||||
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
||||||
allowedOrientations: Orientation.LandscapeMask | Orientation.Portrait
|
allowedOrientations: Orientation.LandscapeMask | Orientation.Portrait
|
||||||
|
|
Loading…
Reference in a new issue