2
0

KCM.qml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. RowLayout {
  48. visible: enabledBox.checked && kcm.loader.allPwmFans.length > 0
  49. Label {
  50. text: i18n("Fan:")
  51. Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
  52. renderType: Text.NativeRendering
  53. }
  54. ComboBox {
  55. id: fanCombobox
  56. model: ArrayFunctions.namesWithPaths(kcm.loader.allPwmFans)
  57. Layout.fillWidth: true
  58. Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
  59. }
  60. }
  61. Loader {
  62. Layout.fillWidth: true
  63. Layout.fillHeight: true
  64. active: enabledBox.checked && !!kcm.loader.allPwmFans[fanCombobox.currentIndex]
  65. sourceComponent: PwmFan {
  66. minimizable: false
  67. unit: kcm.base.unit
  68. fan: kcm.loader.allPwmFans[fanCombobox.currentIndex]
  69. loader: kcm.loader
  70. systemdCom: kcm.systemdCom
  71. minTemp: kcm.base.minTemp
  72. maxTemp: kcm.base.maxTemp
  73. }
  74. }
  75. }
  76. }