Hide unavailable health/temp data

This commit is contained in:
Matti Viljanen 2021-05-23 14:25:24 +03:00
parent 645d919457
commit c6f9000aa9

View file

@ -177,10 +177,12 @@ Page {
MyDetailItem { MyDetailItem {
label: qsTr("Health:") label: qsTr("Health:")
value: healthText[battery.health] value: healthText[battery.health]
visible: value !== "unknown"
} }
MyDetailItem { MyDetailItem {
label: qsTr("Temperature:") label: qsTr("Temperature:")
value: battery.temperature === 0x7FFFFFFF ? healthText["unknown"] : formatTemperature(battery.temperature) value: battery.temperature === 0x7FFFFFFF ? healthText["unknown"] : formatTemperature(battery.temperature)
visible: battery.temperature !== 0x7FFFFFFF
function formatTemperature(temp) { function formatTemperature(temp) {
if(Qt.locale().measurementSystem === Locale.ImperialUSSystem) { if(Qt.locale().measurementSystem === Locale.ImperialUSSystem) {