Commit d052d9ed authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Battery as images.

parent e5f94796
...@@ -66,16 +66,20 @@ Page { ...@@ -66,16 +66,20 @@ Page {
Connections { Connections {
target: batterystatus target: batterystatus
onValueChanged: { onValueChanged: {
batterylbl.text = "Battery status: " + batterystatus.value if(batterystatus.value > 85) {
} batteryimg.source = "images/battery6.png"
} } else if (batterystatus.value <= 70) {
Connections { batteryimg.source = "images/battery5.png"
target: onbattery } else if (batterystatus.value <= 55) {
onValueChanged: { batteryimg.source = "images/battery4.png"
if (onbattery.value) { } else if (batterystatus.value <= 40) {
charging.text = "On battery" batteryimg.source = "images/battery3.png"
} else { } else if (batterystatus.value <= 25) {
charging.text = "On wall" 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 { ...@@ -85,22 +89,12 @@ Page {
key: "Battery.ChargePercentage" key: "Battery.ChargePercentage"
value: "100" value: "100"
} }
ContextProperty {
id: onbattery
key: "Battery.OnBattery"
}
tools: Item { tools: Item {
Label { Image {
id: batterylbl id: batteryimg
font.pointSize: 8
color: "black"
}
Label {
id: charging
font.pointSize: 8 font.pointSize: 8
color: "black" color: "black"
anchors.right: batterylbl.left
} }
} }
......
...@@ -23,5 +23,12 @@ ...@@ -23,5 +23,12 @@
<file>qml/images/textinput.png</file> <file>qml/images/textinput.png</file>
<file>qml/images/toolbar.png</file> <file>qml/images/toolbar.png</file>
<file>qml/images/graphics-wallpaper-home.jpg</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> </qresource>
</RCC> </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