import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.5 import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 import com.gfa.ipc.appctrl 1.0 Rectangle { width: 800 height: 480 ///////////////////////////////////////////////////////////////////////////////////////////////// function sec2HMS(sec, prec) { if(!prec) prec = 0; var d = parseInt(sec / 86400); sec -= d * 86400; var h = parseInt(sec / 3600); sec -= h * 3600; var m = parseInt(sec / 60); sec -= m * 60; return (d ? qsTr("%1d ").arg(d) : qsTr("")) + qsTr("%1:").arg(h) + qsTr("0%1:").arg(m).slice(-3) + qsTr("0%1").arg(sec.toFixed(prec)).slice(-(prec ? prec + 3 : 2)); } function formatByteSize(bytes, prec) { var s; if(!prec) prec = 1; if(bytes < 1024) s = "%1 B".arg(bytes); else { var a = ["KiB", "MiB", "GiB"/*, "TiB", "PiB", "EiB"*/]; var e = parseInt(1 << (a.length * 10)); var i; for(i = a.length - 1; (i > 0) && (e > bytes); --i, e >>= 10) ; s = qsTr("%1 %2").arg((bytes / e).toFixed(prec)).arg(a[i]); } return s; } ///////////////////////////////////////////////////////////////////////////////////////////////// Rectangle { x: 10 y: 10 width: parent.width - 20 height: 30 radius: 5 border.width: 1 border.color: "black" color: qGfaAppCtrl.sysInfoRunning ? "lightgreen" : "red" Image { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter fillMode: Image.PreserveAspectFit height: parent.height source: "qrc:/img/blank.png" } Text { font.pixelSize: 16 font.bold: true anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent text: "System Info" } Image { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter fillMode: Image.PreserveAspectFit height: parent.height source: "qrc:/img/next.png" MouseArea { anchors.fill: parent onClicked: { idPageLoader.source = "qml/appctrl.qml" } } } } ///////////////////////////////////////////////////////////////////////////////////////////////// Rectangle { x: 10 y: 50 width: 250 height: 30 border.width: 1 border.color: "black" radius: 5 Text { font.pixelSize: 14 font.bold: true anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent text: "Sitara" } } ///////////////////////////////////////////////////////////////////////////////////////////////// Rectangle { x: 10 y: 90 width: 120 height: 420 Rectangle { x: 0 y: 0 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Boot from:" } } Rectangle { x: 0 y: 30 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Mem. total:" } } Rectangle { x: 0 y: 60 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Mem. free:" } } Rectangle { x: 0 y: 90 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Mem. used:" } } Rectangle { x: 0 y: 120 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Mem. Buffers:" } } Rectangle { x: 0 y: 150 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Mem. cached:" } } Rectangle { x: 0 y: 180 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Mem. avail.:" } } Rectangle { x: 0 y: 350 height: 30 width: parent.width Button { text: "Exit" anchors.fill: parent onClicked: Qt.quit() style: idButtonStyle } } } ///////////////////////////////////////////////////////////////////////////////////////////////// Rectangle { x: 140 y: 90 width: 120 height: 420 property var sysInfo: qGfaAppCtrl.sysInfo property var tivaInfo: qGfaAppCtrl.sysInfo.tivaInfo Rectangle { x: 0 y: 0 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 color: parent.sysInfo.bootFromEmmc ? "white" : "orange" Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.bootFromEmmc ? "EMMC" : "SD" } } Rectangle { x: 0 y: 30 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.memTotal !== 0 ? formatByteSize(parent.parent.sysInfo.memTotal * 1024) : "n/a" } } Rectangle { x: 0 y: 60 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.memFree !== 0 ? formatByteSize(parent.parent.sysInfo.memFree * 1024) : "n/a" } } Rectangle { x: 0 y: 90 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.memUsed !== 0 ? formatByteSize(parent.parent.sysInfo.memUsed * 1024) : "n/a" } } Rectangle { x: 0 y: 120 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.memBuffers !== 0 ? formatByteSize(parent.parent.sysInfo.memBuffers * 1024) : "n/a" } } Rectangle { x: 0 y: 150 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.memCached !== 0 ? formatByteSize(parent.parent.sysInfo.memCached * 1024) : "n/a" } } Rectangle { x: 0 y: 180 width: parent.width height: 30 border.width: 1 border.color: "black" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.sysInfo.memAvailable !== 0 ? formatByteSize(parent.parent.sysInfo.memAvailable * 1024) : "n/a" } } } ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// Rectangle { x: 410 y: 50 width: 250 height: 30 border.width: 1 border.color: "black" radius: 5 Text { font.pixelSize: 14 font.bold: true anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent text: "Tiva" } } Rectangle { x: 410 y: 90 width: 120 height: 420 Rectangle { x: 0 y: 0 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Uptime:" } } Rectangle { x: 0 y: 30 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "HW-Version:" } } Rectangle { x: 0 y: 60 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "SW-Version:" } } Rectangle { x: 0 y: 90 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "V Power:" } } Rectangle { x: 0 y: 120 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "V Sys.:" } } Rectangle { x: 0 y: 150 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "V Bat.:" } } Rectangle { x: 0 y: 180 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "V Bak.Bat.:" } } Rectangle { x: 0 y: 210 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Temp. Board °:" } } Rectangle { x: 0 y: 240 width: parent.width height: 30 Text { font.pixelSize: 14 font.italic: true anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: "Temp. Tiva °:" } } } ///////////////////////////////////////////////////////////////////////////////////////////////// Rectangle { x: 540 y: 90 width: 120 height: 420 property var tivaInfo: qGfaAppCtrl.sysInfo.tivaInfo property var spiAvail: !!tivaInfo.voltPowSup Rectangle { x: 0 y: 0 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? sec2HMS(parent.parent.tivaInfo.upTime) : "n/a" } } Rectangle { x: 0 y: 30 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.hwVersion : "n/a" } } Rectangle { x: 0 y: 60 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.swVersion : "n/a" } } Rectangle { x: 0 y: 90 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltPowSup.toFixed(2) : "n/a" } } Rectangle { x: 0 y: 120 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltSys.toFixed(2) : "n/a" } } Rectangle { x: 0 y: 150 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltBat.toFixed(2) : "n/a" } } Rectangle { x: 0 y: 180 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltBakBat.toFixed(2) : "n/a" } } Rectangle { x: 0 y: 210 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.tempBoard.toFixed(1) : "n/a" } } Rectangle { x: 0 y: 240 width: parent.width height: 30 border.width: 1 border.color: "lightgrey" radius: 5 Text { font.pointSize: 8 anchors.centerIn: parent text: parent.parent.spiAvail ? parent.parent.tivaInfo.tempTiva.toFixed(1) : "n/a" } } } }