Commit d052d9ed authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Battery as images.

parent e5f94796
......@@ -66,16 +66,20 @@ Page {
Connections {
target: batterystatus
onValueChanged: {
batterylbl.text = "Battery status: " + batterystatus.value
}
}
Connections {
target: onbattery
onValueChanged: {
if (onbattery.value) {
charging.text = "On battery"
} else {
charging.text = "On wall"
if(batterystatus.value > 85) {
batteryimg.source = "images/battery6.png"
} else if (batterystatus.value <= 70) {
batteryimg.source = "images/battery5.png"
} else if (batterystatus.value <= 55) {
batteryimg.source = "images/battery4.png"
} else if (batterystatus.value <= 40) {
batteryimg.source = "images/battery3.png"
} else if (batterystatus.value <= 25) {
batteryimg.source = "images/battery2.png"
} else if (batterystatus.value <= 10) {
batteryimg.source = "images/battery1.png"
} else if (batterystatus.value <= 5) {
batteryimg.source = "images/battery0.png"
}
}
}
......@@ -85,22 +89,12 @@ Page {
key: "Battery.ChargePercentage"
value: "100"
}
ContextProperty {
id: onbattery
key: "Battery.OnBattery"
}
tools: Item {
Label {
id: batterylbl
font.pointSize: 8
color: "black"
}
Label {
id: charging
Image {
id: batteryimg
font.pointSize: 8
color: "black"
anchors.right: batterylbl.left
}
}
......
......@@ -23,5 +23,12 @@
<file>qml/images/textinput.png</file>
<file>qml/images/toolbar.png</file>
<file>qml/images/graphics-wallpaper-home.jpg</file>
<file>qml/images/battery0.png</file>
<file>qml/images/battery1.png</file>
<file>qml/images/battery2.png</file>
<file>qml/images/battery3.png</file>
<file>qml/images/battery4.png</file>
<file>qml/images/battery5.png</file>
<file>qml/images/battery6.png</file>
</qresource>
</RCC>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment