main.qml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.associatedApplication: "fancontrol_gui"
  31. Plasmoid.icon: "org.kde.fancontrol.gui"
  32. Kirigami.Theme.backgroundColor: PlasmaCore.ColorScope.backgroundColor
  33. Kirigami.Theme.textColor: PlasmaCore.ColorScope.textColor
  34. Component.onCompleted: {
  35. Fancontrol.Base.load();
  36. }
  37. Fancontrol.FanHeader {
  38. id: header
  39. fan: root.fan
  40. editable: false
  41. Layout.fillWidth: true
  42. }
  43. Fancontrol.FanItem {
  44. fan: root.fan
  45. showControls: false
  46. editable: false
  47. Layout.fillWidth: true
  48. Layout.fillHeight: true
  49. }
  50. }