PwmFansTab.qml 3.0 KB

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