Application.qml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2015 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.4
  20. import QtQuick.Controls 1.3
  21. import QtQuick.Layouts 1.1
  22. import Fancontrol.Qml 1.0 as Fancontrol
  23. ApplicationWindow {
  24. id: window
  25. title: i18n("Fancontrol-GUI")
  26. width: 1024
  27. height: 768
  28. color: palette.window
  29. visible: true
  30. onClosing: {
  31. windowConfig.save(window);
  32. }
  33. Component.onCompleted: {
  34. Fancontrol.base.load();
  35. windowConfig.restore(window);
  36. }
  37. toolBar: ToolBar {
  38. RowLayout {
  39. anchors.fill: parent
  40. ToolButton {
  41. action: applyAction
  42. }
  43. ToolButton {
  44. action: resetAction
  45. }
  46. Loader {
  47. active: !!Fancontrol.base.systemdCom
  48. sourceComponent: ToolButton {
  49. action: startAction
  50. }
  51. }
  52. Loader {
  53. active: !!Fancontrol.base.systemdCom
  54. sourceComponent: ToolButton {
  55. action: stopAction
  56. }
  57. }
  58. Item {
  59. Layout.fillWidth: true
  60. }
  61. }
  62. }
  63. TabView {
  64. id: tabView
  65. anchors.fill: parent
  66. anchors.topMargin: 5
  67. frameVisible: true
  68. Tab {
  69. title: i18n("Sensors")
  70. SensorsTab {}
  71. }
  72. Tab {
  73. title: i18n("PwmFans")
  74. PwmFansTab {}
  75. }
  76. Tab {
  77. title: i18n("Configfile")
  78. ConfigfileTab {}
  79. }
  80. Tab {
  81. id: settingsTab
  82. title: i18n("Settings")
  83. SettingsTab {}
  84. }
  85. }
  86. Fancontrol.ErrorDialog {
  87. id: errorDialog
  88. visible: false
  89. modality: Qt.ApplicationModal
  90. }
  91. Action {
  92. id: applyAction
  93. text: i18n("Apply")
  94. enabled: Fancontrol.base.needsApply
  95. onTriggered: Fancontrol.base.apply()
  96. iconName: "dialog-ok-apply"
  97. tooltip: i18n("Apply changes")
  98. shortcut: StandardKey.Apply
  99. }
  100. Action {
  101. id: resetAction
  102. text: i18n("Reset")
  103. enabled: Fancontrol.base.needsApply
  104. onTriggered: Fancontrol.base.reset()
  105. iconName: "edit-undo"
  106. tooltip: i18n("Revert changes")
  107. }
  108. Action {
  109. id: startAction
  110. text: i18n("Start")
  111. enabled: !!Fancontrol.base.systemdCom && !Fancontrol.base.systemdCom.serviceActive
  112. iconName: "media-playback-start"
  113. tooltip: i18n("Enable manual control")
  114. onTriggered: Fancontrol.base.systemdCom.serviceActive = true
  115. }
  116. Action {
  117. id: stopAction
  118. text: i18n("Stop")
  119. enabled: !!Fancontrol.base.systemdCom && Fancontrol.base.systemdCom.serviceActive
  120. iconName: "media-playback-stop"
  121. tooltip: i18n("Disable manual control")
  122. onTriggered: Fancontrol.base.systemdCom.serviceActive = false
  123. }
  124. SystemPalette {
  125. id: palette
  126. }
  127. }