SensorsTab.qml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 Fancontrol.Qml 1.0 as Fancontrol
  23. RowLayout {
  24. property QtObject loader: Fancontrol.base.loader
  25. id: root
  26. anchors.fill: parent
  27. anchors.margins: 10
  28. Repeater {
  29. model: loader.hwmons.length
  30. Rectangle {
  31. property QtObject hwmon: loader.hwmons[index]
  32. property int padding: 10
  33. Layout.preferredWidth: root.width / loader.hwmons.length - root.spacing
  34. Layout.maximumWidth: 500
  35. Layout.fillHeight: true
  36. color: palette.light
  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. font.pointSize: 12
  47. horizontalAlignment: Text.horizontalCenter
  48. }
  49. Repeater {
  50. model: hwmon.fans.length
  51. RowLayout {
  52. width: parent.width
  53. Label {
  54. anchors.left: parent.left
  55. anchors.leftMargin: padding
  56. Layout.maximumWidth: parent.width - rpmValue.width - padding*2
  57. clip: true
  58. text: "Fan " + (index+1) + ":"
  59. }
  60. Label {
  61. id: rpmValue
  62. anchors.right: parent.right
  63. anchors.rightMargin: padding
  64. text: hwmon.fans[index].rpm + " " + i18n("rpm")
  65. }
  66. }
  67. }
  68. Repeater {
  69. model: hwmon.temps.length
  70. RowLayout {
  71. width: parent.width
  72. Label {
  73. anchors.left: parent.left
  74. anchors.leftMargin: padding
  75. text: hwmon.temps[index].name + ": "
  76. Layout.maximumWidth: parent.width - tempValue.width - padding*2
  77. clip: true
  78. }
  79. Label {
  80. id: tempValue
  81. anchors.right: parent.right
  82. anchors.rightMargin: padding
  83. text: Units.fromCelsius(hwmon.temps[index].value, Fancontrol.base.unit) + " " + i18n(Fancontrol.base.unit)
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. SystemPalette {
  91. id: palette
  92. }
  93. }