KCM.qml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. CheckBox {
  30. id: enabledBox
  31. Layout.alignment: Qt.AlignLeft | Qt.AlignTop
  32. text: i18n("Control fans manually")
  33. checked: kcm.manualControl
  34. }
  35. Label {
  36. visible: enabledBox.checked && kcm.loader.allPwmFans.length == 0
  37. text: i18n("There are no pwm capable fans in your system.")
  38. anchors.top: enabledBox.bottom
  39. anchors.margins: 20
  40. }
  41. RowLayout {
  42. visible: enabledBox.checked && kcm.loader.allPwmFans.length > 0
  43. Label {
  44. text: i18n("Fan:")
  45. Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
  46. renderType: Text.NativeRendering
  47. }
  48. ComboBox {
  49. id: fanCombobox
  50. model: ArrayFunctions.namesWithPaths(kcm.loader.allPwmFans)
  51. Layout.fillWidth: true
  52. Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
  53. }
  54. }
  55. Loader {
  56. active: enabledBox.checked && !!kcm.loader.allPwmFans[fanCombobox.currentIndex]
  57. sourceComponent: PwmFan {
  58. id: fan
  59. minimizable: false
  60. unit: kcm.unit
  61. fan: kcm.loader.allPwmFans[fanCombobox.currentIndex]
  62. loader: kcm.loader
  63. systemdCom: kcm.systemdCom
  64. minTemp: kcm.minTemp
  65. maxTemp: kcm.maxTemp
  66. Layout.fillWidth: true
  67. Layout.fillHeight: true
  68. }
  69. }
  70. }
  71. }