main.qml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2019 Malte Veerman <malte.veerman@gmail.com>
  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.6
  20. import QtQuick.Layouts 1.2
  21. import org.kde.kirigami 2.3 as Kirigami
  22. import org.kde.plasma.plasmoid 2.0
  23. import org.kde.plasma.core 2.0 as PlasmaCore
  24. import Fancontrol.Qml 1.0 as Fancontrol
  25. ColumnLayout {
  26. id: root
  27. readonly property QtObject fan: Fancontrol.Base.pwmFanModel.fan(plasmoid.configuration.Fan)
  28. Layout.minimumWidth: Plasmoid.formFactor == PlasmaCore.Types.Horizontal ? height : header.implicitWidth
  29. Layout.minimumHeight: Plasmoid.formFactor == PlasmaCore.Types.Vertical ? width : header.implicitHeight + Kirigami.Units.gridUnit * 5
  30. Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
  31. Plasmoid.associatedApplication: "fancontrol_gui"
  32. Plasmoid.icon: "org.kde.fancontrol.gui"
  33. Kirigami.Theme.backgroundColor: PlasmaCore.ColorScope.backgroundColor
  34. Kirigami.Theme.textColor: PlasmaCore.ColorScope.textColor
  35. Component.onCompleted: {
  36. Fancontrol.Base.load();
  37. }
  38. Connections {
  39. target: Fancontrol.Base.loader
  40. onConfigFileChanged: Fancontrol.Base.loader.load()
  41. }
  42. Fancontrol.FanHeader {
  43. id: header
  44. fan: root.fan
  45. editable: false
  46. Layout.fillWidth: true
  47. }
  48. Fancontrol.FanItem {
  49. fan: root.fan
  50. showControls: false
  51. editable: false
  52. Layout.fillWidth: true
  53. Layout.fillHeight: true
  54. }
  55. }