PwmFansTab.qml 2.9 KB

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