SensorsTab.qml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (C) 2015 Malte Veerman <maldela@halloarsch.de>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. */
  19. import QtQuick 2.4
  20. import QtQuick.Controls 1.2
  21. import QtQuick.Layouts 1.1
  22. import "../scripts/arrayfunctions.js" as ArrayFunctions
  23. RowLayout {
  24. property QtObject loader
  25. id: root
  26. anchors.fill: parent
  27. anchors.margins: 2
  28. anchors.topMargin: 10
  29. Repeater {
  30. model: !!loader ? loader.hwmons.length : 0
  31. Rectangle {
  32. property QtObject hwmon: loader.hwmons[index]
  33. property int padding: 10
  34. Layout.preferredWidth: root.width / loader.hwmons.length - root.spacing
  35. Layout.maximumWidth: 500
  36. Layout.fillHeight: true
  37. color: palette.light
  38. border.width: 1
  39. border.color: "black"
  40. radius: 5
  41. Column {
  42. id: column
  43. anchors.fill: parent
  44. Label {
  45. anchors.horizontalCenter: parent.horizontalCenter
  46. text: hwmon.name
  47. font.pointSize: 12
  48. horizontalAlignment: Text.horizontalCenter
  49. }
  50. Repeater {
  51. model: hwmon.fans.length
  52. RowLayout {
  53. width: parent.width
  54. Label {
  55. anchors.left: parent.left
  56. anchors.leftMargin: padding
  57. Layout.maximumWidth: parent.width - rpmValue.width - padding*2
  58. clip: true
  59. text: "Fan " + (index+1) + " RPM : "
  60. }
  61. Label {
  62. id: rpmValue
  63. anchors.right: parent.right
  64. anchors.rightMargin: padding
  65. text: hwmon.fans[index].rpm
  66. }
  67. }
  68. }
  69. Repeater {
  70. model: hwmon.temps.length
  71. RowLayout {
  72. width: parent.width
  73. Label {
  74. anchors.left: parent.left
  75. anchors.leftMargin: padding
  76. text: hwmon.temps[index].name + ": "
  77. Layout.maximumWidth: parent.width - tempValue.width - padding*2
  78. clip: true
  79. }
  80. Label {
  81. id: tempValue
  82. anchors.right: parent.right
  83. anchors.rightMargin: padding
  84. text: hwmon.temps[index].value
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. SystemPalette {
  92. id: palette
  93. }
  94. }