PwmFansTab.qml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 QtQuick.Layouts 1.2
  22. import "../scripts/arrayfunctions.js" as ArrayFunctions
  23. ScrollView {
  24. property QtObject baseObject
  25. property QtObject loader: baseObject ? baseObject.loader : null
  26. property QtObject systemdCom: baseObject && baseObject.hasSystemdCommunicator() ? baseObject.systemdCom : null
  27. property real size: 1.0
  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. height: 800 * size
  48. fan: repeater.fans[index]
  49. loader: scrollView.loader
  50. systemdCom: scrollView.systemdCom
  51. minTemp: baseObject.minTemp
  52. maxTemp: baseObject.maxTemp
  53. unit: baseObject.unit
  54. }
  55. }
  56. }
  57. ColumnLayout {
  58. id: noFansInfo
  59. anchors.centerIn: parent
  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. iconName: "dialog-password"
  72. onClicked: loader.detectSensors()
  73. }
  74. }
  75. }