SensorsTab.qml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 != null ? 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. border.width: 1
  38. border.color: "black"
  39. radius: 5
  40. Column {
  41. id: column
  42. anchors.fill: parent
  43. Label {
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. text: hwmon.name
  46. horizontalAlignment: Text.horizontalCenter
  47. }
  48. Repeater {
  49. model: hwmon.fans.length
  50. RowLayout {
  51. width: parent.width
  52. Label {
  53. anchors.left: parent.left
  54. anchors.leftMargin: padding
  55. Layout.maximumWidth: parent.width - rpmValue.width - padding*2
  56. clip: true
  57. text: "Fan " + (index+1) + " RPM : "
  58. }
  59. Label {
  60. id: rpmValue
  61. anchors.right: parent.right
  62. anchors.rightMargin: padding
  63. text: hwmon.fans[index].rpm
  64. }
  65. }
  66. }
  67. Repeater {
  68. model: hwmon.temps.length
  69. RowLayout {
  70. width: parent.width
  71. Label {
  72. anchors.left: parent.left
  73. anchors.leftMargin: padding
  74. text: hwmon.temps[index].name + ": "
  75. Layout.maximumWidth: parent.width - tempValue.width - padding*2
  76. clip: true
  77. }
  78. Label {
  79. id: tempValue
  80. anchors.right: parent.right
  81. anchors.rightMargin: padding
  82. text: hwmon.temps[index].value
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }