2
0

PwmFansTab.qml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. text: i18n("Detect fans")
  47. iconName: "dialog-password"
  48. onClicked: baseObject.loader.detectSensors()
  49. }
  50. }
  51. Loader {
  52. Layout.fillHeight: true
  53. Layout.fillWidth: true
  54. active: !!baseObject.loader.allPwmFans[fanCombobox.currentIndex]
  55. sourceComponent: PwmFan {
  56. minimizable: false
  57. unit: baseObject.unit
  58. fan: loader.allPwmFans[fanCombobox.currentIndex]
  59. loader: root.loader
  60. systemdCom: baseObject.systemdCom
  61. minTemp: baseObject.minTemp
  62. maxTemp: baseObject.maxTemp
  63. }
  64. }
  65. ColumnLayout {
  66. id: noFansInfo
  67. anchors.centerIn: parent
  68. spacing: 20
  69. visible: loader.allPwmFans.length == 0
  70. Label {
  71. Layout.alignment: Qt.AlignCenter
  72. text: i18n("There are no pwm capable fans in your system.")
  73. font.pointSize: 14
  74. font.bold: true
  75. }
  76. Button {
  77. Layout.alignment: Qt.AlignCenter
  78. text: i18n("Detect fans")
  79. iconName: "dialog-password"
  80. onClicked: loader.detectSensors()
  81. }
  82. }
  83. }