sysinfo.qml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. import QtQuick 2.6
  2. import QtQuick.Window 2.2
  3. import QtQuick.Controls 1.5
  4. import QtQuick.Controls.Styles 1.4
  5. import QtQuick.Controls.Private 1.0
  6. import com.gfa.ipc.appctrl 1.0
  7. Rectangle {
  8. width: 800
  9. height: 480
  10. /////////////////////////////////////////////////////////////////////////////////////////////////
  11. function sec2HMS(sec, prec)
  12. {
  13. if(!prec)
  14. prec = 0;
  15. var d = parseInt(sec / 86400);
  16. sec -= d * 86400;
  17. var h = parseInt(sec / 3600);
  18. sec -= h * 3600;
  19. var m = parseInt(sec / 60);
  20. sec -= m * 60;
  21. 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));
  22. }
  23. function formatByteSize(bytes, prec)
  24. {
  25. var s;
  26. if(!prec)
  27. prec = 1;
  28. if(bytes < 1024)
  29. s = "%1 B".arg(bytes);
  30. else
  31. {
  32. var a = ["KiB", "MiB", "GiB"/*, "TiB", "PiB", "EiB"*/];
  33. var e = parseInt(1 << (a.length * 10));
  34. var i;
  35. for(i = a.length - 1; (i > 0) && (e > bytes); --i, e >>= 10)
  36. ;
  37. s = qsTr("%1 %2").arg((bytes / e).toFixed(prec)).arg(a[i]);
  38. }
  39. return s;
  40. }
  41. /////////////////////////////////////////////////////////////////////////////////////////////////
  42. Rectangle {
  43. x: 10
  44. y: 10
  45. width: parent.width - 20
  46. height: 30
  47. radius: 5
  48. border.width: 1
  49. border.color: "black"
  50. color: qGfaAppCtrl.sysInfoRunning ? "lightgreen" : "red"
  51. Image {
  52. anchors.left: parent.left
  53. anchors.verticalCenter: parent.verticalCenter
  54. fillMode: Image.PreserveAspectFit
  55. height: parent.height
  56. source: "qrc:/img/blank.png"
  57. }
  58. Text {
  59. font.pixelSize: 16
  60. font.bold: true
  61. anchors.verticalCenter: parent.verticalCenter
  62. anchors.centerIn: parent
  63. text: "System Info"
  64. }
  65. Image {
  66. anchors.right: parent.right
  67. anchors.verticalCenter: parent.verticalCenter
  68. fillMode: Image.PreserveAspectFit
  69. height: parent.height
  70. source: "qrc:/img/next.png"
  71. MouseArea {
  72. anchors.fill: parent
  73. onClicked: { idPageLoader.source = "qml/appctrl.qml" }
  74. }
  75. }
  76. }
  77. /////////////////////////////////////////////////////////////////////////////////////////////////
  78. Rectangle {
  79. x: 10
  80. y: 50
  81. width: 250
  82. height: 30
  83. border.width: 1
  84. border.color: "black"
  85. radius: 5
  86. Text {
  87. font.pixelSize: 14
  88. font.bold: true
  89. anchors.verticalCenter: parent.verticalCenter
  90. anchors.centerIn: parent
  91. text: "Sitara"
  92. }
  93. }
  94. /////////////////////////////////////////////////////////////////////////////////////////////////
  95. Rectangle {
  96. x: 10
  97. y: 90
  98. width: 120
  99. height: 420
  100. Rectangle {
  101. x: 0
  102. y: 0
  103. width: parent.width
  104. height: 30
  105. Text {
  106. font.pixelSize: 14
  107. font.italic: true
  108. anchors.verticalCenter: parent.verticalCenter
  109. anchors.left: parent.left
  110. text: "Boot from:"
  111. }
  112. }
  113. Rectangle {
  114. x: 0
  115. y: 30
  116. width: parent.width
  117. height: 30
  118. Text {
  119. font.pixelSize: 14
  120. font.italic: true
  121. anchors.verticalCenter: parent.verticalCenter
  122. anchors.left: parent.left
  123. text: "Mem. total:"
  124. }
  125. }
  126. Rectangle {
  127. x: 0
  128. y: 60
  129. width: parent.width
  130. height: 30
  131. Text {
  132. font.pixelSize: 14
  133. font.italic: true
  134. anchors.verticalCenter: parent.verticalCenter
  135. anchors.left: parent.left
  136. text: "Mem. free:"
  137. }
  138. }
  139. Rectangle {
  140. x: 0
  141. y: 90
  142. width: parent.width
  143. height: 30
  144. Text {
  145. font.pixelSize: 14
  146. font.italic: true
  147. anchors.verticalCenter: parent.verticalCenter
  148. anchors.left: parent.left
  149. text: "Mem. used:"
  150. }
  151. }
  152. Rectangle {
  153. x: 0
  154. y: 120
  155. width: parent.width
  156. height: 30
  157. Text {
  158. font.pixelSize: 14
  159. font.italic: true
  160. anchors.verticalCenter: parent.verticalCenter
  161. anchors.left: parent.left
  162. text: "Mem. Buffers:"
  163. }
  164. }
  165. Rectangle {
  166. x: 0
  167. y: 150
  168. width: parent.width
  169. height: 30
  170. Text {
  171. font.pixelSize: 14
  172. font.italic: true
  173. anchors.verticalCenter: parent.verticalCenter
  174. anchors.left: parent.left
  175. text: "Mem. cached:"
  176. }
  177. }
  178. Rectangle {
  179. x: 0
  180. y: 180
  181. width: parent.width
  182. height: 30
  183. Text {
  184. font.pixelSize: 14
  185. font.italic: true
  186. anchors.verticalCenter: parent.verticalCenter
  187. anchors.left: parent.left
  188. text: "Mem. avail.:"
  189. }
  190. }
  191. Rectangle {
  192. x: 0
  193. y: 350
  194. height: 30
  195. width: parent.width
  196. Button {
  197. text: "Exit"
  198. anchors.fill: parent
  199. onClicked: Qt.quit()
  200. style: idButtonStyle
  201. }
  202. }
  203. }
  204. /////////////////////////////////////////////////////////////////////////////////////////////////
  205. Rectangle {
  206. x: 140
  207. y: 90
  208. width: 120
  209. height: 420
  210. property var sysInfo: qGfaAppCtrl.sysInfo
  211. property var tivaInfo: qGfaAppCtrl.sysInfo.tivaInfo
  212. Rectangle {
  213. x: 0
  214. y: 0
  215. width: parent.width
  216. height: 30
  217. border.width: 1
  218. border.color: "lightgrey"
  219. radius: 5
  220. color: parent.sysInfo.bootFromEmmc ? "white" : "orange"
  221. Text {
  222. font.pointSize: 8
  223. anchors.centerIn: parent
  224. text: parent.parent.sysInfo.bootFromEmmc ? "EMMC" : "SD"
  225. }
  226. }
  227. Rectangle {
  228. x: 0
  229. y: 30
  230. width: parent.width
  231. height: 30
  232. border.width: 1
  233. border.color: "lightgrey"
  234. radius: 5
  235. Text {
  236. font.pointSize: 8
  237. anchors.centerIn: parent
  238. text: parent.parent.sysInfo.memTotal !== 0 ? formatByteSize(parent.parent.sysInfo.memTotal * 1024) : "n/a"
  239. }
  240. }
  241. Rectangle {
  242. x: 0
  243. y: 60
  244. width: parent.width
  245. height: 30
  246. border.width: 1
  247. border.color: "lightgrey"
  248. radius: 5
  249. Text {
  250. font.pointSize: 8
  251. anchors.centerIn: parent
  252. text: parent.parent.sysInfo.memFree !== 0 ? formatByteSize(parent.parent.sysInfo.memFree * 1024) : "n/a"
  253. }
  254. }
  255. Rectangle {
  256. x: 0
  257. y: 90
  258. width: parent.width
  259. height: 30
  260. border.width: 1
  261. border.color: "lightgrey"
  262. radius: 5
  263. Text {
  264. font.pointSize: 8
  265. anchors.centerIn: parent
  266. text: parent.parent.sysInfo.memUsed !== 0 ? formatByteSize(parent.parent.sysInfo.memUsed * 1024) : "n/a"
  267. }
  268. }
  269. Rectangle {
  270. x: 0
  271. y: 120
  272. width: parent.width
  273. height: 30
  274. border.width: 1
  275. border.color: "lightgrey"
  276. radius: 5
  277. Text {
  278. font.pointSize: 8
  279. anchors.centerIn: parent
  280. text: parent.parent.sysInfo.memBuffers !== 0 ? formatByteSize(parent.parent.sysInfo.memBuffers * 1024) : "n/a"
  281. }
  282. }
  283. Rectangle {
  284. x: 0
  285. y: 150
  286. width: parent.width
  287. height: 30
  288. border.width: 1
  289. border.color: "lightgrey"
  290. radius: 5
  291. Text {
  292. font.pointSize: 8
  293. anchors.centerIn: parent
  294. text: parent.parent.sysInfo.memCached !== 0 ? formatByteSize(parent.parent.sysInfo.memCached * 1024) : "n/a"
  295. }
  296. }
  297. Rectangle {
  298. x: 0
  299. y: 180
  300. width: parent.width
  301. height: 30
  302. border.width: 1
  303. border.color: "black"
  304. radius: 5
  305. Text {
  306. font.pointSize: 8
  307. anchors.centerIn: parent
  308. text: parent.parent.sysInfo.memAvailable !== 0 ? formatByteSize(parent.parent.sysInfo.memAvailable * 1024) : "n/a"
  309. }
  310. }
  311. }
  312. /////////////////////////////////////////////////////////////////////////////////////////////////
  313. /////////////////////////////////////////////////////////////////////////////////////////////////
  314. /////////////////////////////////////////////////////////////////////////////////////////////////
  315. Rectangle {
  316. x: 410
  317. y: 50
  318. width: 250
  319. height: 30
  320. border.width: 1
  321. border.color: "black"
  322. radius: 5
  323. Text {
  324. font.pixelSize: 14
  325. font.bold: true
  326. anchors.verticalCenter: parent.verticalCenter
  327. anchors.centerIn: parent
  328. text: "Tiva"
  329. }
  330. }
  331. Rectangle {
  332. x: 410
  333. y: 90
  334. width: 120
  335. height: 420
  336. Rectangle {
  337. x: 0
  338. y: 0
  339. width: parent.width
  340. height: 30
  341. Text {
  342. font.pixelSize: 14
  343. font.italic: true
  344. anchors.verticalCenter: parent.verticalCenter
  345. anchors.left: parent.left
  346. text: "Uptime:"
  347. }
  348. }
  349. Rectangle {
  350. x: 0
  351. y: 30
  352. width: parent.width
  353. height: 30
  354. Text {
  355. font.pixelSize: 14
  356. font.italic: true
  357. anchors.verticalCenter: parent.verticalCenter
  358. anchors.left: parent.left
  359. text: "HW-Version:"
  360. }
  361. }
  362. Rectangle {
  363. x: 0
  364. y: 60
  365. width: parent.width
  366. height: 30
  367. Text {
  368. font.pixelSize: 14
  369. font.italic: true
  370. anchors.verticalCenter: parent.verticalCenter
  371. anchors.left: parent.left
  372. text: "SW-Version:"
  373. }
  374. }
  375. Rectangle {
  376. x: 0
  377. y: 90
  378. width: parent.width
  379. height: 30
  380. Text {
  381. font.pixelSize: 14
  382. font.italic: true
  383. anchors.verticalCenter: parent.verticalCenter
  384. anchors.left: parent.left
  385. text: "V Power:"
  386. }
  387. }
  388. Rectangle {
  389. x: 0
  390. y: 120
  391. width: parent.width
  392. height: 30
  393. Text {
  394. font.pixelSize: 14
  395. font.italic: true
  396. anchors.verticalCenter: parent.verticalCenter
  397. anchors.left: parent.left
  398. text: "V Sys.:"
  399. }
  400. }
  401. Rectangle {
  402. x: 0
  403. y: 150
  404. width: parent.width
  405. height: 30
  406. Text {
  407. font.pixelSize: 14
  408. font.italic: true
  409. anchors.verticalCenter: parent.verticalCenter
  410. anchors.left: parent.left
  411. text: "V Bat.:"
  412. }
  413. }
  414. Rectangle {
  415. x: 0
  416. y: 180
  417. width: parent.width
  418. height: 30
  419. Text {
  420. font.pixelSize: 14
  421. font.italic: true
  422. anchors.verticalCenter: parent.verticalCenter
  423. anchors.left: parent.left
  424. text: "V Bak.Bat.:"
  425. }
  426. }
  427. Rectangle {
  428. x: 0
  429. y: 210
  430. width: parent.width
  431. height: 30
  432. Text {
  433. font.pixelSize: 14
  434. font.italic: true
  435. anchors.verticalCenter: parent.verticalCenter
  436. anchors.left: parent.left
  437. text: "Temp. Board °:"
  438. }
  439. }
  440. Rectangle {
  441. x: 0
  442. y: 240
  443. width: parent.width
  444. height: 30
  445. Text {
  446. font.pixelSize: 14
  447. font.italic: true
  448. anchors.verticalCenter: parent.verticalCenter
  449. anchors.left: parent.left
  450. text: "Temp. Tiva °:"
  451. }
  452. }
  453. }
  454. /////////////////////////////////////////////////////////////////////////////////////////////////
  455. Rectangle {
  456. x: 540
  457. y: 90
  458. width: 120
  459. height: 420
  460. property var tivaInfo: qGfaAppCtrl.sysInfo.tivaInfo
  461. property var spiAvail: !!tivaInfo.voltPowSup
  462. Rectangle {
  463. x: 0
  464. y: 0
  465. width: parent.width
  466. height: 30
  467. border.width: 1
  468. border.color: "lightgrey"
  469. radius: 5
  470. Text {
  471. font.pointSize: 8
  472. anchors.centerIn: parent
  473. text: parent.parent.spiAvail ? sec2HMS(parent.parent.tivaInfo.upTime) : "n/a"
  474. }
  475. }
  476. Rectangle {
  477. x: 0
  478. y: 30
  479. width: parent.width
  480. height: 30
  481. border.width: 1
  482. border.color: "lightgrey"
  483. radius: 5
  484. Text {
  485. font.pointSize: 8
  486. anchors.centerIn: parent
  487. text: parent.parent.spiAvail ? parent.parent.tivaInfo.hwVersion : "n/a"
  488. }
  489. }
  490. Rectangle {
  491. x: 0
  492. y: 60
  493. width: parent.width
  494. height: 30
  495. border.width: 1
  496. border.color: "lightgrey"
  497. radius: 5
  498. Text {
  499. font.pointSize: 8
  500. anchors.centerIn: parent
  501. text: parent.parent.spiAvail ? parent.parent.tivaInfo.swVersion : "n/a"
  502. }
  503. }
  504. Rectangle {
  505. x: 0
  506. y: 90
  507. width: parent.width
  508. height: 30
  509. border.width: 1
  510. border.color: "lightgrey"
  511. radius: 5
  512. Text {
  513. font.pointSize: 8
  514. anchors.centerIn: parent
  515. text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltPowSup.toFixed(2) : "n/a"
  516. }
  517. }
  518. Rectangle {
  519. x: 0
  520. y: 120
  521. width: parent.width
  522. height: 30
  523. border.width: 1
  524. border.color: "lightgrey"
  525. radius: 5
  526. Text {
  527. font.pointSize: 8
  528. anchors.centerIn: parent
  529. text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltSys.toFixed(2) : "n/a"
  530. }
  531. }
  532. Rectangle {
  533. x: 0
  534. y: 150
  535. width: parent.width
  536. height: 30
  537. border.width: 1
  538. border.color: "lightgrey"
  539. radius: 5
  540. Text {
  541. font.pointSize: 8
  542. anchors.centerIn: parent
  543. text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltBat.toFixed(2) : "n/a"
  544. }
  545. }
  546. Rectangle {
  547. x: 0
  548. y: 180
  549. width: parent.width
  550. height: 30
  551. border.width: 1
  552. border.color: "lightgrey"
  553. radius: 5
  554. Text {
  555. font.pointSize: 8
  556. anchors.centerIn: parent
  557. text: parent.parent.spiAvail ? parent.parent.tivaInfo.voltBakBat.toFixed(2) : "n/a"
  558. }
  559. }
  560. Rectangle {
  561. x: 0
  562. y: 210
  563. width: parent.width
  564. height: 30
  565. border.width: 1
  566. border.color: "lightgrey"
  567. radius: 5
  568. Text {
  569. font.pointSize: 8
  570. anchors.centerIn: parent
  571. text: parent.parent.spiAvail ? parent.parent.tivaInfo.tempBoard.toFixed(1) : "n/a"
  572. }
  573. }
  574. Rectangle {
  575. x: 0
  576. y: 240
  577. width: parent.width
  578. height: 30
  579. border.width: 1
  580. border.color: "lightgrey"
  581. radius: 5
  582. Text {
  583. font.pointSize: 8
  584. anchors.centerIn: parent
  585. text: parent.parent.spiAvail ? parent.parent.tivaInfo.tempTiva.toFixed(1) : "n/a"
  586. }
  587. }
  588. }
  589. }