KCM.qml 3.1 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.3
  21. import QtQuick.Layouts 1.1
  22. import org.kde.kcm 1.0
  23. import "../scripts/arrayfunctions.js" as ArrayFunctions
  24. Item {
  25. implicitWidth: 800
  26. implicitHeight: 600
  27. ColumnLayout {
  28. anchors.fill: parent
  29. Label {
  30. visible: kcm.loader.allPwmFans.length == 0
  31. text: i18n("There are no pwm capable fans in your system.")
  32. anchors.top: enabledBox.bottom
  33. anchors.margins: 20
  34. }
  35. Button {
  36. text: i18n("Detect fans")
  37. visible: kcm.loader.allPwmFans.length == 0
  38. onClicked: kcm.loader.detectSensors()
  39. }
  40. CheckBox {
  41. id: enabledBox
  42. visible: kcm.loader.allPwmFans.length > 0
  43. Layout.alignment: Qt.AlignLeft | Qt.AlignTop
  44. text: i18n("Control fans manually")
  45. checked: kcm.manualControl
  46. }
  47. CheckBox {
  48. id: enabledBox
  49. visible: kcm.loader.allPwmFans.length > 0
  50. Layout.alignment: Qt.AlignLeft | Qt.AlignTop
  51. text: i18n("Control fans manually")
  52. checked: kcm.manualControl
  53. }
  54. RowLayout {
  55. visible: enabledBox.checked && kcm.loader.allPwmFans.length > 0
  56. Label {
  57. text: i18n("Fan:")
  58. Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
  59. renderType: Text.NativeRendering
  60. }
  61. ComboBox {
  62. id: fanCombobox
  63. model: ArrayFunctions.namesWithPaths(kcm.loader.allPwmFans)
  64. Layout.fillWidth: true
  65. Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
  66. }
  67. }
  68. Loader {
  69. Layout.fillWidth: true
  70. Layout.fillHeight: true
  71. active: enabledBox.checked && !!kcm.loader.allPwmFans[fanCombobox.currentIndex]
  72. sourceComponent: PwmFan {
  73. minimizable: false
  74. unit: kcm.unit
  75. fan: kcm.loader.allPwmFans[fanCombobox.currentIndex]
  76. loader: kcm.loader
  77. systemdCom: kcm.systemdCom
  78. minTemp: kcm.minTemp
  79. maxTemp: kcm.maxTemp
  80. }
  81. }
  82. }
  83. }