2
0

PwmFansTab.qml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. ColumnLayout {
  24. property QtObject baseObject
  25. property QtObject loader: baseObject ? baseObject.loader : null
  26. property QtObject systemdCom: baseObject && baseObject.hasSystemdCommunicator() ? baseObject.systemdCom : null
  27. id: root
  28. anchors.fill: parent
  29. anchors.topMargin: 5
  30. RowLayout {
  31. width: parent.width
  32. visible: loader && loader.allPwmFans.length > 0
  33. Label {
  34. text: i18n("Fan:")
  35. Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
  36. renderType: Text.NativeRendering
  37. }
  38. ComboBox {
  39. id: fanCombobox
  40. model: ArrayFunctions.namesWithPaths(loader.allPwmFans)
  41. Layout.fillWidth: true
  42. Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
  43. }
  44. Button {
  45. Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
  46. action: detectFansAction
  47. }
  48. }
  49. Loader {
  50. Layout.fillHeight: true
  51. Layout.fillWidth: true
  52. active: !!baseObject.loader.allPwmFans[fanCombobox.currentIndex]
  53. sourceComponent: PwmFan {
  54. unit: baseObject.unit
  55. fan: loader.allPwmFans[fanCombobox.currentIndex]
  56. loader: root.loader
  57. systemdCom: baseObject.systemdCom
  58. minTemp: baseObject.minTemp
  59. maxTemp: baseObject.maxTemp
  60. }
  61. }
  62. ColumnLayout {
  63. id: noFansInfo
  64. anchors.centerIn: parent
  65. spacing: 20
  66. visible: loader.allPwmFans.length == 0
  67. Label {
  68. Layout.alignment: Qt.AlignCenter
  69. text: i18n("There are no pwm capable fans in your system.")
  70. font.pointSize: 14
  71. font.bold: true
  72. }
  73. Button {
  74. Layout.alignment: Qt.AlignCenter
  75. action: detectFansAction
  76. }
  77. }
  78. Action {
  79. id: detectFansAction
  80. text: i18n("Detect fans")
  81. iconName: "dialog-password"
  82. onTriggered: loader.detectSensors()
  83. }
  84. }