import QtQuick 2.0 import Sailfish.Silica 1.0 CoverBackground { id: cover // Guardie: quando lo snapshot non è ancora arrivato i campi mancano e in // JS leggere una proprietà di undefined solleva un'eccezione. function num(v, fallback) { return (v === undefined || v === null) ? fallback : v } Column { anchors.centerIn: parent width: parent.width - 2 * Theme.paddingLarge spacing: Theme.paddingSmall Label { text: "Server" font.pixelSize: Theme.fontSizeSmall color: Theme.secondaryColor anchors.horizontalCenter: parent.horizontalCenter } Label { text: statusClient.error !== "" ? "—" : statusClient.fmtNum(num(statusClient.data.cpu ? statusClient.data.cpu.percent : undefined, -1), 0) + " %" font.pixelSize: Theme.fontSizeExtraLarge anchors.horizontalCenter: parent.horizontalCenter } Label { text: "CPU" font.pixelSize: Theme.fontSizeExtraSmall color: Theme.secondaryColor anchors.horizontalCenter: parent.horizontalCenter } Label { text: statusClient.fetchedAt !== "" ? statusClient.fetchedAt : "" font.pixelSize: Theme.fontSizeExtraSmall color: Theme.secondaryColor anchors.horizontalCenter: parent.horizontalCenter } } CoverActionList { CoverAction { iconSource: "image://theme/icon-cover-refresh" onTriggered: statusClient.refresh() } } }