PwmFansTab.qml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 loader
  24. property real size: 1.0
  25. property real minTemp: 30.0
  26. property real maxTemp: 90.0
  27. property string unit: "Celsius"
  28. id: scrollView
  29. anchors.fill: parent
  30. anchors.topMargin: 5
  31. Flow {
  32. spacing: 20 * size
  33. width: scrollView.viewport.width
  34. move: Transition {
  35. NumberAnimation {
  36. easing.type: Easing.OutQuad
  37. properties: "x,y"
  38. duration: 300
  39. }
  40. }
  41. Repeater {
  42. property var fans: loader ? loader.allPwmFans : []
  43. id: repeater
  44. model: fans.length
  45. PwmFan {
  46. width: 1000 * size
  47. hwRatio: 0.8
  48. fan: repeater.fans[index]
  49. loader: loader
  50. minTemp: scrollView.minTemp
  51. maxTemp: scrollView.maxTemp
  52. unit: scrollView.unit
  53. }
  54. }
  55. }
  56. Label {
  57. anchors.margins: 10
  58. visible: repeater.fans.length == 0
  59. text: i18n("There are no pwm capable fans in your system.")
  60. font.bold: true
  61. }
  62. }