PwmFansTab.qml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.4
  21. import "../scripts/arrayfunctions.js" as ArrayFunctions
  22. ScrollView {
  23. property QtObject baseObject
  24. property QtObject loader: baseObject ? baseObject.loader : null
  25. property QtObject systemdCom: baseObject && baseObject.hasSystemdCommunicator() ? baseObject.systemdCom : null
  26. property real size: 1.0
  27. id: scrollView
  28. anchors.fill: parent
  29. anchors.topMargin: 5
  30. Flow {
  31. spacing: 20 * size
  32. width: scrollView.viewport.width
  33. move: Transition {
  34. NumberAnimation {
  35. easing.type: Easing.OutQuad
  36. properties: "x,y"
  37. duration: 300
  38. }
  39. }
  40. Repeater {
  41. property var fans: loader ? loader.allPwmFans : []
  42. id: repeater
  43. model: fans.length
  44. PwmFan {
  45. width: 1000 * size
  46. height: 800 * size
  47. fan: repeater.fans[index]
  48. loader: scrollView.loader
  49. systemdCom: scrollView.systemdCom
  50. minTemp: baseObject.minTemp
  51. maxTemp: baseObject.maxTemp
  52. unit: baseObject.unit
  53. }
  54. }
  55. }
  56. ColumnLayout {
  57. id: noFansInfo
  58. width: parent.width
  59. anchors.verticalCenter: parent.verticalCenter
  60. spacing: 20
  61. visible: repeater.fans.length == 0
  62. Label {
  63. Layout.alignment: Qt.AlignCenter
  64. text: i18n("There are no pwm capable fans in your system.")
  65. font.pointSize: 14
  66. font.bold: true
  67. }
  68. Button {
  69. Layout.alignment: Qt.AlignCenter
  70. text: i18n("Detect fans")
  71. onClicked: loader.detectSensors()
  72. }
  73. }
  74. }